51

I am having trouble installing boost library completely it fails/skips several things that seem to be key for me to continue on to compiling a program with it. Here is what I get when I install 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...

Ive tried re-installing zlib, and other archive tools like bzip2 but no luck.

66

Package libboost-all-dev installs all the development libraries. Excerpt of the package description:

This metapackage provides the complete Boost development environment, including all separately-packaged libraries.

Install it with:

sudo apt-get install libboost-all-dev

If it fails to locate the package, make sure the universe repository is enabled.

Headers are located in /usr/include/boost and libraries in /usr/lib/x86_64-linux-gnu or /usr/lib/i386-linux-gnu.

  • Ah that's it, couldn't remember for name for that package. :) – netcoder Jul 25 '12 at 17:34
  • really? sudo apt-get install libboost-all-dev Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package libboost-all-dev – CashCow Aug 3 '16 at 9:43
  • I actually asked it as my own question and after enabling universe and doing apt-get update it re-appeared. Perhaps you would like to add those to your answer. (Not obvious to everyone... And nothing wrong with stating things that might be obvious to many if it is one of the steps) – CashCow Aug 3 '16 at 18:38
  • where these files are located – prasad Jan 6 '17 at 16:03
36

Not specific to Boost, but to get the header files (e.g.: bzlib.h) for a library, you need to install the dev packages for it:

sudo apt-get install libbz2-dev

Generally, to find in what package(s) a file is contained, use apt-file:

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

I think there's a meta package for boost libraries though, although I don't remember the name for it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.