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/15 15:51:39 UTC

Debian 4 issue

I've set up a Debian 4 machine and I'm trying to compile/install a 
small test module. I'm using APXS2 as follows:

apxs2 -ic -S CC=g++ -n mod_fancy mod_fancy.cpp config.cpp

It compiles, and installs the mod_fancy.so file in /usr/lib/apache2/modules.

But, when I try to get apache to load it, I get an error when apache starts:
apache2: Syntax error on line 185 of /etc/apache2/apache2.conf: Syntax error
   on line 1 of /etc/apache2/mods-enabled/mod_fancy.load: Can't locate API
   module structure `fancy_module' in file
   /usr/lib/apache2/modules/mod_fancy.so:
   /usr/lib/apache2/modules/mod_fancy.so: undefined symbol: fancy_module

Using nm on the .so file, I get the following:
000015e8 A __bss_start
000003b0 t call_gmon_start
000015e8 b completed.5621
000014e8 d __CTOR_END__
000014e4 d __CTOR_LIST__
          w __cxa_finalize@@GLIBC_2.1.3
00000480 t __do_global_ctors_aux
000003e0 t __do_global_dtors_aux
000015e0 d __dso_handle
000014f0 d __DTOR_END__
000014ec d __DTOR_LIST__
000014f8 a _DYNAMIC
000015e8 A _edata
000015ec A _end
000004c4 T _fini
00000440 t frame_dummy
000004e0 r __FRAME_END__
000015cc a _GLOBAL_OFFSET_TABLE_
          w __gmon_start__
00000475 t __i686.get_pc_thunk.bx
00000360 T _init
000014f4 d __JCR_END__
000014f4 d __JCR_LIST__
          w _Jv_RegisterClasses
000015e4 d p.5619

Anyone have any ideas why the symbol isn't being exported? I'm using 
gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21).

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: Debian 4 issue

Posted by Mike <dy...@gmail.com>.
On Sun, Jul 15, 2007 at 05:10:46PM +0200, Ralf Mattes wrote:
> You need to declare the following as "C":
He doesn't. It won't change anything.

Re: Debian 4 issue

Posted by Farokh Irani <fa...@mcfsoftware.com>.
>On Sun, 2007-07-15 at 10:44 -0400, Farokh Irani wrote:
>>  >No - you are not! You are using g++-4... which is a C++ compiler. Are
>>  >you aware of C++ name mangling? Did you declare your exported symbols
>>  >'extern C'?
>>
>>  Um, yes, already done.
>>
>>  extern "C" module AP_MODULE_DECLARE_DATA fancy_module;
>>
>>  It's the first line after the includes.
>>
>>  Near the end of the file:
>
>You need to declare the following as "C":
>
>extern "C" {
>>  module AP_MODULE_DECLARE_DATA fancy_module = {
>>	STANDARD20_MODULE_STUFF,
>>	create_dir_mconfig,    /* create per-dir config structures    */
>>	merge_dir_mconfig,     /* merge  per-dir config structures    */
>>	NULL,                  /* create per-server config structures */
>>	NULL,                  /* merge  per-server config structures */
>>	fancy_cmds,            /* table of config file commands       */
>>	fancy_register_hooks   /* register hooks                      */
>>  };
>}
>
>HTH RalfD

I tried that, and as far as I can tell, it makes no difference. nm 
still shows the same list of symbols.
-- 

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: Debian 4 issue

Posted by Ralf Mattes <rm...@seid-online.de>.
On Sun, 2007-07-15 at 10:44 -0400, Farokh Irani wrote:
> >No - you are not! You are using g++-4... which is a C++ compiler. Are
> >you aware of C++ name mangling? Did you declare your exported symbols
> >'extern C'?
> 
> Um, yes, already done.
> 
> extern "C" module AP_MODULE_DECLARE_DATA fancy_module;
> 
> It's the first line after the includes.
> 
> Near the end of the file:

You need to declare the following as "C":

extern "C" {
> module AP_MODULE_DECLARE_DATA fancy_module = {
> 	STANDARD20_MODULE_STUFF,
> 	create_dir_mconfig,    /* create per-dir config structures    */
> 	merge_dir_mconfig,     /* merge  per-dir config structures    */
> 	NULL,                  /* create per-server config structures */
> 	NULL,                  /* merge  per-server config structures */
> 	fancy_cmds,            /* table of config file commands       */
> 	fancy_register_hooks   /* register hooks                      */
> };
}

HTH RalfD


Re: Debian 4 issue

Posted by Farokh Irani <fa...@mcfsoftware.com>.
>No - you are not! You are using g++-4... which is a C++ compiler. Are
>you aware of C++ name mangling? Did you declare your exported symbols
>'extern C'?

Um, yes, already done.

extern "C" module AP_MODULE_DECLARE_DATA fancy_module;

It's the first line after the includes.

Near the end of the file:

module AP_MODULE_DECLARE_DATA fancy_module = {
	STANDARD20_MODULE_STUFF,
	create_dir_mconfig,    /* create per-dir config structures    */
	merge_dir_mconfig,     /* merge  per-dir config structures    */
	NULL,                  /* create per-server config structures */
	NULL,                  /* merge  per-server config structures */
	fancy_cmds,            /* table of config file commands       */
	fancy_register_hooks   /* register hooks                      */
};

-- 

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: Debian 4 issue

Posted by Ralf Mattes <rm...@seid-online.de>.
On Sun, 2007-07-15 at 09:51 -0400, Farokh Irani wrote:
> I've set up a Debian 4 machine and I'm trying to compile/install a 
> small test module. I'm using APXS2 as follows:
> 
> apxs2 -ic -S CC=g++ -n mod_fancy mod_fancy.cpp config.cpp
> 
> It compiles, and installs the mod_fancy.so file in /usr/lib/apache2/modules.
> 
> But, when I try to get apache to load it, I get an error when apache starts:
> apache2: Syntax error on line 185 of /etc/apache2/apache2.conf: Syntax error
>    on line 1 of /etc/apache2/mods-enabled/mod_fancy.load: Can't locate API
>    module structure `fancy_module' in file
>    /usr/lib/apache2/modules/mod_fancy.so:
>    /usr/lib/apache2/modules/mod_fancy.so: undefined symbol: fancy_module
> 
> Using nm on the .so file, I get the following:
> 000015e8 A __bss_start
> 000003b0 t call_gmon_start
> 000015e8 b completed.5621
> 000014e8 d __CTOR_END__
> 000014e4 d __CTOR_LIST__
>           w __cxa_finalize@@GLIBC_2.1.3
> 00000480 t __do_global_ctors_aux
> 000003e0 t __do_global_dtors_aux
> 000015e0 d __dso_handle
> 000014f0 d __DTOR_END__
> 000014ec d __DTOR_LIST__
> 000014f8 a _DYNAMIC
> 000015e8 A _edata
> 000015ec A _end
> 000004c4 T _fini
> 00000440 t frame_dummy
> 000004e0 r __FRAME_END__
> 000015cc a _GLOBAL_OFFSET_TABLE_
>           w __gmon_start__
> 00000475 t __i686.get_pc_thunk.bx
> 00000360 T _init
> 000014f4 d __JCR_END__
> 000014f4 d __JCR_LIST__
>           w _Jv_RegisterClasses
> 000015e4 d p.5619
> 
> Anyone have any ideas why the symbol isn't being exported? I'm using 
> gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21).

No - you are not! You are using g++-4... which is a C++ compiler. Are
you aware of C++ name mangling? Did you declare your exported symbols
'extern C'?

 Cheers, Ralf Mattes

> Thanks.