Search code examples
linuxdockerboostcross-compilingbuildroot

How do I tell buildroot to include boost in the host toolchain


I'm replacing an older cross-compile toolchain, and I can't figure out how to get buildroot to include host/.../sysroot/usr/include/boost like the old toolchain had.

Context:

I'm trying to build a docker image that can be used to cross-compile software for MiyooCFW in GitHub Actions. Here is my current Dockerfile.

The project moved from uClibc to musl libc, which is why the toolchain needs to be updated.

The older toolchain that actually works is a .zip file on google drive. I think it was probably built using Makefile.legacy in this buildroot fork. The newer one uses make sdk with the main Makefile there. (There is a bit of documentation, but it's incomplete.)

I installed libboost-all-dev which puts the libraries in /usr/include/boost/ but just having them installed is apparently not enough.

GMenuNX is an example program I'm trying to cross-compile that depends on boost. The steward branch uses a docker image with the older toolchain and compiles successfully. The ci branch uses my new docker image and fails with:

/opt/miyoo/bin/arm-linux-g++ -ggdb -DTARGET_MIYOO -DTARGET=miyoo -D__BUILDTIME__="\"2022-02-19 18:33\"" -DLOG_LEVEL=3 -I/opt/miyoo/arm-buildroot-linux-musleabi/sysroot/usr/bin/../../usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -I/opt/miyoo/usr/include/ -I/opt/miyoo/arm-buildroot-linux-musleabi/sysroot/usr/include/  -I/opt/miyoo/arm-buildroot-linux-musleabi/sysroot/usr/include/SDL/ -o objs/miyoo/src/selector.o -c src/selector.cpp
src/selector.cpp:34:10: fatal error: boost/algorithm/string.hpp: No such file or directory
  34 | #include <boost/algorithm/string.hpp>
     |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile.miyoo:31: objs/miyoo/src/selector.o] Error 1
Error: Process completed with exit code 2.

I also tried copying the boost libs over manually, but that just got me a bunch of different errors.

Finally, if it wasn't apparent already, I am a complete noob when it comes to buildroot, cross compiling, etc. I don't even work with c++ very often. I's very possible that I missed something obvious.


Solution

  • If you want the Buildroot toolchain to include the Boost libraries, enable the Boost package in your Buildroot configuration: BR2_PACKAGE_BOOST=y. It has a number of sub-options, make sure to enable the ones that are relevant for you.

    Installing Boost on your machine will have absolutely zero effect on which libraries are available in the toolchain sysroot.