This post showcases how to cross-compile boost for OpenWRT. We’ll use the Teltonika RUTX10 SDK which is already pre-configured with the relevant OpenWRT settings for that router.
The prerequisite for this is that you have:
- Downloaded the SDK
- Built it using our instructions or the official manual if you prefer a longer read.
We assume the SDK is located in ~/rutos-ipq40xx-rutx-gpl
.
Compiling boost
First, you need to consider that many boost libraries are header-only libraries. For those libraries, you don’t need to compile boost, but it might still be easier to prepare a complete boost folder for installation.
First, download boost and unpack it. Now run
./bootstrap.sh
to compile bjam
.
Now, open project-config.jam
inside the boost folder and add the following line at the top of the file:
using gcc : openwrt : arm-openwrt-linux-muslgnueabi-g++ ;
Now, inside the boost folder, run the following bash script:
export STAGING_DIR=~/rutos-ipq40xx-rutx-gpl/staging_dir export TOOLCHAIN=${STAGING_DIR}/toolchain-arm_cortex-a7+neon-vfpv4_gcc-8.4.0_musl_eabi export CC=${TOOLCHAIN}/bin/arm-openwrt-linux-muslgnueabi-gcc export CPP=${TOOLCHAIN}/bin/arm-openwrt-linux-muslgnueabi-g++ export PATH=$PATH:${TOOLCHAIN}/bin/ # Insert at the top of project-config.jam # using gcc : openwrt : arm-openwrt-linux-muslgnueabi-g++ ; rm -rf ~/boost_rutx10 mkdir -p ~/boost_rutx10/ ./b2 --prefix=$HOME/boost_rutx10 install toolset=gcc-openwrt -sNO_COMPRESSION=1
Now, boost is installed in ~/boost_rutx10
, which has include
and lib
subdirectories.