You are not logged in.

#1 2018-03-29 16:12:32

fusca
Member
Registered: 2008-01-16
Posts: 25

cannot create directory: Permission denied

Hi...

I'm trying to create a package, named "mypkg", with no success.

The process needs to copy one header file to /usr/include BEFORE ./configure call.

I'm trying this with build() function:

build() {
  cd $pkgname-$pkgver

  install -Dm644 ./myfunctions/src/func_module.h "$pkgdir"/usr/include

  ./configure

  make
}

... and the result:

$ makepkg -e
==> Making package: mypgk 1.0.0-1 (Thu Mar 29 10:26:41 -03 2018)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> WARNING: Using existing $srcdir/ tree
==> Removing existing $pkgdir/ directory...
==> Starting build()...
install: cannot create directory '/tmp/mypgk/pkg/mypgk': Permission denied
==> ERROR: A failure occurred in build().
    Aborting...


What I'm doing wrong? How can I fix it?

Thanks in advance.

Offline

#2 2018-03-29 16:15:15

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,466

Re: cannot create directory: Permission denied

You can't use $pkgdir in the build function at all. There's no way the header needs to be there before configure, as configure wouldn't touch it, either.

Offline

#3 2018-03-29 16:40:30

fusca
Member
Registered: 2008-01-16
Posts: 25

Re: cannot create directory: Permission denied

Scimmia wrote:

You can't use $pkgdir in the build function at all. There's no way the header needs to be there before configure, as configure wouldn't touch it, either.

Well... my ./configure script checks if the header file exists in /usr/include. sad

Offline

#4 2018-03-29 16:56:25

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,466

Re: cannot create directory: Permission denied

It sounds like it's checking for a dependency. Are you trying to install multiple things with one PKGBUILD?

Offline

#5 2018-03-29 17:11:13

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,449
Website

Re: cannot create directory: Permission denied

You are not trying to build "mypkg" and the header it's checking for is not func_module.h.

If you actually want help, stop trying to hide what you are actually doing.  Post the complete and actual PKGBUILD in code tags.

Last edited by Trilby (2018-03-29 17:11:51)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#6 2018-03-29 17:33:37

fusca
Member
Registered: 2008-01-16
Posts: 25

Re: cannot create directory: Permission denied

Trilby wrote:

You are not trying to build "mypkg" and the header it's checking for is not func_module.h.

If you actually want help, stop trying to hide what you are actually doing.  Post the complete and actual PKGBUILD in code tags.

I'm not trying to hide what I'm doing. I'm trying to simplify this issue, but I're right!

I'm trying to compile  NGINX with nginx-c-function module https://github.com/Taymindis/nginx-c-function. In the README module, the software engineer says "ngx_http_c_func_module.h header not found when configure - When first time configure this project, I purposely do not include this header, you may need to install it to your c header file as this header file need to share with your .so application as well."

Example of installing header:

install -m 644 /path/to/nginx-c-function/src/ngx_http_c_func_module.h /usr/include/

Even modifying the config module file, commenting these lines:

#if [ $ngx_found != yes ]; then                                                                                              
#echo "ngx_http_c_func_module.h not found in your system c header path, please copy latest ngx_http_c_func_module.h to your /usr/include or /usr/local/#include or relavent header search path with read and write permission given."                     
#echo "e.g install -m 644 ../nginx-c-function/src/ngx_http_c_func_module.h /usr/local/include/"                              
#echo                                                                                                                        
#exit 1                                                                                                                      
#else                                                                                                                        
#cat $ngx_addon_dir/build_test_resources/sanity_test_raw_parse.t > $ngx_addon_dir/t/sanity.t                                 
#cc -shared -o $ngx_addon_dir/t/libcfuntest.so -fPIC $ngx_addon_dir/build_test_resources/cfuntest.c                          
#ABSOLUTE_NGX_CFUNC_CURRENT_PATH="$( cd "$ngx_addon_dir" ; pwd -P )"                                                         
#sed -i "s@NGINX_HTTP_C_FUNCTION_TEST_LIB_PATH@$ABSOLUTE_NGX_CFUNC_CURRENT_PATH/t@g" $ngx_addon_dir/t/sanity.t
#fi

... and putting the

install -Dm644 ./nginx-c-function/src/ngx_http_c_func_module.h "$pkgdir"/usr/include

line into PKGBUILD package() function, I get the error during the compilation:

src/stream/ngx_stream_ssl_preread_module.c
cc -c -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -D_FORTIFY_SOURCE=2  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules -I src/http/v2 -I src/mail -I src/stream \
        -o objs/addon/src/ngx_http_c_func_module.o \
        nginx-c-function/src/ngx_http_c_func_module.c
nginx-c-function/src/ngx_http_c_func_module.c:38:10: fatal error: ngx_http_c_func_module.h: No such file or directory
 #include <ngx_http_c_func_module.h>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [objs/Makefile:1773: objs/addon/src/ngx_http_c_func_module.o] Error 1
make[1]: Leaving directory '/tmp/nginx_with_c_module/src/nginx-1.12.2'
make: *** [Makefile:8: build] Error 2
==> ERROR: A failure occurred in build().
    Aborting...

