代码之家  ›  专栏  ›  技术社区  ›  Kjir

为什么autoconf不能正确检测boost?

  •  5
  • Kjir  · 技术社区  · 15 年前

    我使用autoconf来检测boost库,支持 autoconf-archive macros 它们在系统范围内的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文件系统中失败了。以下是~/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,没有不同的结果,知道为什么会这样吗?我忘了什么吗?

    2 回复  |  直到 15 年前
        1
  •  3
  •   Dmitry Yudakov    15 年前

    因为boost-1.39 libboost_文件系统依赖于libboost_系统。在1.39之前,您只能链接到boost_文件系统,在以后的版本中,您必须链接到这两个文件系统。

    也许这和你的错误有关。

        2
  •  1
  •   Rhys Ulerich    15 年前

    我找到了 boost.m4 比autoconf宏存档中的boost宏更健壮。只需迁移到boost.m4,您可能会有好运。

    推荐文章