You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Carsten Wiedmann <ca...@gmx.de> on 2009/12/09 10:14:33 UTC

[mod_fcgid] can't find apr headers

Hello,

I'm trying to build mod_fcgid-2.3.4 (at the moment I'm using the (old)
mod_fcgid-2.2).

But it can only find the httpd includes, and not the apr includes. And this
confirms the "make" output. I only see a:
| -I/usr/local/include/apache22
but not a:
| -I/usr/local/include/apr-1

If I build other modules with the normal/usual:
| apxs -c mod_foo.c
there is no such problem.

It also seems there is no option for configure.apxs to define additional
include dirs?


BTW:
in config.apxs.log I have 2 errors for "conftest_sys_mutex.h.c".  Maybe
that's normal and can happen?


Regards,
Carsten


Re: [mod_fcgid] can't find apr headers

Posted by Carsten Wiedmann <ca...@gmx.de>.
Am 10.12.2009 15:07, schrieb Jeff Trawick:
>>>> No, the apr include dir is not part of EXTRA_INCLUDES. The apr inlude dir is
>>>> defined in APR_INCLUDEDIR.
>>>
>>> The APR include dir should appear within both APR_INCLUDEDIR and
>>> EXTRA_INCLUDES.  Report that to your httpd provider, or open a bug at
>>> https://issues.apache.org/bugzilla/ if you built it yourself.
>>
>> This only happens, if you build httpd with a preinstalled APR, but not with
>> the bundled APR
>>
> I'm confused...  What is the condition where EXTRA_INCLUDES doesn't
> find APR include files?  When the bundled APR is used with certain
> non-default layouts, or something else?

OK, just two tests (the thing the layouts is a "special" case).

1st test:
# ./configure --prefix=/var/tmp/httpd-2.2.14
# make && make install
# /var/tmp/httpd-2.2.14/bin/apxs -q INCLUDEDIR
/var/tmp/httpd-2.2.14/include
# /var/tmp/httpd-2.2.14/bin/apxs -q EXTRA_INCLUDES
-I/var/tmp/httpd-2.2.14/include
-I.
-I/root/httpd-2.2.14/srclib/apr/include
-I/root/httpd-2.2.14/srclib/apr-util/include
-I/usr/local/include
# /var/tmp/httpd-2.2.14/bin/apxs -q APR_INCLUDEDIR
/var/tmp/httpd-2.2.14/include

As you can see, the APR include dir is not part of EXTRA_INCLUDES. But is
defined in APR_INCLUDEDIR (and it's "by chance" the same thing as INCLUDEDIR
is). If you say:
>>> The APR include dir should appear within both APR_INCLUDEDIR and
>>> EXTRA_INCLUDES.
that's a bug.


2nd test:
# cd srclib/apr
# ./configure --prefix=/var/tmp/httpd-2.2.14
# make && make install
# cd ../apr-util
# ./configure --prefix=/var/tmp/httpd-2.2.14 \
              --with-apr=/var/tmp/httpd-2.2.14
# make && make install
# cd ../..
# ./configure --prefix=/var/tmp/httpd-2.2.14 \
              --with-apr=/var/tmp/httpd-2.2.14 \
              --with-apr-util=/var/tmp/httpd-2.2.14
# make && make install
# /var/tmp/httpd-2.2.14/bin/apxs -q INCLUDEDIR
/var/tmp/httpd-2.2.14/include
# /var/tmp/httpd-2.2.14/bin/apxs -q EXTRA_INCLUDES
-I/var/tmp/httpd-2.2.14/include
-I.
-I/var/tmp/httpd-2.2.14/include/apr-1
-I/usr/local/include
# /var/tmp/httpd-2.2.14/bin/apxs -q APR_INCLUDEDIR
/var/tmp/httpd-2.2.14/include/apr-1

As you can see, now APR_INCLUDEDIR is also part of EXTRA_INCLUDES.

So EXTRA_INCLUDES is just listing the includes which were used during the
build of httpd.

(BTW: APU_INCLUDEDIR can also be a different directory)


