Boost logo

Boost-Build :

From: Vladimir Michl (vladimir.michl_at_[hidden])
Date: 2006-01-14 11:07:01


Hi all in this list,

recently I was put into task to cross compile boost for ARM platform
with GCC.

My building platform is i386 Linux with gcc and cross compiling to arm
Linux.

Standard way for this kind of compilation is, that name of cross
compiler (running under i386 but producing arm code) and all cross
binary utilities are prefixed by target plarform, so like arm-linux-gcc,
arm-linux-g++, arm-linux-ar, arm-linux-objcopy for arm-linux.

And this is causing a bit of problem with boost.

I can force GCC and GXX, but still have a problem with ar and objcopy.

I've tried to setup GCC_BIN_DIRECTORY but it didn't work.

So I've done a small patch to tools/build/v1/gcc-tools.jam adding
GCC_PREFIX variable, that if set up, will prefix names of all tools with
that prefix.

So I can compile boost with

bjam -sTOOLS=gcc -sGCC_PREFIX=arm-linux- stage

May be it will be useful to add the same functionality to
gcc-stlport-tools.jam or mingw.

It is possible to include them into next boost release?

By the way, the same problem appears when boost jam is used to compile
some third-party libraries. Jambase file doesn't easily support cross
compilation with gcc I can supply some ideas how to change Jambase file
as well.

Vlad

PS: Attached are changes to gcc-tools.jam

*** gcc-tools.jam~ 2004-10-19 16:12:58.000000000 +0100
--- gcc-tools.jam 2006-01-14 16:02:57.511154616 +0000
***************
*** 41,46 ****
--- 41,50 ----
  # GCC
  # Similar to GXX, the name by which gcc is invoked for "C"
  # language targets.
+ # GCC_PREFIX
+ # Prefix of command names. Useful for cross-compiling.
+
+ GCC_PREFIX ?= "" ;
  
  # singleton variables...
  set-as-singleton GCC_ROOT_DIRECTORY GCC_BIN_DIRECTORY
GCC_INCLUDE_DIRECTORY GCC_STDLIB_DIRECTORY ;
***************
*** 300,306 ****
--- 304,312 ----
  
  #
  # define compiler names if not set:
+ .GCC ?= $(GCC_PREFIX)gcc ;
  .GCC ?= gcc ;
+ .GXX ?= $(GCC_PREFIX)g++ ;
  .GXX ?= g++ ;
  
  
***************
*** 357,368 ****
  
  # allow for "ar" to be part of the compiler distribution, for
  # example in mingw and cygwin
! flags gcc .AR : [ GLOB $(GCC_BIN_DIRECTORY) $(PATH) : ar ar.exe ] ;
  .AR ?= ar ;
  
  # used to manipulate the object files produced by GCC to
  # prevent the merging of debug symbols (which happens to be n^2 slow)
! flags gcc .OBJCOPY : [ GLOB $(GCC_BIN_DIRECTORY) $(PATH) : objcopy ] ;
  
  if ! $(on-windows)
  {
--- 363,374 ----
  
  # allow for "ar" to be part of the compiler distribution, for
  # example in mingw and cygwin
! flags gcc .AR : [ GLOB $(GCC_BIN_DIRECTORY) $(PATH) : $(GCC_PREFIX)ar
ar.exe ] ;
  .AR ?= ar ;
  
  # used to manipulate the object files produced by GCC to
  # prevent the merging of debug symbols (which happens to be n^2 slow)
! flags gcc .OBJCOPY : [ GLOB $(GCC_BIN_DIRECTORY) $(PATH) :
$(GCC_PREFIX)objcopy ] ;
  
  if ! $(on-windows)
  {

-- 
Vladimir Michl <vladimir.michl_at_[hidden]>, ICQ# 312939054
Tel: +447793527010
     +447906361574
     +420608413590

Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk