Compiling boost 1.55 with C++11 support on the Raspberry PI

First a bit of background.
I’ve decided to use a raspberry pi model A as the brain in my quadcopter. For video streaming I’ll use it’s video encoding support (thanks to the VideoCore IV and OpenMAX) and it will communicate through serial with the Crius AIOP board I already have.
But first I have to prepare my environment with C++11 support using GCC 4.8.2, boost 1.55 and a windows cross compiler. I used this tutorial for getting my cross compiler ready.
To overwrite all the libs to the rpi ones I used this small lua script which enumerates all the files in a folder and then replaces each one with the corresponding file from a different folder:
You need the latest LuaForWindows to run the lua script.

 local dir = require( "pl.dir" )  
 local file = require( "pl.file" )  
 local path = require( "pl.path" )   
 local src_files = {}  
 function read_src_files(root)  
      local files = dir.getallfiles(root)  
      for i=1,#files do  
           local file = path.basename(files[i]):upper()  
           src_files[file] = files[i]  
      end  
 end  
 function replace_all(root, pattern)  
      local files = dir.getallfiles(root, pattern)  
      --print(files)  
      for i=1,#files do  
           --print(files[i])  
           local dst_file = files[i]  
           local folder = path.dirname(dst_file)  
           local filename = path.basename(dst_file):upper()  
           local found = src_files[filename] ~= nil  
           print(found, dst_file, folder)  
           if found then  
                dir.copyfile(src_files[filename], dst_file)  
           else  
                --dir.movefile(dst_file, dst_file..'_notfound')  
           end  
      end  
 end  
 read_src_files("rpi-libs")  
 replace_all("linaro-4.8.2", "*.a")  
 replace_all("linaro-4.8.2", "*.o")  
 replace_all("linaro-4.8.2", "*.so")  
 replace_all("linaro-4.8.2", "*.so*")  

Now back to compiling boost. Remember that you need GCC >= 4.7 for this
1. Download the 1.55 tar.gz
2. Uncompress it with tar-xvf boost…
3. cd to the boost folder
4.  ./bootstrap.sh –with-libraries=date_time,exception,filesystem,program_options,signals,system
Add the libs that you need or remove the –with-libraries if you want all the libs
5. ./b2 cxxflags=”-std=c++11″ link=static thread=multi      and wait for a billion hours
6. [for your cross compiler] Copy the new libs from boost/stage/libs to your windows machine
7. sudo b2 install

Advertisements

One thought on “Compiling boost 1.55 with C++11 support on the Raspberry PI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s