>> With the bundled APR, that's only working for (most) people, because
>> apr/apr-util doesn't (normally) respect it's own config.layout (if
>> --enable-layout is used), and so the httpd and APR headers are going to
>> the same directory, which is the directory defined in "includedir" in
>> condig_vars.mk.

OK, the special case. For a test, let us use the OpenBSD layout. As a
prerequisite, I have to change:
-    exec_prefix:   /usr
+    exec_prefix:   ${prefix}
in "config.layout", "srclib/apr/config.layout" and
"srclib/apr-util/config.layout" (my /usr is a read-only filesystem).

3rd test:
# ./configure --prefix=/var/tmp/httpd-2.2.14 \
              --enable-layout=OpenBSD
# make && make install

Ok, in "config.layout" I have:
| includedir:    ${exec_prefix}/lib/apache/include
fine, I can see the files.

Now I'm looking to "srclib/apr/config.layout" and I have:
| includedir:    ${exec_prefix}/lib/apr/include
But surprise... this directory (and others) doesn't exists, and the APR
headers are also in "${exec_prefix}/lib/apache/include".


That's one problem.
Well, easy to fix (Makefile.in patches). And with this "fix" the APR files
are going into the directories defined in "srclib/apr/config.layout" as
expected. But now you have the problem from the 1st test:
The httpd headers are in "${exec_prefix}/lib/apache/include", the APR
headers are in "${exec_prefix}/lib/apr/include", but this dir is not listed
in INCLUDEDIR or EXTRA_INCLUDES. Only in APR_INCLUDEDIR.

Regards,
Carsten


Re: [mod_fcgid] can't find apr headers

Posted by Jeff Trawick <tr...@gmail.com>.
On Thu, Dec 10, 2009 at 7:03 AM, Carsten Wiedmann <ca...@gmx.de> wrote:
> Jeff Trawick schrieb:
>>>> /usr/local/build/config_vars.mk includes /usr/local/include/apr-1 in
>>>> EXTRA_INCLUDES
>>>>   (if not, what is EXTRA_INCLUDES set to?)
>>> No, the apr include dir is not part of EXTRA_INCLUDES. The apr inlude dir is
>>> defined in APR_INCLUDEDIR.
>>
>> The APR include dir should appear within both APR_INCLUDEDIR and
>> EXTRA_INCLUDES.  Report that to your httpd provider, or open a bug at
>> https://issues.apache.org/bugzilla/ if you built it yourself.
>
> This only happens, if you build httpd with a preinstalled APR, but not with
> the bundled APR (With a preinstalled APR httpd is also using apr-1-config to
> get the values, like apxs -c). With the bundled APR the APR_INCLUDEDIR dir
> is not added to EXTRA_INCLUDES.
>
> With the bundled APR, that's only working for (most) people, because
> apr/apr-util doesn't (normally) respect it's own config.layout (if
> --enable-layout is used), and so the httpd and APR headers are going to the
> same directory, which is the directory defined in "includedir" in
> condig_vars.mk.

I'm confused...  What is the condition where EXTRA_INCLUDES doesn't
find APR include files?  When the bundled APR is used with certain
non-default layouts, or something else?

>>> And and least I have to set e.g.:
>>> | FcgidIPCDir /var/run/
>>> | FcgidProcessTableFile /var/run/fcgid_shm
>>> Or Apache can't start: No access/exists to the default values of these two
>>> directives.
>>
>> the enclosing directories exist but you can't write to it?
>
> Correct, and my example above is also wrong (sorry, a problem with my copy
> 'n paste). It must be e.g.:
> | FcgidIPCDir /var/run/fcgidsock

Is it true that ServerRoot wasn't writable in general?  What else had
to be changed?  ErrorLog, Pidfile, etc.?

>
> It's just that people must know, that
> a) FcgidProcessTableFile is created by the startup process (uid: root)
> b) the files in FcgidIPCDir are created by a worker process (e.g. uid: www)
>
> and for b) and if the configured FcgidIPCDir already exists, this user must
> have privs to create something in this directory.
> If only the last part of FcgidIPCDir does not exists, the startup process is
> creating this directory with the correct owner.
>
>
>>> Maybe e.g. TMPDIR should be used as default?
>>
>> The defaults are "logs/fcgidsock" and "logs/fcgid_shm" under
>> ServerRoot.  I think DEFAULT_REL_RUNTIMEDIR is a better choice than
>> hard-coded "logs", but that wouldn't help you since your ServerRoot
>> has no "logs" directory or you have no write access anyway.  I don't
>> think a system-wide directory is an appropriate default.  (mod_fcgid
>> currently creates lock files there :( ).
>
> TMPDIR is just an example, because:
> - there is always a way to get a valid TMPDIR path
> - on my system it has the sticky bit, so others can't e.g. delete my
> FcgidProcessTableFile
> - if we assume there is no fcgidsock subdir at this time, the startup
> process is creating this dir with exclusive privs for e.g. the www user.
>
> (- well, and a log dir is for logfiles and not for e.g. sockets ;-) )

