如何安装所有boost开发库?


52

我在完全安装boost库时遇到了麻烦,它无法/跳过一些似乎对我继续使用它进行编译的关键的事情。这是我安装Boost时得到的,

gcc.compile.c++ bin.v2/libs/iostreams/build/gcc-4.6/release/threading-multi/bzip2.o
libs/iostreams/src/bzip2.cpp:20:56: fatal error: bzlib.h: No such file or directory
compilation terminated.

    "g++"  -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -pthread -fPIC  -DBOOST_ALL_NO_LIB=1 -DBOOST_IOSTREAMS_DYN_LINK=1 -DBOOST_IOSTREAMS_USE_DEPRECATED -DNDEBUG  -I"." -c -o "bin.v2/libs/iostreams/build/gcc-4.6/release/threading-multi/bzip2.o" "libs/iostreams/src/bzip2.cpp"

...failed gcc.compile.c++ bin.v2/libs/iostreams/build/gcc-4.6/release/threading-multi/bzip2.o...
...skipped <pbin.v2/libs/iostreams/build/gcc-4.6/release/threading-multi>libboost_iostreams.so.1.50.0 for lack of <pbin.v2/libs/iostreams/build/gcc-4.6/release/threading-multi>bzip2.o...
...skipped <p/usr/local/lib>libboost_iostreams.so.1.50.0 for lack of <pbin.v2/libs/iostreams/build/gcc-4.6/release/threading-multi>libboost_iostreams.so.1.50.0...
...skipped <p/usr/local/lib>libboost_iostreams.so for lack of <p/usr/local/lib>libboost_iostreams.so.1.50.0...
gcc.compile.c++ bin.v2/libs/iostreams/build/gcc-4.6/release/link-static/threading-multi/bzip2.o
libs/iostreams/src/bzip2.cpp:20:56: fatal error: bzlib.h: No such file or directory
compilation terminated.

    "g++"  -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -pthread  -DBOOST_ALL_NO_LIB=1 -DBOOST_IOSTREAMS_USE_DEPRECATED -DNDEBUG  -I"." -c -o "bin.v2/libs/iostreams/build/gcc-4.6/release/link-static/threading-multi/bzip2.o" "libs/iostreams/src/bzip2.cpp"

...failed gcc.compile.c++ bin.v2/libs/iostreams/build/gcc-4.6/release/link-static/threading-multi/bzip2.o...
...skipped <pbin.v2/libs/iostreams/build/gcc-4.6/release/link-static/threading-multi>libboost_iostreams.a(clean) for lack of <pbin.v2/libs/iostreams/build/gcc-4.6/release/link-static/threading-multi>bzip2.o...
...skipped <pbin.v2/libs/iostreams/build/gcc-4.6/release/link-static/threading-multi>libboost_iostreams.a for lack of <pbin.v2/libs/iostreams/build/gcc-4.6/release/link-static/threading-multi>bzip2.o...
...skipped <p/usr/local/lib>libboost_iostreams.a for lack of <pbin.v2/libs/iostreams/build/gcc-4.6/release/link-static/threading-multi>libboost_iostreams.a...
...failed updating 2 targets...
...skipped 6 targets...

香港专业教育学院试图重新安装zlib,和其他存档工具,如bzip2,但没有运气。

Answers:


67

软件包libboost-all-dev将安装所有开发库。包装说明摘录:

此元包提供完整的Boost开发环境,包括所有单独打包的库。

通过以下方式安装:

sudo apt-get install libboost-all-dev

如果找不到包,请确保已启用Universe资源库

头位于/usr/include/boost和在图书馆/usr/lib/x86_64-linux-gnu/usr/lib/i386-linux-gnu


就是这样,不记得那个包裹的名字了。:)
netcoder 2012年

真?sudo apt-get install libboost-all-dev读取软件包列表...完成构建依赖关系树读取状态信息...完成E:无法找到软件包libboost-all-dev
CashCow

我实际上问过它是我自己的问题,并且在启用Universe并进行了apt-get更新之后,它再次出现。也许您想将这些添加到您的答案中。(对每个人来说都不是显而易见的...并且陈述某些步骤可能对许多人来说显而易见的事情也没错)
CashCow

这些文件的位置
prasad

36

不特定于Boost,而是要获取库的头文件(例如bzlib.h),您需要为其安装dev软件包:

sudo apt-get install libbz2-dev

通常,要查找文件包含在哪个包中,请使用apt-file

sudo apt-get install apt-file
apt-file update
apt-file search bzlib.h

尽管我不记得它的名称,但我认为还有一个用于Boost库的meta包。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.