AC_CHECK_LIB 具有额外外部依赖项的库的最佳方法是什么?
我编写了一个依赖于 libxml++ 和 curl 的库,但我很难弄清楚如何在我编写的另一个包中的库上使用 AC_CHECK_LIB
。 新包的 config.log
文件表明存在对 curl_*
和 xmlpp::*
的未定义引用。
我已经在最新的软件包中为 libxml++ 和curl 设置了 PKG_CHECK_MODULES,并且这些工作正常,但它们显然不适用于我自己的库的 AC_CHECK_LIB
调用。 (在检查我自己的库之前,我检查了 libxml++ 和curl)
I've written a library that has a dependency on libxml++ and curl and I am having a hard time figuring out how to use AC_CHECK_LIB
on my library in another package I've written. The config.log
file for the new package indicates that there are undefined references to curl_*
and xmlpp::*
.
I have PKG_CHECK_MODULES
setup for libxml++ and curl in my newest package already, and those work, but they are apparently not available for the AC_CHECK_LIB
call for my own library. (I have the checks for libxml++ and curl before the check for my own library)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不知道你如何调用
AC_CHECK_LIB
,因为它不在你的问题中,但我的猜测是你没有将依赖项指定为其他库。语法是:
AC_CHECK_LIB (library, function, [action-if-found], [action-if-not-found], [other-libraries])
所以输入
[-lcurl 。 ..]
作为最后一个参数。I don't know how do you call
AC_CHECK_LIB
, because it's not in your question, but my guess is that you don't have your dependencies specified as other libraries.The syntax is:
AC_CHECK_LIB (library, function, [action-if-found], [action-if-not-found], [other-libraries])
so put
[-lcurl ...]
as the last argument.为什么不直接为您的包提供一个
pkg-config
元数据文件 (*.pc
)。 这样客户就可以使用PKG_CHECK_MODULES
并且一切都会正常工作。但您遇到此问题的事实表明您没有将您的库与 libxml++ 和 libcurl 链接起来——而且您可能应该这样做。 在大多数现代系统(包括 Linux)上,共享库知道它们的依赖关系。
Why don't you just provide a
pkg-config
metadata file (*.pc
) for your package. That way clients could usePKG_CHECK_MODULES
and things would Just Work.But the fact that you're having this problem suggests that you aren't linking your library with libxml++ and libcurl--and you probably should be. On most modern systems (including Linux), shared libraries know about their dependencies.