Boost logo

Boost-Build :

Subject: Re: [Boost-build] Fwd: Attempting to build boost with a cross compiler
From: Jürgen Hunold (jhunold_at_[hidden])
Date: 2014-10-23 16:17:16

Hi John,

Am Donnerstag, 23. Oktober 2014, 12:29:21 schrieb John Davis:
> ---------- Forwarded message ----------
> I sent a similar message to boost-users, before I learned of this
> particular list. Perhaps this is more approrpriate forum.

Well, boost-users is usually more suited.

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

edit /opt/xxx/yyy/boost/boost_1_51_0/project-config.jam instead.

using gcc : 4.3arm : arm-linux-gnueabi-g++ : <architecture>arm ;

should normally work.

Generally, add "--debug-configuration" to the "b2" step below to get
diagnostics which configuration files are really loaded and from where. It also
displays more information about the toolset configuration.

> # 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/bi
> n:/opt/java6/jre/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_p
> erl

PATH is mostly irrelevant. Exceptions are complicated toolchain using icecc,
distcc, ccache or other compiler wrappers.

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

Does no harm

> # 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.
> ./ --with-toolset=gcc

--with-toolset=gcc can be omitted, gcc is used by default
> # 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-

No used by Boost.Build at all.

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

Why don't you use the staged libraries in
/opt/xxx/yyy/boost/boost_1_51_0/stage/lib and omit the "install" step?

> ./b2 --toolset=gcc-4.3arm --prefix=/opt/xxx/boost

First grave error. "./b2 toolset=gcc-4.3arm" will use the cross-compiler. b2
has three types of commandline arguments for the three build system layers,
"toolset" is one without dashes at all. Quite surprising sometimes...

> # hmm. I did not get any .a or .so after that last step.

Then please add some (zipped) output. Hard to guess what happened exactly.

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

The remaining command won't work due to the same reason.

Hope this helps,



* Dipl.-Math. Jürgen Hunold  ! 
* voice: ++49 4257 300       ! Fährstraße 1
* fax  : ++49 4257 300       ! 31609 Balge/Sebbenhausen
*             ! Germany

Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at