Note that DEFAULT_REL_RUNTIMEDIR isn't necessarily "logs".  Some of
the entries in config.layout have a separate "run" directory under
ServerRoot; others use /var/run.  A packager should pick something
appropriate.

But yes with a default httpd build you may find various run-time files
or sockets in ServerRoot/logs, depending on exactly which modules are
in use.

Individual modules shouldn't be decide the appropriate place for
run-time files, even if they could determine that TMPDIR or some other
common system directory has no security implications.  I'll fix
mod_fcgid to respect DEFAULT_REL_RUNTIMEDIR.

Re: [mod_fcgid] can't find apr headers

Posted by Carsten Wiedmann <ca...@gmx.de>.
Jeff Trawick schrieb:
>>> /usr/local/build/config_vars.mk includes /usr/local/include/apr-1 in
>>> EXTRA_INCLUDES
>>>   (if not, what is EXTRA_INCLUDES set to?)
>> No, the apr include dir is not part of EXTRA_INCLUDES. The apr inlude dir is
>> defined in APR_INCLUDEDIR.
> 
> The APR include dir should appear within both APR_INCLUDEDIR and
> EXTRA_INCLUDES.  Report that to your httpd provider, or open a bug at
> https://issues.apache.org/bugzilla/ if you built it yourself.

This only happens, if you build httpd with a preinstalled APR, but not with
the bundled APR (With a preinstalled APR httpd is also using apr-1-config to
get the values, like apxs -c). With the bundled APR the APR_INCLUDEDIR dir
is not added to EXTRA_INCLUDES.

With the bundled APR, that's only working for (most) people, because
apr/apr-util doesn't (normally) respect it's own config.layout (if
--enable-layout is used), and so the httpd and APR headers are going to the
same directory, which is the directory defined in "includedir" in
condig_vars.mk.


>> And and least I have to set e.g.:
>> | FcgidIPCDir /var/run/
>> | FcgidProcessTableFile /var/run/fcgid_shm
>> Or Apache can't start: No access/exists to the default values of these two
>> directives.
> 
> the enclosing directories exist but you can't write to it?

Correct, and my example above is also wrong (sorry, a problem with my copy
'n paste). It must be e.g.:
| FcgidIPCDir /var/run/fcgidsock

It's just that people must know, that
a) FcgidProcessTableFile is created by the startup process (uid: root)
b) the files in FcgidIPCDir are created by a worker process (e.g. uid: www)

and for b) and if the configured FcgidIPCDir already exists, this user must
have privs to create something in this directory.
If only the last part of FcgidIPCDir does not exists, the startup process is
creating this directory with the correct owner.


>> Maybe e.g. TMPDIR should be used as default?
> 
> The defaults are "logs/fcgidsock" and "logs/fcgid_shm" under
> ServerRoot.  I think DEFAULT_REL_RUNTIMEDIR is a better choice than
> hard-coded "logs", but that wouldn't help you since your ServerRoot
> has no "logs" directory or you have no write access anyway.  I don't
> think a system-wide directory is an appropriate default.  (mod_fcgid
> currently creates lock files there :( ).

TMPDIR is just an example, because:
- there is always a way to get a valid TMPDIR path
- on my system it has the sticky bit, so others can't e.g. delete my
FcgidProcessTableFile
- if we assume there is no fcgidsock subdir at this time, the startup
process is creating this dir with exclusive privs for e.g. the www user.

(- well, and a log dir is for logfiles and not for e.g. sockets ;-) )


