LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 678|回复: 3

请教LFS7.0 编译gcc第二遍的问题

[复制链接]
发表于 2011-12-20 16:25:25 | 显示全部楼层 |阅读模式
本人新手,宿主机是CentOS5.4,内核版本是2.6.24.4,按照LFS-BOOK-7.0跑一边流程(LFS7.0要求内核版本是2.6.25以上,我觉得差别不大,就直接用现成的2.6.24.4了)。

我在第二遍编译GCC的时候出错了,在这之前的工具链调整那一步,我测试的结果是对的:
echo 'main(){}' > dummy.c
$LFS_TGT-gcc -B/tools/lib dummy.c
readelf -l a.out | grep ': /tools'
输出的是[Requesting program interpreter: /tools/lib/ld-linux.so.2]
------------------------------------------------------------------
接下来进行第二遍gcc的编译,首先处理config
CC="$LFS_TGT-gcc -B/tools/lib/" \
AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib \
    ../gcc-4.6.1/configure --prefix=/tools \
    --with-local-prefix=/tools --enable-clocale=gnu \
    --enable-shared --enable-threads=posix \
    --enable-__cxa_atexit --enable-languages=c,c++ \
    --disable-libstdcxx-pch --disable-multilib \
    --disable-bootstrap --disable-libgomp \
    --without-ppl --without-cloog \
    --with-mpfr-include=$(pwd)/../gcc-4.6.1/mpfr/src \
    --with-mpfr-lib=$(pwd)/mpfr/src/.libs

生成Makefile后,执行make,出错:

checking whether build environment is sane... checking for C compiler default ou                                                                                                 tput file name... a.out
checking whether the C compiler works... configure: error: in `/mnt/lfs/gcc-buil                                                                                                 d/i686-pc-linux-gnu/libiberty':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.
make[1]: *** [configure-target-libiberty] Error 1

----------------------------------------------------------------
查看config.log,发现找到的gcc是/usr/bin/gcc
configure:3929: checking for gcc
configure:3945: found /usr/bin/gcc
configure:3956: result: gcc
我的理解是这一遍编译gcc的时候,应该是用之前生成的$LFS_TGT-gcc来编译吧,但是手册里也没有什么时候说改变了gcc的值,而只是使用CC=$LFS_TGT-gcc来取得新的值,但是gcc的源码里面有些Makefile里就是直接定义CC=gcc,所以这个时候还是会使用系统的/usr/bin/gcc而不是$LFS_TGT-gcc。
我看了网上别人贴出的config.log,http://www.linuxquestions.org/qu ... ed-programs-915233/
里面找到的gcc为什么能是
configure:3919: checking for gcc
configure:3946: result: i686-lfs-linux-gnu-gcc -B/tools/lib/
呢?
----------------------------------------------------------------
这是为什么呢?求大神指导
发表于 2012-2-4 21:06:20 | 显示全部楼层
真的可以不理会宿主系统的最低要求吗……
回复 支持 反对

使用道具 举报

发表于 2012-2-6 19:07:16 | 显示全部楼层
我刚前几天做完了lfs7.0,没出什么问题阿

你的问题等高手来回答把

推荐你先看看youbest的手把手,会提高成功率的
回复 支持 反对

使用道具 举报

发表于 2012-2-7 14:52:18 | 显示全部楼层
的确是版本最低要求,我用LFS 6.3 LiveCD报了一样的错误,内核版本低。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表