"John Davis"
Here is a more succient attempt at building boost with a cross compiler. It appears to work. I'm not certain if it works at this point though. Please take a look and comment. Here is the script: ... # edit /opt/xxx/yyy/boost/boost_1_51_0/tools/build/v2/user-config.jam to add the following line # using gcc : 4.3arm : arm-linux-gnueabi-g++ : <architecture>arm <target-os>linux ;
I don't know if that file is used. It's recommended to put the user-config.jam file in your home directory. If you don't want to do that, you can specify the path to the file to b2 with "--user-config=/path/to/user-config.jam".
# Later we modify path, make sure our path does not use the cross compiler at beginning export PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/java6/bin:/opt/java6/db/bin:/opt/java6/jre/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
This is not necessary.
# setup env variable for $BOOST_DIR # I'm not sure if this is being used, but set it just in case. export BOOST_ROOT=/opt/xxx/yyy/boost/boost_1_51_0
This is not necessary.
# this is run from $BOOST_DIR/tools/build/v2 aka /opt/xxx/yyy/boost/boost_1_51_0/tools/build/v2 # in this case, I do not think you invoke the cross compiler. I think at this point, you are building # code for the host development machine. ./bootstrap.sh --with-toolset=gcc
You are mixing different parts of the getting started instructions in a bad way. I would suggest ignoring the instructions to "Install Boost.Build". You should use boostrap.sh in the boost root (boost_1_51_0 in this case). It builds b2, copies it to the boost root and creates a project-config.jam file there.
# setup path so that gcc from cross compiler is first in the path # also specify cross_compiler env variable in case its used. # # this will find the cross compiler for those who dont use the prefix, ie. gcc export PATH=/opt/arm/usr/local/arm-linux-gnueabi/bin:$PATH
This is not necessary since you specify the compiler command arm-linux-gnueabi-g++ in the configuration jam file.
# this will find the cross compiler for those who use the prefix, ie. arm-linux-gnueabi-gcc export PATH=/opt/arm/usr/local/bin:$PATH
Good as long as arm-linux-gnueabi-g++ is in that path.
# this will set the cross compiler prefix for those who use it export CROSS_COMPILE=arm-linux-gnueabi-
This is not necessary.
# build boost.build so that we can build boost or are we building boost at this point?
The bootstrap script builds b2. b2 builds other stuff, for example Boost. By default it builds what the files in the current directory tell it to.
# WARNING!!! # Specify an install directory so that it doesn't put the results in /usr/local/bin. # Even if you dont specify install as an option to ./b2 it will attempt to copy files to /usr/bin # in the following step! # /opt/xxx/boost is where we want results. Our code will this dir in order to use boost. # /opt/xxx/yyy/boost/boost_1_51_0 is the top of the boost src. We are building beneath there. ./b2 --toolset=gcc-4.3arm --prefix=/opt/xxx/boost
You're running b2 in the tools/v2 directory. This apparently tries to install stuff related to Boost.Build, which is not what you want. To build Boost, your current directory should be the Boost root directory when you run b2. By default, the compiled libraries are put in stage/lib. The prefix isn't used if you don't specify install. If I put this in ~/user-config.jam: using gcc : arm : arm-linux-gnueabi-g++ ; Running this in the boost root directory appears to work: ./bootstrap.sh ./b2 toolset=arm-gcc --without-python -sNO_BZIP2=1 Regards, Niklas Angare