【问题标题】:Autotools AC_SEARCH_LIBS finds the library, but doesn't add it to $LIBSAutotools AC_SEARCH_LIBS 找到库,但不将其添加到 $LIBS
【发布时间】:2016-05-08 19:23:38
【问题描述】:

我正在使用自动工具来配置和构建我的项目,该项目使用 dlopen 及其朋友。

我的根 configure.ac 中有以下 sn-p:

AC_SEARCH_LIBS([dlopen], [dl dld], [], [ AC_MSG_ERROR([unable to find the dlopen() function]) ])

我从https://autotools.io/autoconf/finding.html得到的

该库是由 autotools 找到的:

checking for library containing dlopen... -ldl

但是,该库似乎没有添加到 $(LIBS),因为:

a_out_LDADD=-ldl

工作(即项目编译和运行),和

a_out_LDADD=$(LIBS)

没有(即undefined reference to 'dlopen'

我错过了什么?

【问题讨论】:

    标签: shared-libraries autotools dlopen


    【解决方案1】:

    (完全披露,我是链接文档的作者。)

    你确定LIBS 变量没有被破坏吗?您可以查看config.log 以查看最终输出是什么。我认为最常见的问题是后面的行 LIBS=${SOMEDEPS_LIBS} 没有预先添加旧的 LIBS 值。

    你也不应该需要_LDADD=$(LIBS),因为后者默认添加到所有链接命令中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-09
      • 1970-01-01
      • 1970-01-01
      • 2011-11-20
      相关资源
      最近更新 更多