Raspberry Pi: cross-compile Boost libraries

Environment
  • Ubuntu 16.04 LTS
  • arm-linux-gnueabihf (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
  • Raspberry Pi 3 Model B
Install toolchain

See C++ cross-compiling.

Download boost source code

Boost source on Sourceforge. In my case boost_1_63_0.tar.bz2.

Compile

Say, we need boost-iostreams, installation folder /usr/local/boost:

# Unpack the archive
$ tar --bzip2 -xf boost_1_63_0.tar.bz2
$ cd boost_1_63_0
$ ./bootstrap.sh
# In the project-config.jam file replace
# using gcc ;
# by
# using gcc : arm : arm-linux-gnueabihf-g++ ;
$ sudo ./bjam install toolset=gcc-arm --prefix=/usr/local/boost --with-iostreams