【问题标题】:linking static libraries with libtool使用 libtool 链接静态库
【发布时间】:2013-01-24 15:05:10
【问题描述】:

如何将静态库(.a) 与 libtool 链接?

我正在创建一个 apache 模块 (mod_shib_22.so),它使用三个 RSA 库 libcertc.alibcertcsp.alibbsafe.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

【问题讨论】:

标签: c++ linux static-libraries libtool


【解决方案1】:

无法保证将 DSO(在本例中为 Apache 模块)与静态库链接有效,并且可能不会有效,具体取决于静态库中对象的构建方式。通常静态库中的对象不是在启用position independent code 的情况下构建的,而是 DSO 需要位置独立代码。

【讨论】:

  • 我有其他 apache 模块使用相同的静态库正确链接,但没有使用 libtool。 libtool 有什么不同吗?
  • 链接mod_shib_22.so时需要发布libtool的输出。
  • ./apachectl -k stop httpd:/usr/local/apache2/conf/httpd.conf 的第 426 行语法错误:无法将 /usr/local/lib64/shibboleth/mod_shib_22.so 加载到服务器:/usr/local/lib64/shibboleth/mod_shib_22.so:未定义符号: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
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-06-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多