That's it. I want to automate the compilation process into the PKGBUILD file.

Last edited by fusca (2018-03-29 18:23:49)

Offline

#7 2018-03-29 17:50:34

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: cannot create directory: Permission denied

Use  code tags when pasting here: https://wiki.archlinux.org/index.php/Co … s_and_code


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#8 2018-03-29 18:21:49

fusca
Member
Registered: 2008-01-16
Posts: 25

Re: cannot create directory: Permission denied

jasonwryan wrote:

Sorry... It will not happen again.

Last edited by fusca (2018-03-29 18:22:01)

Offline

#9 2018-03-29 18:25:26

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: cannot create directory: Permission denied

The upstream developer is a complete and utter moron and should have his own source code include the header from the same directory as the *.c file?

1) The header should only be installed separately if other projects are expected to link against the resulting shared library; if so, it should be installed by default, and only in the same install process as the shared library itself...

2) There is simply no earthly reason to use the system include path for this shared library itself, when it would have worked if he did the default thing. This would also produce the wrong results as-is, in every conceivable situation. Using the headers from a different, possibly outdated install of the project is considerably foolish.
Please report an upstream bug, referencing this link: https://gcc.gnu.org/onlinedocs/cpp/Search-Path.html

Last edited by eschwartz (2018-03-29 18:27:52)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#10 2018-03-30 11:39:50

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: cannot create directory: Permission denied

Eschwartz wrote:

The upstream developer is a complete and utter moron

If you check the online readme, i'll think you'll be more lenient.

https://github.com/Taymindis/nginx-c-fu … ing-header
Taymindis suggests to install the header file in /usr/local/include .
For developers that don't expect their software to be maintained by package managers that's a common solution.

Fusca, I do think you should create a bug report, just make clear that you want to install the code through a package manager.

edit:typo

Last edited by Lone_Wolf (2018-03-30 12:01:41)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#11 2018-03-30 11:58:51

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,466

Re: cannot create directory: Permission denied

Lone_Wolf wrote:

Taymindis suggests to install the header file in /usr/local/include .
For developers that don't expect their software to be maintained by package managers that's a common solution.

No, it really isn't. It's common for projects to install their headers there, it is not common to require you to manually copy the header there before your software will even build. That's lunacy.

Last edited by Scimmia (2018-03-30 11:59:19)

Offline

#12 2018-03-30 12:00:00

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,449
Website

Re: cannot create directory: Permission denied

Ok, I'll try again:

Trilby wrote:

If you actually want help ... Post the complete and actual PKGBUILD in code tags.

I just built it without issue:

CFLAGS='-I/path/to/nginx-c-function/src/' ./configure --add-module=/path/to/nginx-c-function/

Far better than this though would be for upstream to just use a proper config file.  Nginx docs include parameters like ngx_module_incs specifically for this purpose.  I've successfully built also by simply patching the nginx-c-functions config file a bit.  But I've never written nginx modules, so I'm not sure if I'm doing it quite right ... I am pretty confident though that this module's author is definitely not doing it right.  Nginx seems to have a pretty capable module build system - this module's author should use it properly.

On a slightly tangential note: if the author is using ugly hackish shortcuts for something as simple as including a header file, do you really trust the rest of their code to be statically linked into your web server?

Last edited by Trilby (2018-03-30 12:27:04)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#13 2018-03-30 13:47:19

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: cannot create directory: Permission denied

Lone_Wolf wrote:
Eschwartz wrote:

The upstream developer is a complete and utter moron

If you check the online readme, i'll think you'll be more lenient.

https://github.com/Taymindis/nginx-c-fu … ing-header
Taymindis suggests to install the header file in /usr/local/include .
For developers that don't expect their software to be maintained by package managers that's a common solution.

Fusca, I do think you should create a bug report, just make clear that you want to install the code through a package manager.

edit:typo

I see Scimmia already answered for me... but consider my actual words. Why do you assume I spoke without looking at the project? I looked at the readme, said "this is moronic", and went to read his *code*, at which point I commented here to say "this happens because the developer did not use proper CPP include syntax", and provided a freaking link to the explanation of how to C properly. I think I was abundantly overclear on what I meant and why it was wrong, so not only did you (apparently) read much less of the upstream project than I did, you also failed to my post in this very thread.

The GCC manual wrote:

By default, the preprocessor looks for header files included by the quote form of the directive #include "file" first relative to the directory of the current file, and then in a preconfigured list of standard system directories.

For the angle-bracket form #include <file>, the preprocessor’s default behavior is to look only in the standard system directories.

I have literally never seen any other software project *ever* demand you install the in-tree headers before invoking the compiler on the in-tree code. It's not only not common, it's unheard of... but then, most of those people figured out it is stupid to use angle-brackets to include your own headers...

In case you weren't aware of what /usr/local is, it is the overlay-style place where developers put their built shared libraries together with their headers. It is literally the same as /usr and follows the same rules (like "don't install headers before you build the project itself"), and the use of /usr/local is completely irrelevant to the issue. It at best shows the developer never thought about package managers at all, and maybe never thought, period -- because people who do think about package managers assuredly thought about other things too, but the reverse cannot be philosophically proven.

