httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject How to compiling/link/use Apache module that uses shared library?
Date Thu, 21 Jun 2012 17:47:32 GMT

I am (still) working on a module that uses another commercial shared object library (.so).
 I use the following to successfully build the module (currently, just tweaking mod_headers.c
for testing):

/apps/httpd2222/bin/apxs -L /apps/netpoint/AccessServerSDK/oblix/lib/ -c -i -a mod_headers.c

The compile/link appears to work ok:

[root@apachemodule build-mod_headers]# ./
/apps/httpd2222/build/libtool --silent --mode=compile gcc -prefer-pic   -DLINUX=2 -D_REENTRANT
-D_GNU_SOURCE -g -O2 -pthread -I/a                                       pps/httpd2222/include
 -I/apps/httpd2222/include   -I/apps/httpd2222/include   -c -o mod_headers.lo mod_headers.c
&& touch mod_he                                       aders.slo
/apps/httpd2222/build/libtool --silent --mode=link gcc -o  -L/apps/netpoint/AccessServerSDK/oblix/lib/
-rpath /app                                       s/httpd2222/modules -module -avoid-version
/apps/httpd2222/build/ SH_LIBTOOL='/apps/httpd2222/build/libtool'
/apps/httpd2222/build/libtool --mode=install cp /apps/httpd2222/modules/
cp .libs/ /apps/httpd2222/modules/
cp .libs/mod_headers.lai /apps/httpd2222/modules/
cp .libs/mod_headers.a /apps/httpd2222/modules/mod_headers.a
chmod 644 /apps/httpd2222/modules/mod_headers.a
ranlib /apps/httpd2222/modules/mod_headers.a
PATH="$PATH:/sbin" ldconfig -n /apps/httpd2222/modules
Libraries have been installed in:

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
   - have your system administrator add LIBDIR to `/etc/'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and manual pages.
chmod 755 /apps/httpd2222/modules/
[activating module `headers' in /apps/httpd2222/conf/httpd.conf]

However, when I try to start Apache, I get an error:

[root@apachemodule build-mod_headers]# /apps/httpd2222/bin/apachectl -k start -X
httpd: Syntax error on line 82 of /apps/httpd2222/conf/httpd.conf: Cannot load /apps/httpd2222/modules/
into server: /apps/httpd2222/modules/ undefined symbol: ObResource_isProtected
[root@apachemodule build-mod_headers]#

I have LD_LIBRARY_PATH set to the path where the shared library is (same as the -L parameter

When I run ldd on the .so, I get:

[root@apachemodule build-mod_headers]# ldd -v /apps/httpd2222/modules/ => /lib64/tls/ (0x0000002a95673000)
        /lib64/ (0x000000552aaaa000)

        Version information:
       (GLIBC_2.3) => /lib64/tls/
       (GLIBC_2.2.5) => /lib64/tls/
       (GLIBC_2.2.5) => /lib64/
       (GLIBC_2.3) => /lib64/
       (GLIBC_PRIVATE) => /lib64/

Shouldn't my shared library, appear in the ldd output?

I've tried using "-l" pointing directly to the .so,, but when I do that, it
says it can't find the .so:

[root@apachemodule build-mod_headers]# ./
/apps/httpd2222/build/libtool --silent --mode=compile gcc -prefer-pic   -DLINUX=2 -D_REENTRANT
-D_GNU_SOURCE -g -O2 -pthread -I/apps/httpd2222/include  -I/apps/httpd2222/include   -I/apps/httpd2222/include
  -c -o mod_headers.lo mod_headers.c && touch mod_headers.slo
/apps/httpd2222/build/libtool --silent --mode=link gcc -o  -l/apps/netpoint/AccessServerSDK/oblix/lib/
-rpath /apps/httpd2222/modules -module -avoid-version    mod_headers.lo
/usr/bin/ld: cannot find -l/apps/netpoint/AccessServerSDK/oblix/lib/
collect2: ld returned 1 exit status
apxs:Error: Command failed with rc=65536

At this point, I don't quite understand why Apache is failing to start...

Can anyone help?


View raw message