Hi,
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]# ./compile-mod-headers.sh
/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 mod_headers.la
-L/apps/netpoint/AccessServerSDK/oblix/lib/ -rpath /app
s/httpd2222/modules -module -avoid-version mod_headers.lo
/apps/httpd2222/build/instdso.sh SH_LIBTOOL='/apps/httpd2222/build/libtool'
mod_headers.la /apps/httpd2222/modules
/apps/httpd2222/build/libtool --mode=install cp mod_headers.la
/apps/httpd2222/modules/
cp .libs/mod_headers.so /apps/httpd2222/modules/mod_headers.so
cp .libs/mod_headers.lai /apps/httpd2222/modules/mod_headers.la
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:
/apps/httpd2222/modules
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/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
chmod 755 /apps/httpd2222/modules/mod_headers.so
[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/mod_headers.so into server:
/apps/httpd2222/modules/mod_headers.so: 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 above).
When I run ldd on the .so, I get:
[root@apachemodule build-mod_headers]# ldd -v
/apps/httpd2222/modules/mod_headers.so
libc.so.6 => /lib64/tls/libc.so.6 (0x0000002a95673000)
/lib64/ld-linux-x86-64.so.2 (0x000000552aaaa000)
Version information:
/apps/httpd2222/modules/mod_headers.so:
libc.so.6 (GLIBC_2.3) => /lib64/tls/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /lib64/tls/libc.so.6
/lib64/tls/libc.so.6:
ld-linux-x86-64.so.2 (GLIBC_2.2.5) =>
/lib64/ld-linux-x86-64.so.2
ld-linux-x86-64.so.2 (GLIBC_2.3) => /lib64/ld-linux-x86-64.so.2
ld-linux-x86-64.so.2 (GLIBC_PRIVATE) =>
/lib64/ld-linux-x86-64.so.2
Shouldn't my shared library, libobaccess.so appear in the ldd output?
I've tried using "-l" pointing directly to the .so, libobaccess.so, but when I
do that, it says it can't find the .so:
[root@apachemodule build-mod_headers]# ./compile-mod-headers.sh
/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 mod_headers.la
-l/apps/netpoint/AccessServerSDK/oblix/lib/libobaccess.so -rpath
/apps/httpd2222/modules -module -avoid-version mod_headers.lo
/usr/bin/ld: cannot find
-l/apps/netpoint/AccessServerSDK/oblix/lib/libobaccess.so
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?
Thanks,
Jim