Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question

3 Answers 3

up vote 17 down vote accepted

You should install libboost-all-dev:

sudo apt-get install libboost-all-dev

libboost-all-devInstall libboost-all-dev

share|improve this answer
    
Ah that's it, couldn't remember for name for that package. :) –  netcoder Jul 25 '12 at 17:34

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

libbz2-devInstall 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.

share|improve this answer

I have similar problems with installing boost iostream. I am installing the newest version of boost 1.56 which is not available in Ubuntu PPA repositories.

I had this error:

gcc.compile.c++ target/boost/bin.v2/libs/iostreams/build/gcc-4.8/release/link-static/runtime-link-static/threading-multi/bzip2.o libs/iostreams/src/bzip2.cpp:20:56: fatal error: bzlib.h: No such file or directory #include "bzlib.h" // Julian Seward's "bzip.h" header.

I have solved it by placing in /usr/local/include header file http://www.opensource.apple.com/source/bzip2/bzip2-15/bzip2/bzlib.h.

However I run into other error with flags for compiler

gcc.link.dll bin.v2/libs/iostreams/build/gcc-4.8/release/threading-multi/libboost_iostreams.so.1.56.0 /usr/bin/ld: /usr/local/lib/libbz2.a(bzlib.o): relocation R_X86_64_32S against `BZ2_crc32Table' can not be used when making a shared object; recompile with -fPIC /usr/local/lib/libbz2.a: error adding symbols: Bad value

I do not know what -fPIC option is so I am stuck with this.

I tried to install libboost-iostreams-dev with

sudo apt-get install libboost-iostreams-dev

But this library version 1.53 doesn't get recognized and I get error while trying to compile other sources from https://github.com/luceneplusplus/LucenePlusPlus that depend on boost iostream with cmake and get error:

-- cotire 1.6.4 loaded.

CMake Error at /usr/share/cmake-2.8/Modules/FindBoost.cmake:1126 (message): Unable to find the requested Boost libraries.

Boost version: 1.56.0

Boost include path: /usr/local/include

The following Boost libraries could not be found:

      boost_iostreams

Some (but not all) of the required Boost libraries were found. You may need to install these additional Boost libraries. Alternatively, set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost. Call Stack (most recent call first): CMakeLists.txt:53 (find_package)

My Questions:

In order to compile luceneplusplus do I need to uninstall boost 1.56 and install all boost packages in 1.53 ?

**Or maybe there is other way to compile this boost iostream 1.56 version on Ubuntu 14.04 with on any architecture? **

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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