【问题标题】:Why autoconf isn't detecting boost properly?为什么 autoconf 没有正确检测到升压?
【发布时间】:2010-03-05 10:56:59
【问题描述】:

autoconf-archive macros 的支持下,我正在使用 autoconf 来检测 boost 库,它们可以在系统范围的 boost 库中正常工作,但是如果我在我的主目录中手动编译 boost 则会失败:

sb@stephane:~/devel/spectra2$ ./configure --with-boost=/home/sb/local/
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for style of include used by make... GNU
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for library containing strerror... none required
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking for boostlib >= 1.31.0... yes
checking whether the Boost::Program_Options library is available... yes
checking for exit in -lboost_program_options... yes
checking whether the Boost::Filesystem library is available... yes
checking for exit in -lboost_filesystem... no
checking for exit in -lboost_filesystem... (cached) no
checking for exit in -lboost_filesystem... (cached) no
configure: error: Could not link against boost_filesystem !

如您所见,它检测到一些库正常,但由于 boost-filesystem 失败。这些是~/local/lib的内容:

sb@stephane:~$ ls -1 /home/sb/local/lib/
libboost_filesystem.a
libboost_filesystem.so
libboost_filesystem.so.1.42.0
libboost_program_options.a
libboost_program_options.so
libboost_program_options.so.1.42.0
libboost_system.a
libboost_system.so
libboost_system.so.1.42.0
libboost_thread.a
libboost_thread.so
libboost_thread.so.1.42.0

所以图书馆就在那里。我尝试了 boost-1.39 和 boost-1.42 都没有不同的结果,知道为什么会这样吗?我是不是忘记了什么?

【问题讨论】:

    标签: c++ boost autoconf boost-filesystem


    【解决方案1】:

    由于 boost-1.39 libboost_filesystem 依赖于 libboost_system。 1.39之前只能链接boost_filesystem,以后的版本必须同时链接。

    也许这与你的错误有关。

    【讨论】:

    • 您的猜测是正确的:boost-system 已安装并且在 configure.ac 中有一个检查,但它是在检查 boost-filesystem 之后。如果我切换顺序,一切都会按预期进行。这也是 autoconf-archive 中的一个小文档问题
    • @Dmitry Yudakov 请为您的陈述提供链接/参考。
    【解决方案2】:

    我发现boost.m4 比 Autoconf 宏存档中提供的 Boost 宏更强大。迁移到 boost.m4 可能会带来好运。

    【讨论】:

      猜你喜欢
      • 2014-03-27
      • 2013-03-21
      • 1970-01-01
      • 2016-02-04
      • 1970-01-01
      • 2011-04-17
      • 1970-01-01
      • 2019-12-07
      • 1970-01-01
      相关资源
      最近更新 更多