While working on some smaller part of a particle detector at FAIR in the panda-Experiment. I wanted to use boost.asio in order to build my TCP/IP communication on this. First I just used "apt install libboost-dev-all" and it worked pretty straight from the beginning. Anyways, one day I wanted to try something different and got some lines of code from a friend. Trying to compile this I got all errors. GCC told me that I was using undefined references and thats when I first realized that I was still using boost 1.62 on debian stretch.
Boost 1.62.0
If you are interested in all of the Boost history please follow this link -> https://www.boost.org/users/history/
Boost 1.62.0 was released on September 28th in 2016. Which is now almost two-and-a-half years old. Since then there have been a few changes. Especially regarding asio.
Asio was updated in 1.69.0 as well as in .67, .66 and .65. For me the most problematic part was the use of now io.context instead of io.service. Actually this wasn't that much of a problem at most points, but since I was building a new application I wanted to make sure to use the newest library of Boost available. But since building Boost on my Surface in WSL-Ubuntu wasn't that trivial, here is a little walk-through of how to build Boost for a linux-machine running on ARM.
My first fail
Long story short, I ssh-ed onto my Beaglebone Black which was already running Debian Stretch. I wget-ed the tarball, -xzf-ed it into my home-directory and tried bootstrapping and building it. It of did not work, basically because of to few resources on the machine. So quite fast I came to the conclusion that I had to build it on my laptop and scp it when it is done.
Using WSL to compile Boost
WSL is one of the coolest features of newer Windows releases. I basically gives you most of the functionalities of a full-blown Linux, but running on a day-to-day Windows-Machine. I love it. I assume, that you already installed WSL and are familiar with using it.
First of all I used "apt update" and "apt upgrade" to make sure I am using updated tools. If you haven't installed a handy text-editor at this point. Try installing vim. That's what I am using for this walk-through. Further more you need to apt install gcc g++-arm-linux-gnueabihf to install gcc and the g++ cross-compiler for ARM-Linux targets.
cd into your ~ directory and wget the newest version of Boost from the boost.org-page. At the date of writing this is 1.69.0.
tar -xzf boost_1_69_0.tar.gz to extract the tarball. mv boost_1_69_0/ boost_1_69_0.ARM to get rid of confusion later on.
Run ./boost_1_69_0.ARM/bootstrap.sh to prepare the compilation environment.
No we are coming to the tricky part. Building the boost-libraries themselves. First modify the project-config.jam adding " : arm : arm-linux-gnueabihf-g++" between "using gcc" and ";".
<esc>, :wq to write the file and close vim.
vim buildmyboost.sh makes a new file and opens it. Add the following lines:
./b2 --prefix=~/boostForARM/ \
--without-atomic \
--without-chrono \
--without-container \
--without-context \
--without-contract \
--without-coroutine \
--without-date_time \
--without-fiber \
--without-graph \
--without-graph_parallel \
--without-iostreams \
--without-locale \
--without-log \
--without-math \
--without-mpi \
--without-python \
--without-random \
--without-serialization \
--without-stacktrace \
--without-test \
--without-thread \
--without-timer \
--without-type_erasure \
--without-wave \
--address-model=32 \
--stagedir=~/boostForARMstage-arm-gnueabihf-g++/ \
-j4 \
-toolset=arm-linux-gnueabihf-g++ \
-threading=multi
--without-chrono \
--without-container \
--without-context \
--without-contract \
--without-coroutine \
--without-date_time \
--without-fiber \
--without-graph \
--without-graph_parallel \
--without-iostreams \
--without-locale \
--without-log \
--without-math \
--without-mpi \
--without-python \
--without-random \
--without-serialization \
--without-stacktrace \
--without-test \
--without-thread \
--without-timer \
--without-type_erasure \
--without-wave \
--address-model=32 \
--stagedir=~/boostForARMstage-arm-gnueabihf-g++/ \
-j4 \
-toolset=arm-linux-gnueabihf-g++ \
-threading=multi
This script configures and runs the build of your Boost for ARM-Linux. <esc>, :wq to write and close the file and make this script executable by using chmod +x. Now run ./buildmyboost.sh. After this, works. You may think about which libs you actually need and delete them from your build-script. In my case, I've got all I need. Hope this helps you!
Cheers
Stephan