views:

433

answers:

1

I'm trying to setup Boost 1.42 in our system. I need Boost to compile for the regular x86 architecture with gcc and I need cross compilation for an ARM processor of Texas Instruments.

The toolchain for the ARM processor is based on gcc. The tools like gcc, ar, ranlib are all prefixed with arm_v5t_le-. The documentation about cross compiling is somewhat limited. Here is what I have done: I have added the following to the user-config.jam file: using gcc : arm : arm_v5t_le-g++ ; Bjam is invoked from our Makefile like this: bjam toolset=gcc-arm --toolset-root=/opt/mv_pro_4.0/montavista/pro/devkit/arm/v5t_le/bin <some other options> to compile for the ARM processor, and like this: bjam toolset=gcc <some other options> for the x86 processor. The option --toolset-root is mentioned here.

I ran into the following problem: When I build our application for the ARM processor I get the following linker error: libboost_system-mt.a: could not read symbols: Archive has no index; run ranlib to add one. After I ran arm_v5t_le-ranlib on the archive it links without problems. My guess is that bjam uses ar in stead of arm-v5t_le-ar. How do I tell bjam which archiver it should use?

On a mailing list it was said to specify <archiver> in user-config.jam as well, but unfortunately it does not seem to work. I end up with the same linker error.

Thanks.

+2  A: 

Try the CMake-based build of Boost, that might be able to do cross-platform builds better than BJam can. At least I have had success with that (but I never tried ARM).

Tronic
Thank you very much. Boost with cmake is just great! Setting up cross compilation is a piece of cake now.
André
Am I right that with CMake, one would have to setup a "toolchain file", as documented at http://www.itk.org/Wiki/CMake_Cross_Compiling ?
Vladimir Prus
Yes, that is what I have done.My toolchainfile contains the following:SET(CMAKE_SYSTEM_NAME Montavista)SET(CMAKE_C_COMPILER arm_v5t_le-gcc)SET(CMAKE_CXX_COMPILER arm_v5t_le-g++)
André