为什么autoconf没有正确检测到增强?

Kji*_*jir 6 c++ autoconf boost boost-filesystem

我使用autoconf检测boost库,在autoconf-archive宏的支持下,它们可以与系统范围的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 !
Run Code Online (Sandbox Code Playgroud)

正如您所看到的,它检测到一些库很好,但它使用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
Run Code Online (Sandbox Code Playgroud)

所以图书馆在那里.我尝试使用boost-1.39和boost-1.42而没有任何不同的结果,任何想法为什么会发生这种情况?我忘记了什么吗?

Dmi*_*kov 3

自 boost-1.39 起,libboost_filesystem 依赖于 libboost_system。在 1.39 之前,您只能链接到 boost_filesystem,在更高版本中,您必须同时链接到它们。

也许这与你的错误有关。