Reputation: 21
How to link a static library (.a)
with libtool?
I am creating a apache module (mod_shib_22.so
) which is using three RSA library libcertc.a
, libcertcsp.a
and libbsafe.a
I am linking these libraries with -lcertc -lcertcsp -lbafe
but while loading the module I am getting "symbol undefined" errors:
./apachectl -k stop httpd: Syntax error on line 426 of /usr/local/apache2/conf/httpd.conf:
Cannot load /usr/local/lib64/shibboleth/mod_shib_22.so into server: /usr/local/lib64/shibboleth/mod_shib_22.so: undefined symbol: T_GetDynamicList
I am using these lines in Makefile:
LDFLAGS = -L../../libraries/Crypto-C-6.4.0.3/lib/linux_lsb30_x86_64 -L../../libraries/Cert-C-2.9.0.0/lib/LinuxLSB30_x86_64/release_mt
LIBOBJS =
LIBS = -lxerces-c -L/usr/local/lib64 -llog4shib -lnsl -lcertc -lcertcsp -lbsafe -ldl
Upvotes: 1
Views: 945
Reputation: 16305
Linking a DSO (an Apache module in this case) with a static library isn't guaranteed to work, and probably won't work depending on how the objects in the static library are built. Usually objects in static libraries are not built with position independent code enabled, but DSOs require position independent code.
Upvotes: 1