You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by Farokh Irani <fa...@mcfsoftware.com> on 2007/07/18 13:23:24 UTC

APXS issue.

Our intrepid hero, having found problems using APXS2 under Debian 4 
(the whole issue of the symbol not being exported), went through the 
effort of install yet another linux variant, this time FreeBSD, and 
when complied using APXS yet again, the symbol is still not exported. 
Note the following:

devlinux# nm /usr/local/libexec/apache22/mod_fancy.so
00001674 A _DYNAMIC
00001740 A _GLOBAL_OFFSET_TABLE_
          w _Jv_RegisterClasses
00001730 d __CTOR_END__
0000172c d __CTOR_LIST__
00001738 d __DTOR_END__
00001734 d __DTOR_LIST__
00001670 r __EH_FRAME_BEGIN__
00001670 r __FRAME_END__
0000173c d __JCR_END__
0000173c d __JCR_LIST__
0000176c A __bss_start
          w __cxa_finalize
          w __deregister_frame_info
00000598 t __do_global_ctors_aux
000004bc t __do_global_dtors_aux
00001668 d __dso_handle
          w __register_frame_info
0000176c A _edata
00001788 A _end
000005c8 T _fini
00000458 T _init
0000176c b completed.1
00000534 t frame_dummy
00001770 b object.2
0000166c d p.0

The symbol is still missing. This is with gcc version 3.4.6 [FreeBSD]
20060305.

I used the same command apxs -ic -S CC=g++ -n mod_fancy mod_fancy.cpp 
config.cpp
(note that this is what had been suggest on this list a while back). 
Here is what happened when I ran apxs:

devlinux# apxs -ic -S CC=g++ -n mod_fancy mod_fancy.cpp config.cpp
/usr/local/build-1/libtool --silent --mode=link g++ -o mod_fancy.la 
-rpath /usr/local/libexec/apache22 -module -avoid-version 
mod_fancy.cpp config.cpp
/usr/local/share/apache22/build/instdso.sh 
SH_LIBTOOL='/usr/local/build-1/libtool' mod_fancy.la 
/usr/local/libexec/apache22
/usr/local/build-1/libtool --mode=install cp mod_fancy.la 
/usr/local/libexec/apache22/
cp .libs/mod_fancy.so /usr/local/libexec/apache22/mod_fancy.so
cp .libs/mod_fancy.lai /usr/local/libexec/apache22/mod_fancy.la
cp .libs/mod_fancy.a /usr/local/libexec/apache22/mod_fancy.a
chmod 644 /usr/local/libexec/apache22/mod_fancy.a
ranlib /usr/local/libexec/apache22/mod_fancy.a
----------------------------------------------------------------------
Libraries have been installed in:
    /usr/local/libexec/apache22

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
    - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
      during execution
    - add LIBDIR to the `LD_RUN_PATH' environment variable
      during linking
    - use the `-Wl,--rpath -Wl,LIBDIR' linker flag

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
chmod 755 /usr/local/libexec/apache22/mod_fancy.so


Does anyone have any ideas as to why using apxs would cause the 
symbol not to be exported?

I'd be willing to show the code, it's not very complex, to anyone who 
might be able to help.

Thanks.
-- 

Farokh
----------------------------------------------------------------------------
MCF Software...simply dependably engineered
Developers of ListSTAR http://www.liststar.com/, MacRADIUS
http://www.macradius.com/, Address List Sorter
http://www.mcfsoftware.com/als/, SimpleText Filter for EIMS
http://www.mcfsoftware.com/stf/ and Auto Reply plug-in for EIMS 
http://www.mcfsoftware.com/ar/.

Re: APXS issue.

Posted by Farokh Irani <fa...@mcfsoftware.com>.
>On Wed, 2007-07-18 at 07:23 -0400, Farokh Irani wrote:
>
>>  I used the same command apxs -ic -S CC=g++ -n mod_fancy mod_fancy.cpp
>>  config.cpp
>>  (note that this is what had been suggest on this list a while back).
>>  Here is what happened when I ran apxs:
>>
>>  devlinux# apxs -ic -S CC=g++ -n mod_fancy mod_fancy.cpp config.cpp
>>  /usr/local/build-1/libtool --silent --mode=link g++ -o mod_fancy.la
>>  -rpath /usr/local/libexec/apache22 -module -avoid-version
>>  mod_fancy.cpp config.cpp
>
>Oh - that's strange: it seems like your apxs-invocation skipped the
>actual compilation step (the first line should start like
>"/usr/local/build-1/libtool --silent --mode=compile .....").
>Is it possible that your object code files  are newer than the source
>files? Have a look into the '.libs' directory). Maybe you should clean
>out your build environment and delete all object files ....

I don't see how, since just before I ran apxs, I used ftp to copy the 
files over (there are only 4 files). I deleted everything from .libs 
and tried it again, but got the same results including the missing 
symbol.
-- 

