首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么autoconf不能正确检测boost?

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

Stack Overflow用户
提问于 2010-03-05 18:57:00
回答 2查看 5.7K关注 0票数 6

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

代码语言:javascript
复制
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的内容:

代码语言:javascript
复制
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,没有不同的结果,你知道为什么会发生这种情况吗?我是不是忘了什么?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2010-03-05 19:11:02

因为boost-1.39 libboost_filesystem依赖于libboost_system。在1.39之前,你只能链接到boost_filesystem,在以后的版本中,你必须同时链接到这两个版本。

也许这与你的错误有关。

票数 3
EN

Stack Overflow用户

发布于 2010-03-06 14:01:02

我发现boost.m4比Autoconf Macro Archive中的Boost宏要健壮得多。只要迁移到boost.m4,您就可能会有好运气。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2386161

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档