Search code examples
c++boostbz2

Can't build boost on linux with bz2 support


Downloaded boost 1.66, unbzipped, launching bootstrap:

Bootstrapping is done. To build, run:
    ./b2

b2 reports:

...blablabla..
- zlib                     : yes (cached)
- bzip2                    : yes (cached)
...blablabla..
The following directory should be added to linker library paths:
    /home/steve/boost_1_66_0/stage/lib
...blablabla..

No errors during build, only warnings. I am looking into /home/steve/boost_1_66_0/stage/lib, but there is no files with bz in their name. On windows prebuilt binaries I have:

boost_bzip2-vc140-mt-gd-x64-1_66.dll
boost_bzip2-vc140-mt-gd-x64-1_66.lib
boost_bzip2-vc140-mt-x64-1_66.dll
boost_bzip2-vc140-mt-x64-1_66.lib

As a result my project builds fine on Windows and fails on Linux because of missing bz2 dependencies. Any ideas?

My linux is ubuntu 14.

Thanx.


Solution

  • Ok, what I've found out is that on Linux and Windows you need different libraries for bz2 streams to function. I am using cmake and this is how I've solved it:

    if (MSVC)
        find_package(Boost COMPONENTS system filesystem bzip2 REQUIRED)
    endif()
    if(LINUX)
        find_package(Boost COMPONENTS system filesystem iostreams REQUIRED)
    endif()
    

    otherwise linker produces errors both on Windows and Linux.