>> So for me there is only one problem left. php_apc does not work together
>> with mod_fcgid. And the question, who the guilty party is (mod_fcgid or
>> apc...). Only the first request for a file is working, a core dump at the
>> second, and so on.
> 
> As for the core dump, open a bug with the component that is
> segfaulting. (I'm guessing PHP or APC, which are developed at
> php.net.)
> 
> Somewhat separately, can APC work as desired with mod_fcgid barring
> any implementation bugs?  I don't know.  See the discussion in
> https://issues.apache.org/bugzilla/show_bug.cgi?id=48110

Hm, I guess it's a problem with APC. There are also bug reports in the APC
bug tracker regarding fast-cgi. Of course, eAccelerator is working with
fast-cgi. Well, I don't need this progressbar "feature" from APC, so
eAccelerator is also ok.


Regards,
Carsten


Re: [mod_fcgid] can't find apr headers

Posted by Jeff Trawick <tr...@gmail.com>.
On Wed, Dec 9, 2009 at 10:44 AM, Jeff Trawick <tr...@gmail.com> wrote:
> On Wed, Dec 9, 2009 at 9:02 AM, Carsten Wiedmann <ca...@gmx.de> wrote:

>>>> in config.apxs.log I have 2 errors for "conftest_sys_mutex.h.c".  Maybe
>>>> that's normal and can happen?
>>>
>>> That shouldn't affect a build for httpd 2.2, but what are those errors?
>>
>> | /usr/local/build-1/libtool --silent --mode=compile cc -I/usr/local/include
>>  -O2 -pipe -I/usr/include -fno-strict-aliasing
>> -I/usr/local/include/apache22 -I. -I/var/ports/usr/ports/www/apache22
>> | In file included from /usr/include/sys/mutex.h:37,
>> |                  from conftest_sys_mutex_h.c:1:
>> | /usr/include/sys/_lock.h:36: error: expected specifier-qualifier-list
>> before 'u_int'
>> | In file included from /usr/include/sys/mutex.h:38,
>> |                  from conftest_sys_mutex_h.c:1:
>> | /usr/include/sys/_mutex.h:39: error: expected ':', ',', ';', '}' or
>> '__attribute__' before 'mtx_lock'
>> | *** Error code 1
>
> Ahhh, I see these in my FreeBSD builds and will try to fix (maybe we
> have to include <sys/types.h> first).  This never hurt me since I
> didn't try to build for httpd 2.0 on FreeBSD.  Thanks!

No, not a problem...  FreeBSD ends up not including <sys/mutex.h>
since <sys/types.h> isn't included first, but <sys/mutex.h> is
probably only needed on some odd SysV-derived system.

The <sys/mutex.h> popped up in the APR code copied into mod_fcgid code
here: http://svn.apache.org/viewvc?view=revision&revision=64544
(no obvious sys/types.h there either)

Re: [mod_fcgid] can't find apr headers

Posted by Jeff Trawick <tr...@gmail.com>.
On Wed, Dec 9, 2009 at 9:02 AM, Carsten Wiedmann <ca...@gmx.de> wrote:
> Jeff Trawick schrieb:
>> Check for the following after configure.apxs finishes:
>>
>> fcgid-2.3.4/Makefile sets top_builddir to /usr/local
> I have:
> | top_builddir=/usr/local/share/apache22
>
> But I think that's ok, because "rules.mk", "config_vars.mk" ... are in:
> /usr/local/share/apache22/build
>
>
>> fcgid-2.3.4/Makefile includes /usr/local/build/rules.mk (from your
>> httpd install)
>
> I have:
> | include /usr/local/share/apache22/build/rules.mk
>
>
>> /usr/local/build/rules.mk includes $(top_builddir)/build/config_vars.mk
>
> I have:
> | include  $(top_builddir)/build/config_vars.mk
>
>
>> /usr/local/build/config_vars.mk includes /usr/local/include/apr-1 in
>> EXTRA_INCLUDES
>>   (if not, what is EXTRA_INCLUDES set to?)
>
> No, the apr include dir is not part of EXTRA_INCLUDES. The apr inlude dir is
> defined in APR_INCLUDEDIR.

