---------- Forwarded message ----------
From: John Davis <davisjf@gmail.com>
Date: Thu, Oct 23, 2014 at 12:18 PM
Subject: Attempting to build boost with a cross compiler
To: boost-build@lists.boost.org


Hello

I sent a similar message to boost-users, before I learned of this particular list.  Perhaps this is more approrpriate forum.

Here is a script I'm trying to use to build boost with a cross compiler for arm.

Im using this page as a guide:
http://www.boost.org/doc/libs/1_56_0/more/getting_started/unix-variants.html#easy-build-and-install

My script below does not get any errors, but I also don't have any .a or .so files being generated.

-------------------
#!/bin/bash


# 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 ;


# 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



# In this stage, we are using the host compiler.

# 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 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


# 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 will find the cross compiler for those who  use the prefix, ie. arm-linux-gnueabi-gcc
export PATH=/opt/arm/usr/local/bin:$PATH
# this will set the cross compiler prefix for those who use it
export CROSS_COMPILE=arm-linux-gnueabi-


# build boost.build so that we can build boost or are we building boost at this point?
#
# 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

# hmm. I did not get any .a or .so after that last step. Try to add a install parameter.
./b2 --toolset=gcc-4.3arm --prefix=/opt/xxx/boost  --build-type=complete
# hmm. I did not get any .a or .so after that last step. Try to add a install parameter.
./b2 --toolset=gcc-4.3arm --prefix=/opt/xxx/boost  install


# at this point, we have the cross compiler in our path first.  We are good to go for building our code using boost
# with the cross compiler.

-----------------------------------


--
John F. Davis
6 Kandes Court
Durham, NC 27713

独树一帜





--
John F. Davis
6 Kandes Court
Durham, NC 27713
919-888-8358

独树一帜