Farokh
----------------------------------------------------------------------------
MCF Software...simply dependably engineered
Developers of ListSTAR http://www.liststar.com/, MacRADIUS
http://www.macradius.com/, Address List Sorter
http://www.mcfsoftware.com/als/, SimpleText Filter for EIMS
http://www.mcfsoftware.com/stf/ and Auto Reply plug-in for EIMS 
http://www.mcfsoftware.com/ar/.

Re: APXS issue.

Posted by Ralf Mattes <rm...@seid-online.de>.
On Wed, 2007-07-18 at 07:23 -0400, Farokh Irani wrote:

> I used the same command apxs -ic -S CC=g++ -n mod_fancy mod_fancy.cpp 
> config.cpp
> (note that this is what had been suggest on this list a while back). 
> Here is what happened when I ran apxs:
> 
> devlinux# apxs -ic -S CC=g++ -n mod_fancy mod_fancy.cpp config.cpp
> /usr/local/build-1/libtool --silent --mode=link g++ -o mod_fancy.la 
> -rpath /usr/local/libexec/apache22 -module -avoid-version 
> mod_fancy.cpp config.cpp

Oh - that's strange: it seems like your apxs-invocation skipped the
actual compilation step (the first line should start like
"/usr/local/build-1/libtool --silent --mode=compile .....").
Is it possible that your object code files  are newer than the source
files? Have a look into the '.libs' directory). Maybe you should clean
out your build environment and delete all object files ....

HTH RalfD


Re: APXS issue.

Posted by Ralf Mattes <rm...@seid-online.de>.
On Sat, 2007-07-21 at 18:32 -0500, William A. Rowe, Jr. wrote:
> Farokh Irani wrote:
> >> On Wed, 2007-07-18 at 07:23 -0400, Farokh Irani wrote:
> >>
> >>>  See any operating system documentation about shared libraries for
> >>>  more information, such as the ld(1) and ld.so(8) manual pages.
> >>>  ----------------------------------------------------------------------
> >>>  chmod 755 /usr/local/libexec/apache22/mod_fancy.so
> >>
> >>  Not neccessary - shared libs don't need to be executable.
> 
> Slightly myopic perspective, obviously a linux-user comment ;-)
>
> Several linux derivatives require all loadable modules to be executable
> to be loaded as code pages.  Sensible thing, eh ;-?  Examples include AIX,
> HPUX etc.

No - not a Linux-only user (AIX and SunOS/Solaris as well, but I have to
admit that I've moved pretty much all of my day work to Linux/BSDs ...).
But I still consider this a rather strange thing to do on Linux and
BSD ... it'll surely trigger some security scanners ....

> > This is also something that is in the apxs code around line 488. Of
> > course, the apxs2 on my debian machine does chmod 644.
> 
> Well, there's no harm (no benefit I can identify, either) if a vendor on
> linux makes this tweak.
> 
> None of this has anything to do with the missing symbol, I expect.  Which
> symbol is missing, is this your fancy_module data symbol?


No - noone ever claimed. I guess you didn't bother reading the rest of
the thread, did you? To bussy sweating over the AIX administration :-)

> You probably didn't ensure that the apache2 module structure to be declared
> in a C namespace as an export.  My mod_aspdotnet is one such example,
 
He (they?) did.

> http://mod-aspdotnet.svn.sourceforge.net/viewvc/mod-aspdotnet/mod_aspdotnet/trunk/mod/mod_aspdotnet.cpp?revision=175&view=markup
> Althought this c++ module for MS compilation has a bunch of .NET'isms, this
> particular fragment shouldn't change;
> 
> 
> extern "C" {
>     extern module AP_MODULE_DECLARE_DATA aspdotnet_module;
> }
> 
> module AP_MODULE_DECLARE_DATA ::aspdotnet_module =
> {
>     STANDARD20_MODULE_STUFF,
>     create_asp_net_dirconf,     /* dir config */
>     merge_asp_net_dirconf,      /* merge dir config */
>     create_asp_net_srvconf,     /* server config */
>     merge_asp_net_srvconf,      /* merge server config */
>     asp_net_cmds,               /* command apr_table_t */
>     register_hooks              /* register hooks */
> };

It's definitely a bug (one of many if i might say so as an almost
exclusive Linux user) in APXS. Files with non-'*.c' extensions aren't
considered source files and libool gets invoked in link mode only.

 THT Ralf Mattes

> 
> Bill


Re: APXS issue.

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Mike wrote:
> On Sat, Jul 21, 2007 at 06:32:09PM -0500, William A. Rowe, Jr. wrote:
>> You probably didn't ensure that the apache2 module structure to be declared
>> in a C namespace as an export.  My mod_aspdotnet is one such example,
> He did. It's already declared as extern "C".

