Cross Compiling Boost C++ Libraries for ARM

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++:

  1. Download the source code:
  2. Extract the source code:
  3. Bootstrap the code:
  4. Modify the configuration file (project-build.jam) to use the ARM toolchain by replacing the line with “using gcc” by:
  5. Install the python development package:
  6. Build and install the boost libraries:

This was tested in Ubuntu 11.04 (natty) and 10.04 LTS with linaro g++ toolchain.

16
Leave a Reply

avatar
16 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
10 Comment authors
s. wuTheDiDfercisvincentRune K. Svendsen Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
vincent
Guest
vincent

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.

Yusuf Taş
Guest

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.

Jake
Guest
Jake

@cnxsoft
Can you elaborate on how to get the right python header files for my target?

ash
Guest
ash

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:

[[email protected] 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 ‘M2’ static
error: invalid in-class initialization of static data member of non-integral type ‘long long unsigned int*’
error: `new’ cannot appear in a constant-expression
error: ISO C++ forbids initialization of member ‘ciphertext’
error: making ‘ciphertext’ static
error: invalid in-class initialization of static data member of non-integral type ‘long long unsigned int*’

I have tried doing with the c++ utility as well but it keeps giving the same errors:

[[email protected] Documents]# /usr/local/Cavium_Networks/OCTEON-SDK/tools-gcc-4.3/bin/mips64-octeon-linux-gnu-c++ fourcore_2048bits.cpp -o fourcore_2048bits -lpthread

can you please please tell me where i am wrong? i am new to linux and programming.

ash
Guest
ash

@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.

ash
Guest
ash

The problem is solved 🙂

Rune K. Svendsen
Guest

@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

vincent
Guest
vincent

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

fercis
Guest
fercis

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 comments?
Thank you, best regards,
fercis

TheDiD
Guest
TheDiD

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

s. wu
Guest
s. wu

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 modules/order.c execunix.c fileunix.c pathunix.c
./bootstrap/jam0 -f build.jam –toolset=gcc –toolset-root= clean
…found 1 target…
…updating 1 target…
…updated 1 target…
./bootstrap/jam0 -f build.jam –toolset=gcc –toolset-root=
don’t know how to make command.c
don’t know how to make compile.c
don’t know how to make constants.c
don’t know how to make debug.c
don’t know how to make execcmd.c
don’t know how to make frames.c
don’t know how to make function.c
don’t know how to make glob.c
don’t know how to make hash.c
don’t know how to make hcache.c
don’t know how to make headers.c
don’t know how to make hdrmacro.c
don’t know how to make jam.c
don’t know how to make jambase.c
don’t know how to make jamgram.c
don’t know how to make lists.c
don’t know how to make make.c
don’t know how to make make1.c
don’t know how to make mem.c
don’t know how to make object.c
don’t know how to make option.c
don’t know how to make output.c
don’t know how to make parse.c
don’t know how to make pathsys.c
don’t know how to make regexp.c
don’t know how to make rules.c
don’t know how to make scan.c
don’t know how to make search.c
don’t know how to make subst.c
don’t know how to make w32_getreg.c
don’t know how to make timestamp.c
don’t know how to make variable.c
don’t know how to make modules.c
don’t know how to make strings.c
don’t know how to make filesys.c
don’t know how to make builtins.c
don’t know how to make class.c
don’t know how to make cwd.c
don’t know how to make native.c
don’t know how to make md5.c
don’t know how to make modules/set.c
don’t know how to make modules/path.c
don’t know how to make modules/regex.c
don’t know how to make modules/property-set.c
don’t know how to make modules/sequence.c
don’t know how to make modules/order.c
don’t know how to make execunix.c
don’t know how to make fileunix.c
don’t know how to make pathunix.c
…found 53 targets…
…updating 1 target…
…can’t find 49 targets…
…can’t make 2 targets…
[MKDIR] bin.linuxx86
mkdir: cannot create directory ‘bin.linuxx86’: File exists

mkdir “bin.linuxx86”

…failed [MKDIR] bin.linuxx86…
…skipped b2 for lack of command.c…
…skipped bjam for lack of b2…
…failed updating 1 target…
…skipped 2 targets…