Boost C++ libraries for Raspberry Pi

16 posts
by abikloro » Mon Jun 11, 2012 2:49 pm
Hello everybody!

If you are programming in C++ there are chances that you use Boost C++ libraries as well. I couldn't find pre-built Boost libraries for ARM, so I had to compile them myself. Since I don't have a cross-compiler ready, I compiled them on the Rasp Pi (B model) itself, so it took quite a while (about 4 hours), but it was worth it :D I had to use an external USB drive for swap storage because the build kept failing due to RAM shortage.

I used Arch distribution (29/4/2012) and I compiled with the latest GCC in repositories (4.7.0).

I've uploaded the binaries if you don't want to compile on your own.

Whole Boost 1.49 package (sources, headers, documentation): [63 MB]
SHA1: 4669a82a35ca90d9e3ba4a052a5ba6ff9d46a67a

Libraries only (static + dynamic) [6.8MB]
SHA1: 8276a1a320d97b253eedc6d76bc49a04c982869e

Tibor Djurica Potpara
Posts: 4
Joined: Sun Jun 10, 2012 8:03 pm
by jmacey » Mon Jun 11, 2012 6:21 pm
good work,

I'm using the debian squeeze and the boost libs are in the repo, just need to use apt-get libboost-dev but i think this is 1.42 not .49
Posts: 135
Joined: Thu May 31, 2012 1:05 pm
by cupcake » Mon Jun 11, 2012 8:55 pm
Using the libraries found in the Debian repo seems to work just fine.
Posts: 59
Joined: Sat Jan 21, 2012 9:00 pm
by abikloro » Mon Jun 11, 2012 9:22 pm
Sure, but 1.42 is a bit dated and so it may not work with the latest projects. This usually isn't a problem, since Boost compiles quickly and the build process is as straightforward as it gets, but on Rasp Pi it really takes a long time.

I will do another build with -std=c++11 switch soon (mixing C++11-compiled code with non C++11 libraries can lead to some weird bugs - see
Posts: 4
Joined: Sun Jun 10, 2012 8:03 pm
by abikloro » Tue Jun 12, 2012 8:41 am
As promised, I did another build with C++11 compiler switch. The only change is in the user-config.jam file, I added
Code: Select all
using gcc : c++11 : "g++" : <cxxflags>-std=c++11 ;
And then compiled with
Code: Select all
./b2 toolset=gcc-c++11
Whole Boost 1.49 package (sources, binaries, headers, documentation) [63 MB]
SHA1: f5f1970c901e5876e9958dbf56e8541a50736e78

Libraries only (static + dynamic) [6.7 MB]
SHA1: 10779c08062aa7b1de9e8ddbb7bd4227f1932317
Posts: 4
Joined: Sun Jun 10, 2012 8:03 pm
by shirro » Tue Jun 12, 2012 9:21 am
jmacey wrote:good work,

I'm using the debian squeeze and the boost libs are in the repo, just need to use apt-get libboost-dev but i think this is 1.42 not .49

It looks like a Debian Wheezy is available for testing and Raspbian which is also Wheezy has boost 1.46, 1.48 and 1.49 available.
Posts: 248
Joined: Tue Jan 24, 2012 4:54 am
by clubcsl » Wed Oct 03, 2012 4:05 pm
many thanks !
Posts: 6
Joined: Sun Sep 23, 2012 6:54 pm
by mvpete » Mon Oct 15, 2012 5:50 am
Hi there,

Recently I downloaded and installed the boost C++11 libs on the pi. I compiled just a simple program linking boost::asio. When I tried to run I get an error saying no such file exists. I tried moving the .so files next to the executable, tried moving the libs into the /usr/lib folder. Still doesn't work. For the life of me I just can't figure it out :oops:

Any advice?

Posts: 2
Joined: Mon Oct 15, 2012 5:46 am
by topguy » Tue Oct 16, 2012 8:47 am
There is a nice command called "ldd" that you can run on your binary that will tell you which dynamic libraries that is missing, and where it has found the ones it can find.

There is also this environment variable called "LD_LIBRARY_PATH" where you can add additional paths to search.

export LD_LIBRARY_PATH="."

.. will search local directory.
User avatar
Posts: 3018
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway
by mvpete » Tue Oct 16, 2012 11:56 am
Unfortunately, I've added the path to LD_LIBRARY_PATH and tried running ldconfig to clear the cache. Anytime I use ldd it says the lib isn't found. I'm baffled. I've even moved the lib right next to the exectuable still nothing.
Posts: 2
Joined: Mon Oct 15, 2012 5:46 am
by andrnev » Mon Mar 25, 2013 11:40 am
Hi abikloro,

I am interested in how you have successfully compiled a boost cpp program on the rPi.

I have a post running right now where I tried to do this with an aptitutde install from the debian org packages, but this did not work. I am trying to go the windows way by dumping the full boost distro on my usb and linking in via LD_LIBRARY_PATH but no success there either.

Pardon my ignorance in debian.
Posts: 11
Joined: Sun Mar 24, 2013 11:53 pm
by rmisk » Sun Mar 31, 2013 9:19 pm
I am having the same problem with Occidentalis v0.2 (Wheezy derivative) with respect to I have put it in every lib directory but it still can't be found.

When I tried it with ArchLinux RPi every thing works as expected.

Has anyone been able to compile g++ with boost libraries in the Raspberry Pi (actually it compiles it just won't execute because it can't find the library file) using Occidentalis v0.2?
Posts: 1
Joined: Thu Mar 28, 2013 10:10 am
by dr_d_gee » Mon Apr 01, 2013 1:27 pm
You should leave the libraries where the installer puts them. Normally this will be in /usr/lib, so I'm assuming that it wan't in that directory. Where *was* the library file (.so) placed (originally) by the installer, that the system couldn't find? Unless I've missed something, you never said.
Posts: 84
Joined: Fri Jan 04, 2013 1:30 pm
by mesmariusz » Wed Feb 19, 2014 4:18 pm
How do you think:

Code: Select all
sudo apt-get install libboost1.50-all
Posts: 48
Joined: Fri Feb 15, 2013 6:07 am
by hectorious » Tue Sep 02, 2014 2:48 pm
Dynamically linking generates no error at compile time. But it won't run with error that libboost_* can't be find. I've done ldconfig and even tried to change LD_LIBRARY_PATH.

Statically linking generates that the final executable file uses VFP register arguments but that libboost_program_options.a(options_description.o) does not.

Tried to get the final executable to no use the VFP by specifying -mfloat-abi=softfp with no luck. With several other options and combinations as well.

Can you help me? What am I missing here?

PS. Cross-compiling from Linux Mint btw
Posts: 3
Joined: Tue Sep 02, 2014 1:37 pm
by hectorious » Wed Sep 03, 2014 4:18 pm
I compiled my own libraries instead :) Used the toolchain and cross compiling only took a few minutes.

Anyway thanks for these libraries!
Posts: 3
Joined: Tue Sep 02, 2014 1:37 pm