Boost安装失败:找不到-lrt

时间:2015-12-04 15:54:10

标签: c++ gcc boost

我在ubuntu 14.04上安装boost库(1.59.0)时遇到了麻烦 我执行了./b2,如下所示:

./b2 install --exec-prefix=/usr/local --libdir=/root/boost/lib/ --includedir=/root/boost/include/ --with-system

但我有这样的错误:

...found 22664 targets... ...updating 3 targets... gcc.link.dll bin.v2/libs/system/build/gcc-4.3.3/release/threading- multi/libboost_system.so.1.59.0 /usr/bin/ld: cannot find -lrt collect2: ld returned 1 exit status "g++" -o "bin.v2/libs/system/build/gcc-4.3.3/release/threading-multi/libboost_system.so.1.59.0" -Wl,-h -Wl,libboost_system.so.1.59.0 -shared -Wl,--start-group "bin.v2/libs/system/build/gcc-4.3.3/release/threading-multi/error_code.o" -Wl,-Bstatic -Wl,-Bdynamic -lrt -Wl,--end-group -march=i686 -pthread -m32 ...failed gcc.link.dll bin.v2/libs/system/build/gcc-4.3.3/release/threading-multi/libboost_system.so.1.59.0...

我该如何解决? cannot find -lrt但我在librt-2.11.1.so目录中有/lib

感谢。

1 个答案:

答案 0 :(得分:1)

librt-2.11.1.so文件用于运行时,对于链接,应该有.so符号链接。看起来您有安装rt的软件包,但您缺少提供必要.so链接的开发软件包。您安装了build-essential元数据包吗?