Boost provides free peer-reviewed portable C++ source libraries. Ten Boost libraries are already included in the C++ Standards Committee’s Library Technical Report and will be in the new C++11 Standard.
The Boost C++ libraries are already included in popular Linux and Unix distributions such as Fedora, Debian, Ubuntu and NetBSD and are used by projects such as Python, Xibo, Civilization IV, etc..
Here are the steps to cross-compile Boost C++ libraries for arm using arm-linux-guneabi-g++:
- Download the source code:
1wget http://sourceforge.net/projects/boost/files/boost/1.47.0/boost_1_47_0.tar.bz2/download - Extract the source code:
123mv download boost.tar.bz2tar xjvf boost.tar.bz2cd boost_1_47_0/ - Bootstrap the code:
1./bootstrap.sh - Modify the configuration file (project-build.jam) to use the ARM toolchain by replacing the line with “using gcc” by:
1using gcc : arm : arm-linux-gnueabi-g++ ; - Install the python development package:
1sudo apt-get install python-dev - Build and install the boost libraries:
1./bjam install toolset=gcc-arm --prefix=~/edev/beagleboard/libs --disable-long-double -sNO_ZLIB=1 -sNO_BZIP2=1
This was tested in Ubuntu 11.04 (natty) and 10.04 LTS with linaro g++ toolchain.
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress
Hello,I am following your step cross compile boost for mips.
I have some questions:
1.The last step is to ./bjam install toolset=gcc-arm….
I don’t know how to set toolset in my environment,I use mips64-octeon-linux-gnu-g++/gcc.I try several times use gcc-mips or mips64-octeon-linux-gnu,but it failed.
2.When I execute ./bjam install –prefix=/home/lvrainbow/request-software/octeon-boost -disable-long-double -sNO_ZLIB=1 -sNO_BZIP2=1.
it will have some errors as following:
/usr/include/python2.7/pyconfig.h:6:25: error: pyconfig-64.h: No such file or directory
/usr/include/python2.7/pyport.h:849:2: error: #error “LONG_BIT definition appears wrong for platform (bad gcc/glibc config?).”
Didn’t you met the same errors? help me!!!Thank you very much.
@vincent
Hi Vincent,
1.What’s inside project-build.jam (line with using gcc)?
I suppose it should look like
using gcc : mips : mips64-octeon-linux-gnu-g++ ;
then I guess you may be able to use ./bjam toolset=gcc-mips …
2. The error you get is most probably because you are building on a 32-bit machine for a 64-bit target. Make sure it uses the right python header files for your target
Man you really made my day. I have been working on this since 2 days and nothing worked so far. But your post helped me to finish my problems. I was trying to use eclipse for cross compiling, but boost shared libraries were compiled for intel not arm. This helped me so much. Thank you so much.
@ Yusuf Taş
Great! I’m glad my instructions could help.
@Jean-Luc Aufranc (CNXSoft)
Can you elaborate on how to get the right python header files for my target?
Hi, My question isnt related to ARM. Its cross compilation for CN OCTEON MIPS64 platform. I have written a multithreaded code as cpp file and i am trying to cross compile using: [root@ash Documents]# /usr/local/Cavium_Networks/OCTEON-SDK/tools-gcc-4.3/bin/mips64-octeon-linux-gnu-g++ fourcore_2048bits.cpp -o fourcore_2048bits -lpthread But it gives a list of errors. Here are some of the initial errors: new' cannot appear in a constant-expression error: ISO C++ forbids initialization of member 'M1' error: making 'M1' static invalid in-class initialization of static data member of non-integral type 'long long unsigned int*' new’ cannot appear in a constant-expression ISO C++ forbids initialization of member ‘M2’ error: making… Read more »
@ash
Try to compile your code with g++ first (not the cross-compiler) to see if it can build properly.
@Jean-Luc Aufranc (CNXSoft)
I did that. i have compiled the same program on my host system using g++ and its working fine.
The problem comes when compiling for MIPS64 cavium networks OCTEON platform.
I have been working on it since two days and I can’t proceed.
The problem is solved 🙂
@ash
Great to hear. What was the problem finally and how was it solved?
@Jake
I’m stuck here too. When I try to build it I get an error saying it can’t find arm-linux-gnueabihf/python2.7/pyconfig.h
Hi,
I ask about the file project-build.jam dose not exist in the boost directory i find the project-config.jam and i modefiy the line with “using gcc” by “using gcc : arm : arm-linux-gnueabi-g++ ;”
but i get this message
/bjam install toolset=gcc.arm –prefix=/home/out/boost –disable-long-double -sNO_ZLIB=1 -sNO_BZIP2=1
gcc.arm.jam: No such file or directory
/home/invitee/Bureau/boost_1_47_0/tools/build/v2/build/toolset.jam:38: in toolset.using
rule gcc.arm.init unknown in module toolset.
/home/invitee/Bureau/boost_1_47_0/tools/build/v2/build-system.jam:481: in process-explicit-toolset-requests
/home/invitee/Bureau/boost_1_47_0/tools/build/v2/build-system.jam:562: in load
/home/invitee/Bureau/boost_1_47_0/tools/build/v2/kernel/modules.jam:283: in import
/home/invitee/Bureau/boost_1_47_0/tools/build/v2/kernel/bootstrap.jam:142: in boost-build
/home/invitee/Bureau/boost_1_47_0/boost-build.jam:17: in module scope
Hi, I did whatever written in the first post, but as vincent stated project-build.jam does not exist. Instead I modified project-config.jam, (after installing Linaro Arm gcc toolchain) I observed the following error , (error: Invalid property ‘~’: unknown feature ‘–prefix’.): The output: /home/fercis/boost_1_47_0/tools/build/v2/build/property.jam:328: in validate1 from module property error: Invalid property ‘~’: unknown feature ‘–prefix’. /home/fercis/boost_1_47_0/tools/build/v2/build/property.jam:337: in property.validate from module property /home/fercis/boost_1_47_0/tools/build/v2/build/build-request.jam:216: in convert-command-line-element from module build-request /home/fercis/boost_1_47_0/tools/build/v2/build/build-request.jam:153: in build-request.from-command-line from module build-request /home/fercis/boost_1_47_0/tools/build/v2/build-system.jam:612: in load from module build-system /home/fercis/boost_1_47_0/tools/build/v2/kernel/modules.jam:283: in import from module modules /home/fercis/boost_1_47_0/tools/build/v2/kernel/bootstrap.jam:142: in boost-build from module /home/fercis/boost_1_47_0/boost-build.jam:17: in module scope from module Do you have any… Read more »
@fercis
That’s because WordPress converted double dash “- -” into single dash “-“.
So you should write something like “- -prefix”, without space.
I’ve updated the post for that.
Can someone help me on how to install boost in my arm-linux-gnueabi ? i am trying with boost 1.53 now and i can’t do it
I download version 1.59. At step 3, I have the following error. Bootstrapping the build engine with toolset gcc… Failed to bootstrap the build engine Consult ‘bootstrap.log’ for more details The log file is as follows. What’s the potential issue at here? Thanks! ### ### Using ‘gcc’ toolset. ### rm -rf bootstrap mkdir bootstrap gcc -o bootstrap/jam0 command.c compile.c constants.c debug.c execcmd.c frames.c function.c glob.c hash.c hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c object.c option.c output.c parse.c pathsys.c regexp.c rules.c scan.c search.c subst.c timestamp.c variable.c modules.c strings.c filesys.c builtins.c class.c cwd.c native.c md5.c w32_getreg.c modules/set.c modules/path.c modules/regex.c modules/property-set.c modules/sequence.c… Read more »