Last edited by eschwartz (2018-03-30 13:51:33)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#14 2018-03-30 14:05:29

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,449
Website

Re: cannot create directory: Permission denied

Eschwartz, while certainly correct, fixing the include in the source file is not sufficient to avoid the problem.  The error actually comes from config file which (for no reason at all) checks whether the header file is already present in the system include path(s).


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#15 2018-03-30 15:42:28

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: cannot create directory: Permission denied

Well sure, you'd also need to unwind and revert the configure checks which are born of the moronic assumption that the headers should be looked for in the system install dir. nginx does not need to know about this at all.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#16 2018-03-30 19:58:25

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: cannot create directory: Permission denied

Eschwartz, it seems you and i have different opinions what /usr/local is for.

My opinion largely comes form the FHS, http://www.tldp.org/LDP/Linux-Filesyste … l/usr.html
In your post you mentioned "system include path" . for me this is applicable to  /usr/include/ , but NOT /usr/local/include .
In post #6 moving  the header file to /usr/include is shown, while the online readme uses /usr/local/include .
This suggested to me you were referring to the posts in this thread, not the online code.

In my opinion the upstream dev was not doing a smart thing, but I had no reason to consider them a moron.


This led to 2 things :

I didn't understand why the link to cpp search paths was needed, saw it as minor.

What bothered me more was that the tone of your post felt much harsher then was warranted in my opinion.
I also felt that dev would have every right to respond to that post with intense dislike of you / users of this forum / archlinux .

I phrased my post the way i did to try and compensate for that, although it looks like I achieved the opposite.
This is not the first time that happened in threads where both Eschwartz and I have posted.
I'll have to think carefully whether I should stay out of threads where Eschwartz has replied in the future.


Scimmia, thank you for correcting my post in a neutral manner.

All others : please continue helping Fusca finding a solution.
I'm out of this thread now.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#17 2018-03-30 21:08:27

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: cannot create directory: Permission denied

Lone_Wolf wrote:

Eschwartz, it seems you and i have different opinions what /usr/local is for.

My opinion largely comes form the FHS, http://www.tldp.org/LDP/Linux-Filesyste … l/usr.html
In your post you mentioned "system include path" . for me this is applicable to  /usr/include/ , but NOT /usr/local/include .
In post #6 moving  the header file to /usr/include is shown, while the online readme uses /usr/local/include .
This suggested to me you were referring to the posts in this thread, not the online code.

The C/C++ programming language has a strict definition of "system path", which also includes e.g. on my machine /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.1/include

This is a discussion about the C compiler failing to find something, therefore you shouldn't be looking at the FHS you should be looking at gcc documentation (which I linked to). Note also that the FHS is controversial (in the sense that many people either ignore or vehemently disagree with it), on top of which the FHS merely documents what others do -- with a several-year lag.

But much more problematic is the fact that your response really did not answer anything, because...

Lone_Wolf wrote:

In my opinion the upstream dev was not doing a smart thing, but I had no reason to consider them a moron.


This led to 2 things :

I didn't understand why the link to cpp search paths was needed, saw it as minor.

So you didn't understand, but you tried to tell me I was wrong anyway? You read the first half of my first sentence, internalized that I insulted someone, then decided to argue with me... but didn't understand what I was getting at with the rest of my post so simply ignored the entire thing other than my introductory remark?

Lone_Wolf wrote:

What bothered me more was that the tone of your post felt much harsher then was warranted in my opinion.
I also felt that dev would have every right to respond to that post with intense dislike of you / users of this forum / archlinux .

This doesn't bother me, for the same reason as:

Trilby wrote:

On a slightly tangential note: if the author is using ugly hackish shortcuts for something as simple as including a header file, do you really trust the rest of their code to be statically linked into your web server?

If they cannot manage to clue into and follow the basic guidelines of programming, then "intensely dislike" me for calling them out for it, then... well, I refuse to feel bad about it. I still feel my harshness was deserved.

Lone_Wolf wrote:

I phrased my post the way i did to try and compensate for that, although it looks like I achieved the opposite.
This is not the first time that happened in threads where both Eschwartz and I have posted.
I'll have to think carefully whether I should stay out of threads where Eschwartz has replied in the future.

You "compensated" for it by not answering what I said in any way, because you didn't even discuss what I said. If you responded to me with factually incorrect but on-topic info I would understand where you came from...

Lone_Wolf wrote:

Scimmia, thank you for correcting my post in a neutral manner.

I call it moronic, he calls it lunacy. Hardly neutral, the only difference between us is I also called you out for your butchering of my post.

Given your whole objection to me seems to be that I insulted the upstream dev, you should have the same objection to Scimmia...


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#18 2018-03-30 21:45:43

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,787
Website

Re: cannot create directory: Permission denied

Okay, I am calling time on this discussion before it gets out of hand. If either of you want to continue discussing it, please take it off the board.

fusca, I am assuming the technical reasons for the error have been made clear to you. This is an upstream bug, and should be reported there.

Closing.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

Board footer

Powered by FluxBB