|
本人新手,宿主机是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/
呢?
----------------------------------------------------------------
这是为什么呢?求大神指导 |
|