Boost logo

Boost Users :

Subject: [Boost-users] using boost in cross compiler environment. intel host and arm target
From: John Davis (davisjf_at_[hidden])
Date: 2014-10-22 15:37:19


Hello

I have some code for arm which I would like to use with boost. The boost
libraries I am interested in are not header only and thus require building.

I have downloaded the boost tarfile and I have read the following two
webpages relative but I am still confused. Here is a summary of the two
urls and where I am confused.

http://www.boost.org/doc/libs/1_56_0/more/getting_started/

This url has the following procedure which seems to use the host default
compiler to build boost.

Easy Method for Building and Installing Boost Binary Libraries.

step 1: $ cd $BOOST_DIR

step 2: $ ./bootstrap.sh --help

step 3: $ ./bootstrap.sh --prefix=path/to/installation/prefix

(

Other docs specify for this step:

$ ./b2 --build-dir=/tmp/build-boost toolset=gcc stage (optional
--build-type=complete)

Also says that
--stagedir=/path/to/install/special/stage/target/library/binaries

I'm not certain what the stage components are or what the stage part is.
)

$ ./b2 install “This will leave Boost binaries in the lib/ subdir of the
installation prefix.”

The only customization mentioned here is for where you want your results to
be placed.

step 4: Add path/to/installation to my $PATH environment variable.

http://www.boost.org/doc/libs/1_51_0/doc/html/bbv2/tasks.html#bbv2.tasks.crosscompile

The section is on common tasks for boost build, in particular in the
section is task on cross compilation.

Boost.Build supports cross compilation with gcc toolset.

When using gcc, you first need to specify your cross compiler in
user-config.jam for example:

using gcc : arm : arm-none-linux-gnueabi-g++;

This looks good, i'm thinking I need to edit a user-config.jam file.

After that, if the host and target os are the same, for example linux, you
can just repeat this compiler version to be used:

b2 toolset=gcc-arm

Regarding the user-config.jam file. These are the notes I took while
reading:

http://www.boost.org/doc/libs/1_51_0/doc/html/bbv2/overview.html#bbv2.overview.configuration

On startup, boost.build searches and reads two config files:
site-config.jam and user-config.jam. Alternatively, the docs say you can
edit the one at the top of the boost.build directory. In my case, I
believe that would be $BOOST_DIR/tools/build/v2 directory rather than
$BOOST_DIR. This directory has five .jam files: boost-build.jam,
bootstrap.jam, build-system.jam, Jamroot.jam, site-config.jam and
user-config.jam.

Then I started thinking maybe editing this file will build boost.build for
running on arm. I don't want to run boost.build on arm. I want it to use
the cross compiler to build boost so that the libs will work with code that
runs on arm.

Summary, this is what I think I need to do. Please correct me where I am
wrong.

1. using the tarfile I've downloaded, copy the
$BOOST_DIR/tools/build/v2/user-config.jam file to my /home/davis directory.
2. edit the ~/user-config.jam file (I wish I could put this file in the
$BOOST_DIR tree rather than my home dir) to use the cross compilers I have
in my /opt/arm directory.
3. With the /opt/arm/ compiler directory in my path and in the
$BOOST_DIR/tools/build/v2 directory issue the commands to build boost
3.a. $ ./bootstrap.sh --prefix=path/to/installation/prefix
--with-toolset=gcc-arm
3.b this should add a b2 program in the path/to/installation/prefix dir.
/path/to/installation/prefix will actually be /opt/arm/boot.build. This
should have the boost build tool I build that runs on intel but is set to
build boost for arm.
4. Change directory to $BOOST_DIR
4.a $ /path/to/installation/prefix/b2 --build-dir=/tmp/build-boost
toolset=gcc-arm or literally /opt/arm/boot.build/bin?/b2
-build-dir=/tmp/build-boost toolset=gcc-arm
4.c $ /path/to/installtion/prefix/b2 install

-- 
John F. Davis
6 Kandes Court
Durham, NC 27713
919-888-8358
独树一帜


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net