Chinaunix首页 | 论坛 | 博客
  • 博客访问: 292962
  • 博文数量: 60
  • 博客积分: 1836
  • 博客等级: 上尉
  • 技术积分: 540
  • 用 户 组: 普通用户
  • 注册时间: 2006-12-15 18:00
文章分类

全部博文(60)

文章存档

2013年(1)

2012年(7)

2011年(18)

2010年(6)

2009年(6)

2008年(3)

2007年(19)

我的朋友

分类: LINUX

2007-02-02 11:13:04

编译这个需要先编译zlib和bzip2

./configure --prefix=安装目录

然后修改Makefile
因为我的cross编译器在/home/arm/local中

BJAM_CONFIG= -sPYTHON_ROOT=/usr -sPYTHON_VERSION=2.3 -sGCC_ROOT_DIRECTORY=/home/arm/local -sGCC=arm-softfloat-linux-gnu-gcc -sGXX=arm-softfloat-linux-gnu-g++ -sGCC_ROOT_DIRECTORY=/home/arm/local -sGCC_BIN_DIRECTORY=/home/arm/local/bin

PREFIX=/home/arm/local
EPREFIX=/home/arm/local
LIBDIR=/home/arm/local/lib
INCLUDEDIR=/home/arm/local/include

然后修改tools/build/v1/gcc-tools.jam
这个文件里有对上面用到的宏的说明

# compute directories for invoking GCC
#
# The gcc toolset can be user-configured using the following
# variables:
#
# GCC_ROOT_DIRECTORY
#       The directory in which GCC was installed. Defaults to
#       unset. Usually, there is no need to set this variable at
#       all. However, if G++ is not in the path it is usually
#       sufficient to configure this one variable. More fine-grained
#       configuration is available by setting the following:
#
# GCC_BIN_DIRECTORY
#       the directory prefix used to find the gcc executables. Defaults to
#       $(GCC_ROOT_DIRECTORY)/bin/, or "" if GCC_ROOT_DIRECTORY is
#       not set.
#
# GCC_INCLUDE_DIRECTORY
#       the directory in which to find system includes. Defaults to
#       empty.
#
# GCC_STDLIB_DIRECTORY
#       the directory in which to find the standard library
#       objects associated with this build of gcc. Defaults to
#       $(GCC_ROOT_DIRECTORY)/lib.
#
# GXX
#       The name by which g++ is invoked. You can also use this in
#       lieu of setting the property to force options such
#       as "-V3.0.4" into the g++ command line: "-sGXX=g++ -V3.0.4".
#
# GCC
#       Similar to GXX, the name by which gcc is invoked for "C"
#       language targets.

第381行,改了可能会用到
.AR ?= arm-softfloat-linux-gnu-ar ;

# used to manipulate the object files produced by GCC to
# prevent the merging of debug symbols (which happens to be n^2 slow)
if ! ( --no-objcopy in $(ARGV) )
{
    flags gcc .OBJCOPY : [ GLOB $(GCC_BIN_DIRECTORY) $(PATH) : objcopy1 ] ;
}
.OBJCOPY ?= arm-softfloat-linux-gnu-objcopy ;
if ! $(on-windows)


等494行 加了到头文件的目录(包括zlib与bzip2的头文件),可能之前的不对,所以自己加了一下

actions gcc-Cc-action
{
    $(.SET_EXIT)
    "$(.GCC[1]:R=$(GCC_BIN_DIR))" $(.GCC[2-]) -c -Wall -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) -I"$(HDRS)" -I$(_)"$(STDHDRS)" -I$(_)"$(SYSHDRS)" -I/home/arm/local/include -o "$(<)" "$(>)"
    "$(.OBJCOPY[1])"$(_)$(OBJCOPY_FLAGS)$(_)"$(<)"
}

#### C++ ####
rule C++-action
{
    gcc-spawn $(<) ;
    _ on $(<) = " " ;
    gcc-C++-action $(<) : $(>) ;
}

actions gcc-C++-action
{
    $(.SET_EXIT)
    "$(.GXX[1]:R=$(GCC_BIN_DIR))" $(.GXX[2-]) -c -Wall -ftemplate-depth-255 -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) $(C++FLAGS) -I"$(HDRS)" -I$(_)"$(STDHDRS)" -I$(_)"$(SYSHDRS)" -I/home/arm/local/include -o "$(<)" "$(>)"
    "$(.OBJCOPY[1])"$(_)$(OBJCOPY_FLAGS)$(_)"$(<)"
}

然后make && make install 就行了

阅读(6817) | 评论(3) | 转发(0) |
给主人留下些什么吧!~~

steprun2008-05-05 20:06:24

你需要把boost 的源代码重新编译一遍,因为你要做的是交叉编译

steprun2008-05-05 20:05:06

boost 1.33

chinaunix网友2008-03-17 11:29:24

你好,很高兴在网上能够看到你这篇文章。因为我最近也需要做这件事情。 按照你的修改,我在交叉编译boost的过程还是提示很多objcopy 无法识别文件格式的错误提示:Unable to recognise the format of the input file ...... 我的目的是需要在arm-linux中使用boost。但是直接将x86-linux Fedora自带的boost拷贝过去时,编译我的程序就提示boost头文件定义冲突的错误。 拜托阁下能够给予指点。多谢!