为什么boost编译失败了?

时间:2013-07-26 14:41:32

标签: boost compilation clang boost-build

我正在尝试使用clang编译boost C ++。

./b2 --prefix=~/boost --includedir=~/boost/include --libdir=~/boost/lib toolset=clang cxxflags="-std=c++11 -stdlib=libc++ -isystem ~/libcxx/include/" linkflags="-stdlib=libc++ -L ~/libcxx/lib/"

当我看到日志文件时,它会出错

 Undefined symbols for architecture x86_64:
 "boost::system::system_category()", referenced from:
  __GLOBAL__I_a in exceptions.o
 "boost::system::generic_category()", referenced from:
  __GLOBAL__I_a in exceptions.o
  ld: symbol(s) not found for architecture x86_64
 clang: error: linker command failed with exit code 1 (use -v to see invocation)

我的默认铿锵声是clang-mp-3.3。任何人都可以帮我弄清楚这个问题是什么。

1 个答案:

答案 0 :(得分:0)

在网络中搜索错误原因后,我找到了this,其中解释了如何使用clang编译boost。我不确定为什么添加 define = BOOST_SYSTEM_NO_DEPRECATED 使其有效。请对任何知道其工作原理的人发表评论。然后我能够编译没有错误,但我仍然看到一些警告,但它现在对我有用。

我使用的默认clang是(clang-mp-3.3)

$ clang -v

clang version 3.3(标签/ RELEASE_33 / final) 目标:x86_64-apple-darwin11.4.2 线程模型:posix

 ./bootstrap.sh --with-toolset=clang --without-libraries=mpi,python,graph_parallel
 ./b2 clean
 ./b2 toolset=clang cxxflags="-std=c++11 -stdlib=libc++"  linkflags="-stdlib=libc++"  define=BOOST_SYSTEM_NO_DEPRECATED
相关问题