Updating to Boost 1.56 on Win and Linux builds

Nov 6, 2014 at 4:52 PM
Hi,

We're switching over to Boost 1.56 in our main software branch, and we'd like to compile/link Casablanca 2.2 with our 1.56 version of Boost, on Win7/8.1 and Ubuntu 14.10. We started on Linux first, and modified the build command to this:

CXX=g++-4.8 cmake .. -DBoost_NO_BOOST_CMAKE=TRUE -DBOOST_ROOT=/path/to/our/boost_1_56 -DCMAKE_BUILD_TYPE=Debug

CXX=g++-4.8 cmake .. -DBoost_NO_BOOST_CMAKE=TRUE -DBOOST_ROOT=/path/to/our/boost_1_56 -DCMAKE_BUILD_TYPE=Release

Both versions compile with pages and pages of warnings (which is suspect), but link successfully. When we run any tests though, it segfaults way down in the g++ shared_ptr code (everything starts, but any POST/PUT/GET causes a crash). Given that it builds and runs fine against Ubuntu's standard installed Boost 1.55, the problem is obviously on our end. We don't have any special flags on our own Boost compilation, other than layout=system on every platform.

Is this the right way to compile Casablanca on Linux with a custom Boost version? Have we left out a flag or a -D somewhere, or should we build with any extra flags in Boost? Alternatively, if 2.3 is updated to 1.56, we're happy to move to that, we're not in production use until early 2015. We'd rather not have to use two Boost versions, or downgrade to 1.55.

Cheers,

Damien
Coordinator
Nov 6, 2014 at 5:34 PM
Hi Damien,

Hypothetically, there should be no problem with just specifying -DBOOST_ROOT=/x/y/z -- You shouldn't need -DBoost_NO_BOOST_CMAKE=TRUE. I assume that during the cmake configure call it says it has found boost 1.56.0.

Are you using g++-4.8 to compile Boost? What are the error messages you get during compilation? What does the call stack look like when it faults?

To ensure there's no contamination (which would result in equally strange errors), I would recommend
  • Uninstall all other copies of boost from the system you're compiling with
  • Verify it does not configure without passing any flags (and it fails to configure because it can't find boost)
  • Add in your -DBOOST_ROOT=/x/y/z flag
Unfortunately, we can't upgrade the recommended/base boost version required since it's not available in Ubuntu 14.04 LTS.

Sincerely,
roschuma
Nov 6, 2014 at 5:41 PM
Roschuma,

14.10 now has g++ 4.9, which I didn't notice (yay for 2am crash debugging...). I'll do a ground-up rebuild of Boost 1.56 and Casablanca, see what happens, and report back. If that still dies, then I'll start chasing the call stack.

Damien
Nov 6, 2014 at 8:07 PM
Edited Nov 6, 2014 at 8:11 PM
OK, I had a bad build, and found a few things. This is embarrassing and serves me right for doing it at 2am. The libbz2 package was broken, which Boost uses to build, and that messed a whole bunch of things up.

sudo apt-get install libbz2-dev fixed that.

Also, I was using an old (2011) version of Boost Build on the 1.56 Boost source. ./bootstrap.sh –prefix=../../bin fixed that.
Everything now works, and the new build of Casablanca passes all the test_runner tests in debug and release. From the top, here’s the procedure to build Casablanca on Linux with a specific Boost version:

My Boost source is in /home/damien/projects/boost_1_56_0. I build Debug and Release versions, 64-bit only.
In the Boost source directory (note that this is all on one line):

./bin/b2 --toolset=gcc address-model=64 --stagedir=./stage64debug --build-dir=./build64debug --layout=system --without-mpi variant=debug link=shared threading=multi runtime-link=shared install --prefix=./linux64debug/indep --exec-prefix=./linux64debug/bin --libdir=./linux64debug/lib --includedir=./linux64debug/include


That gets you a Debug build. For Release it’s

./bin/b2 --toolset=gcc address-model=64 --stagedir=./stage64release --build-dir=./build64release --layout=system --without-mpi variant=release link=shared threading=multi runtime-link=shared install --prefix=./linux64release/indep --exec-prefix=./linux64release/bin --libdir=./linux64release/lib --includedir=./linux64release/include

My Casablanca source is in /home/damien/projects/casablanca
In the Casablanca source directory:

mkdir build.debug

cd build.debug

CXX=g++ cmake .. -DBOOST_ROOT=/home/damien/projects/boost_1_56_0/linux64debug -DCMAKE_BUILD_TYPE=Debug

make

Then:

cd ..

mkdir build.release

CXX=g++ cmake .. -DBOOST_ROOT=/home/damien/projects/boost_1_56_0/linux64release -DCMAKE_BUILD_TYPE=Release

make

That’s it, you can run the tests if you want from there.
Marked as answer by roschuma on 11/6/2014 at 12:49 PM
Coordinator
Nov 6, 2014 at 8:49 PM
Thanks for this writeup, I'm sure it will help people in the future!

roschuma