Great!  Wanted to be sure we weren't overlooking the obvious.

Bill

Re: APXS issue.

Posted by Mike <dy...@gmail.com>.
On Sat, Jul 21, 2007 at 06:32:09PM -0500, William A. Rowe, Jr. wrote:
> You probably didn't ensure that the apache2 module structure to be declared
> in a C namespace as an export.  My mod_aspdotnet is one such example,
He did. It's already declared as extern "C".
Kind regards.

Re: APXS issue.

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Farokh Irani wrote:
>> On Wed, 2007-07-18 at 07:23 -0400, Farokh Irani wrote:
>>
>>>  See any operating system documentation about shared libraries for
>>>  more information, such as the ld(1) and ld.so(8) manual pages.
>>>  ----------------------------------------------------------------------
>>>  chmod 755 /usr/local/libexec/apache22/mod_fancy.so
>>
>>  Not neccessary - shared libs don't need to be executable.

Slightly myopic perspective, obviously a linux-user comment ;-)

Several linux derivatives require all loadable modules to be executable
to be loaded as code pages.  Sensible thing, eh ;-?  Examples include AIX,
HPUX etc.

> This is also something that is in the apxs code around line 488. Of
> course, the apxs2 on my debian machine does chmod 644.

Well, there's no harm (no benefit I can identify, either) if a vendor on
linux makes this tweak.

None of this has anything to do with the missing symbol, I expect.  Which
symbol is missing, is this your fancy_module data symbol?

You probably didn't ensure that the apache2 module structure to be declared
in a C namespace as an export.  My mod_aspdotnet is one such example,

http://mod-aspdotnet.svn.sourceforge.net/viewvc/mod-aspdotnet/mod_aspdotnet/trunk/mod/mod_aspdotnet.cpp?revision=175&view=markup
Althought this c++ module for MS compilation has a bunch of .NET'isms, this
particular fragment shouldn't change;


extern "C" {
    extern module AP_MODULE_DECLARE_DATA aspdotnet_module;
}

module AP_MODULE_DECLARE_DATA ::aspdotnet_module =
{
    STANDARD20_MODULE_STUFF,
    create_asp_net_dirconf,     /* dir config */
    merge_asp_net_dirconf,      /* merge dir config */
    create_asp_net_srvconf,     /* server config */
    merge_asp_net_srvconf,      /* merge server config */
    asp_net_cmds,               /* command apr_table_t */
    register_hooks              /* register hooks */
};


Bill

Re: APXS issue.

Posted by Farokh Irani <fa...@mcfsoftware.com>.
>On Wed, 2007-07-18 at 07:23 -0400, Farokh Irani wrote:
>
>
>
>>  See any operating system documentation about shared libraries for
>>  more information, such as the ld(1) and ld.so(8) manual pages.
>>  ----------------------------------------------------------------------
>>  chmod 755 /usr/local/libexec/apache22/mod_fancy.so
>
>  Not neccessary - shared libs don't need to be executable.

This is also something that is in the apxs code around line 488. Of 
course, the apxs2 on my debian machine does chmod 644.
-- 

Farokh
----------------------------------------------------------------------------
MCF Software...simply dependably engineered
Developers of ListSTAR http://www.liststar.com/, MacRADIUS
http://www.macradius.com/, Address List Sorter
http://www.mcfsoftware.com/als/, SimpleText Filter for EIMS
http://www.mcfsoftware.com/stf/ and Auto Reply plug-in for EIMS 
http://www.mcfsoftware.com/ar/.

Re: APXS issue.

Posted by Ralf Mattes <rm...@seid-online.de>.
On Wed, 2007-07-18 at 07:23 -0400, Farokh Irani wrote:



> See any operating system documentation about shared libraries for
> more information, such as the ld(1) and ld.so(8) manual pages.
> ----------------------------------------------------------------------
> chmod 755 /usr/local/libexec/apache22/mod_fancy.so

 Not neccessary - shared libs don't need to be executable.

> 
> Does anyone have any ideas as to why using apxs would cause the 
> symbol not to be exported?
> 
> I'd be willing to show the code, it's not very complex, to anyone who 
> might be able to help.

Qk, fine - tar it up and mail it to me. I might have some time later
today and could try to build your code. BTW, please enclose all
Makefile/build magic scripts as well.

 Cheers, RalfD

>  Thanks.


Re: APXS issue.

Posted by Ralf Mattes <rm...@seid-online.de>.
On Wed, 2007-07-18 at 07:23 -0400, Farokh Irani wrote:
> Our intrepid hero, 
[...]
> went through the 
> effort of install yet another linux variant, this time FreeBSD, 

Most likely there's a secret army of ninja demons heading towards your
place right now-FreeBSD is _not_ a linux varinat! ;-)

Cheers, Ralf Mattes