The APR include dir should appear within both APR_INCLUDEDIR and
EXTRA_INCLUDES.  Report that to your httpd provider, or open a bug at
https://issues.apache.org/bugzilla/ if you built it yourself.

> BTW: A normal apxs run is using the script defined in APR_CONFIG
> (/usr/local/bin/apr-1-config) to get e.g. the apr include dir.
>
>
> OK, with using apxs I can build and install the module:
> # cd modules/fcgid
> # apxs -c mod_fcgid.c fcgid_bridge.c fcgid_conf.c fcgid_pm_main.c \
>        fcgid_protocol.c fcgid_spawn_ctl.c fcgid_proctbl_unix.c \
>        fcgid_pm_unix.c fcgid_proc_unix.c fcgid_bucket.c fcgid_filter.c
> # apxs -i -a mod_fcgid.la
>
> And and least I have to set e.g.:
> | FcgidIPCDir /var/run/
> | FcgidProcessTableFile /var/run/fcgid_shm
> Or Apache can't start: No access/exists to the default values of these two
> directives.

the enclosing directories exist but you can't write to it?

> Maybe e.g. TMPDIR should be used as default?

The defaults are "logs/fcgidsock" and "logs/fcgid_shm" under
ServerRoot.  I think DEFAULT_REL_RUNTIMEDIR is a better choice than
hard-coded "logs", but that wouldn't help you since your ServerRoot
has no "logs" directory or you have no write access anyway.  I don't
think a system-wide directory is an appropriate default.  (mod_fcgid
currently creates lock files there :( ).

We need a sample configuration file snippet with commented out
defaults for these two and an explanation of when to change the
settings.  (I just opened bug 48360 for that.)

> So for me there is only one problem left. php_apc does not work together
> with mod_fcgid. And the question, who the guilty party is (mod_fcgid or
> apc...). Only the first request for a file is working, a core dump at the
> second, and so on.

As for the core dump, open a bug with the component that is
segfaulting. (I'm guessing PHP or APC, which are developed at
php.net.)

Somewhat separately, can APC work as desired with mod_fcgid barring
any implementation bugs?  I don't know.  See the discussion in
https://issues.apache.org/bugzilla/show_bug.cgi?id=48110

>>> in config.apxs.log I have 2 errors for "conftest_sys_mutex.h.c".  Maybe
>>> that's normal and can happen?
>>
>> That shouldn't affect a build for httpd 2.2, but what are those errors?
>
> | /usr/local/build-1/libtool --silent --mode=compile cc -I/usr/local/include
>  -O2 -pipe -I/usr/include -fno-strict-aliasing
> -I/usr/local/include/apache22 -I. -I/var/ports/usr/ports/www/apache22
> | In file included from /usr/include/sys/mutex.h:37,
> |                  from conftest_sys_mutex_h.c:1:
> | /usr/include/sys/_lock.h:36: error: expected specifier-qualifier-list
> before 'u_int'
> | In file included from /usr/include/sys/mutex.h:38,
> |                  from conftest_sys_mutex_h.c:1:
> | /usr/include/sys/_mutex.h:39: error: expected ':', ',', ';', '}' or
> '__attribute__' before 'mtx_lock'
> | *** Error code 1

Ahhh, I see these in my FreeBSD builds and will try to fix (maybe we
have to include <sys/types.h> first).  This never hurt me since I
didn't try to build for httpd 2.0 on FreeBSD.  Thanks!

Re: [mod_fcgid] can't find apr headers

Posted by Carsten Wiedmann <ca...@gmx.de>.
Jeff Trawick schrieb:
> Check for the following after configure.apxs finishes:
> 
> fcgid-2.3.4/Makefile sets top_builddir to /usr/local
I have:
| top_builddir=/usr/local/share/apache22

But I think that's ok, because "rules.mk", "config_vars.mk" ... are in:
/usr/local/share/apache22/build


> fcgid-2.3.4/Makefile includes /usr/local/build/rules.mk (from your
> httpd install)

I have:
| include /usr/local/share/apache22/build/rules.mk


> /usr/local/build/rules.mk includes $(top_builddir)/build/config_vars.mk

I have:
| include  $(top_builddir)/build/config_vars.mk


> /usr/local/build/config_vars.mk includes /usr/local/include/apr-1 in
> EXTRA_INCLUDES
>   (if not, what is EXTRA_INCLUDES set to?)

No, the apr include dir is not part of EXTRA_INCLUDES. The apr inlude dir is
defined in APR_INCLUDEDIR.

BTW: A normal apxs run is using the script defined in APR_CONFIG
(/usr/local/bin/apr-1-config) to get e.g. the apr include dir.


OK, with using apxs I can build and install the module:
# cd modules/fcgid
# apxs -c mod_fcgid.c fcgid_bridge.c fcgid_conf.c fcgid_pm_main.c \
        fcgid_protocol.c fcgid_spawn_ctl.c fcgid_proctbl_unix.c \
        fcgid_pm_unix.c fcgid_proc_unix.c fcgid_bucket.c fcgid_filter.c
# apxs -i -a mod_fcgid.la

And and least I have to set e.g.:
| FcgidIPCDir /var/run/
| FcgidProcessTableFile /var/run/fcgid_shm
Or Apache can't start: No access/exists to the default values of these two
directives. Maybe e.g. TMPDIR should be used as default?


So for me there is only one problem left. php_apc does not work together
with mod_fcgid. And the question, who the guilty party is (mod_fcgid or
apc...). Only the first request for a file is working, a core dump at the
second, and so on.


>> in config.apxs.log I have 2 errors for "conftest_sys_mutex.h.c".  Maybe
>> that's normal and can happen?
> 
> That shouldn't affect a build for httpd 2.2, but what are those errors?

| /usr/local/build-1/libtool --silent --mode=compile cc -I/usr/local/include
 -O2 -pipe -I/usr/include -fno-strict-aliasing
-I/usr/local/include/apache22 -I. -I/var/ports/usr/ports/www/apache22
| In file included from /usr/include/sys/mutex.h:37,
|                  from conftest_sys_mutex_h.c:1:
| /usr/include/sys/_lock.h:36: error: expected specifier-qualifier-list
before 'u_int'
| In file included from /usr/include/sys/mutex.h:38,
|                  from conftest_sys_mutex_h.c:1:
| /usr/include/sys/_mutex.h:39: error: expected ':', ',', ';', '}' or
'__attribute__' before 'mtx_lock'
| *** Error code 1
|
| Stop in /root/mod_fcgid-2.3.4/build.


Hope that helps.

Regards,
Carsten


Re: [mod_fcgid] can't find apr headers

Posted by Jeff Trawick <tr...@gmail.com>.
On Wed, Dec 9, 2009 at 4:14 AM, Carsten Wiedmann <ca...@gmx.de> wrote:
> Hello,
>
> I'm trying to build mod_fcgid-2.3.4 (at the moment I'm using the (old)
> mod_fcgid-2.2).
>
> But it can only find the httpd includes, and not the apr includes. And this
> confirms the "make" output. I only see a:
> | -I/usr/local/include/apache22
> but not a:
> | -I/usr/local/include/apr-1
>
> If I build other modules with the normal/usual:
> | apxs -c mod_foo.c
> there is no such problem.

Check for the following after configure.apxs finishes:

fcgid-2.3.4/Makefile sets top_builddir to /usr/local
fcgid-2.3.4/Makefile includes /usr/local/build/rules.mk (from your
httpd install)
/usr/local/build/rules.mk includes $(top_builddir)/build/config_vars.mk
/usr/local/build/config_vars.mk includes /usr/local/include/apr-1 in
EXTRA_INCLUDES
  (if not, what is EXTRA_INCLUDES set to?)

> It also seems there is no option for configure.apxs to define additional
> include dirs?

correct

> BTW:
> in config.apxs.log I have 2 errors for "conftest_sys_mutex.h.c".  Maybe
> that's normal and can happen?

That shouldn't affect a build for httpd 2.2, but what are those errors?