独立制作arm-linux-toolchains

 之前一直按照《构建嵌入式LINUX系统》书中的提示,编译 glibc头文件,但是总是出现以下错误:
一):glibc头文件编译错误
root@sll:/home/sll/dirver-project/build-tools/build-glibc-headers# ../glibc-2.7/configure --host=$TARGET --prefix="/usr" --enable-add-ons --with-headers=$TARGET_PREFIX/include

running configure fragment for nptl/sysdeps/pthread
checking for forced unwind support... no
configure: error: forced unwind support is required

在网上找了两天的资料,也没有弄明白,今天来了找到一份资料,说可能 nptl/sysdeps/pthread/configure的版本问题,看了看该文件,明白了config.cache中设置 echo "libc_cv_forced_unwind=yes" > config.cache和 echo libc_cv_c_cleanup=yes" >> config.cache 的原因,所以今天又仔细加了--cache-files=config.cache选项,并指定了CC=gcc 结果意料不到的是configure通过,真是太高兴了,之后又重新几次,都顺利通过 . 几次试验发现,必须指定CC=gcc,如果不指定,configure不能通过。
 
后来经过仔细琢磨,觉得CC=arm-linux-gcc才对,更改之后,重新make distclean,重新写了config.cache,configure顺利通过,应该讲config.cache文件才是重要的,以前编译失败,可能是将 --cache-file=config.cache写成了--cache-files=config.cache,所以相当于这个参数没有通过。


二):编译GCC时(make all-gcc)时,第一次编译通过,需要大概一小时左右时间,可是第二天确怎么也编译不能通过,总是报告错误:error:/build/genmodes:no such file or directory,后来查了大量资料,折腾了两天,在一篇英文的帖子中看到:可能在GCC的源文件中执行了MAKE命令,想想也可能,因为刚开始上手的时候对这个概念还不是很明确,所以将GCC整个目录删除,重新解压,重新编译,在经过一小时的等待后,果然看到我喜欢的结果,顺利通过。

三):glibc编译问题,在编译glibc2.7的时候,出现错误:../limits.h:125:26:error:no include path in which to search for limits.h,在google上搜索发现
GCC 4.3 added an include-fixed directory and moved limits.h and syslimits.h there [3]. Compiling GLIBC 2.7 (or prior) with GCC 4.3 will require these [4] patches to work.  ,也就是说glibc2.7和gcc4.3配合需要对glibc打patch,否则会出现上述错误。原来gcc4.3将一部分头文件放到另一个文件夹中,原来全都在文件夹include里,现在limits.h和其他几个头文件被放到了include-fixed里,glibc就找不到了,要将glibc的configure文件改一下:
sed -i -e "/ccheaders=/s@/`/(/$CC.*include/)/`@/"& -isystem /`/1-fixed/`/"@" configure ,修改之后这个错误消失了,这个困扰我近2周的问题终于解决了,太高兴了啊!

这是这个问题的diff文件:

RCS file: /cvs/glibc/libc/configure.in,v
retrieving revision 1.468
diff -u -r1.468 configure.in
--- configure.in 17 Mar 2007 17:01:46 -0000 1.468
+++ configure.in 18 Mar 2007 20:35:03 -0000
@@ -912,7 +912,7 @@
# thing on a system that doesn't need fixincludes. (Not presently a problem.)
if test -n "$sysheaders"; then
ccheaders=`$CC -print-file-name=include`
- SYSINCLUDES="-nostdinc -isystem $ccheaders /
+ SYSINCLUDES="-nostdinc -isystem $ccheaders -isystem $ccheaders-fixed /
-isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
if test -n "$CXX"; then
cxxversion=`$CXX -dumpversion 2>&AS_MESSAGE_LOG_FD` &&
但是如果简单用gedit configure.in打开,直接修改
SYSINCLUDES="-nostdinc -isystem $ccheaders -isystem $ccheaders-fixed 该句内容是不行的,修改后make还是提示同样的问题
所以最后sed -i -e "/ccheaders=/s@/`/(/$CC.*include/)/`@/"& -isystem /`/1-fixed/`/"@" configure在终端执行后问题解决,虽然我现在还不懂这句话的意思。!

四:)又产生了一个问题:../sysdeps/ieee754/dbl-64/s_copysign.c:27: error: redefinition of '__copysign'
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值