如何使用 libtool 链接静态库 (.a)
?
我正在创建一个 apache 模块 (mod_shib_22.so
),它使用三个 RSA 库 libcertc.a
、libcertcsp.a
和 libbsafe.a
我正在将这些库与 -lcertc -lcertcsp -lbafe
链接,但是在加载模块时出现“符号未定义”错误:
./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
我在 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
最佳答案
将 DSO(在本例中为 Apache 模块)与静态库链接不能保证有效,并且可能无法正常工作,具体取决于静态库中对象的构建方式。通常静态库中的对象不是用 position independent code 构建的已启用,但 DSO 需要位置独立代码。
关于c++ - 使用 libtool 链接静态库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14504417/