|
原有系统
linux fc6
gcc version 4.1.1
lfs:
binutils-2.16.1
gcc-4.0.2
我完成 lfs 5.7章 调整工具链
测试
echo 'main(){}' > dummy.c
cc dummy.c
readelf -l a.out | grep ': $LFS/tools'
[Requesting program interpreter: /tools/lib/ld-linux.so.2]
一切正常
然后在GCC-4.0.2 - 第二遍 时出现问题, 提示mpfr没有
运行
../gcc-4.0.2/configure --prefix=$LFS/tools \
--with-local-prefix=$LFS/tools --enable-clocale=gnu \
--enable-shared --enable-threads=posix \
--enable-__cxa_atexit --enable-languages=c,c++ \
--disable-libstdcxx-pch
提示
checking for correct version of gmp.h... yes
checking for MPFR... no
*** This configuration is not supported in the following subdirectories:
target-libada target-libgfortran target-libffi target-boehm-gc target-zlib target-libjava zlib fastjar target-libobjc
(Any other directories should still work fine.)
执行 make
checking for i686-pc-linux-gnu-gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.
make: *** [configure-fixincludes] Error 1
查看sources/gcc-build/config.log,提示cannot find -lmpfr
configure:2284: checking for MPFR
configure:2297: gcc -o conftest -g -O2 conftest.c -lmpfr -lgmp 1>&5
/mnt/lfs/tools/lib/gcc/i686-pc-linux-gnu/4.0.2/../../../../i686-pc-linux-gnu/bin/ld: cannot find -lmpfr
collect2: ld returned 1 exit status
configure: failed program was:
#line 2289 "configure"
#include "confdefs.h"
#include <gmp.h>
#include <mpfr.h>
int main() {
mpfr_t n; mpfr_init(n);
; return 0; }
查看sources/gcc-build/fixincludes/config.log,提示 a.out: No such file or directory
gcc (GCC) 4.0.2
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
configure:1746: $? = 0
configure:1748: gcc -v </dev/null >&5
Reading specs from /mnt/lfs/tools/lib/gcc/i686-pc-linux-gnu/4.0.2/specs
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.0.2/configure --prefix=/mnt/lfs/tools --with-local-prefix=/mnt/lfs/tools --disable-nls --enable-sha
red --enable-languages=c
Thread model: posix
gcc version 4.0.2
configure:1751: $? = 0
configure:1753: gcc -V </dev/null >&5
gcc: '-V' option must have argument
configure:1756: $? = 1
configure:1779: checking for C compiler default output file name
configure:1782: gcc -g -O2 conftest.c >&5
configure:1785: $? = 0
configure:1831: result: a.out
configure:1836: checking whether the C compiler works
configure:1842: ./a.out
/mnt/lfs/sources/gcc-4.0.2/fixincludes/configure: line 1843: ./a.out: No such file or directory
configure:1845: $? = 127
configure:1854: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.
这时发现一个问题
lfs:/mnt/lfs/sources$ echo 'main(){}' > dummy.c
lfs:/mnt/lfs/sources$ cc dummy.c
lfs:/mnt/lfs/sources$ readelf -l a.out | grep ': $LFS/tools'
[Requesting program interpreter: $LFS/tools/lib/ld-linux.so.2]
lfs:/mnt/lfs/sources$ ./a.out
bash: ./a.out: No such file or directory
找不到a.out
可是ls 可以看到a.out文件
lfs:/mnt/lfs/sources$ ls -l
total 62180
-rwxr-xr-x 1 lfs lfs 7652 May 21 11:53 a.out
-rw-r--r-- 1 lfs lfs 9 May 21 11:53 dummy.c
drwxr-xr-x 22 lfs lfs 4096 May 21 11:45 gcc-4.0.2
-rwxr-Sr-t 1 root root 14802 May 20 16:01 gcc-4.0.2-specs-1.patch
-rwxr-Sr-t 1 root root 31793160 May 20 11:08 gcc-4.0.2.tar.bz2
drwxr-xr-x 3 lfs lfs 4096 May 21 11:49 gcc-build
-rwxr-Sr-t 1 root root 2221 May 20 13:23 glibc-2.3.6-static-nss-fix-shy-1.patch
-rwxr-Sr-t 1 root root 14014977 May 20 13:22 glibc-2.3.6.tar.bz2
drwxr-xr-x 15 lfs lfs 4096 Sep 11 2007 gmp-4.2.2
-rwxr-Sr-t 1 root root 1747068 May 20 18:12 gmp-4.2.2.tar.bz2
drwxr-xr-x 2 lfs lfs 4096 May 20 18:17 gmp-build
-rwxr-Sr-t 1 root root 2539721 May 20 13:16 linux-libc-headers-2.6.12.0.tar.bz2
lfs:/mnt/lfs/sources$ which gcc
/mnt/lfs/tools/bin/gcc
lfs:/mnt/lfs/sources$ which cc
/mnt/lfs/tools/bin/cc
lfs:/mnt/lfs/sources$ which ld
/mnt/lfs/tools/bin/ld
lfs:/mnt/lfs/sources$ which ldd
/mnt/lfs/tools/bin/ldd
新开一个终端,root用户, 仍然不行
[root@zebecpc sources]# ./a.out
-bash: ./a.out: No such file or directory
[root@zebecpc sources]# ls -l
total 62180
-rwxr-xr-x 1 lfs lfs 7652 May 21 11:53 a.out
-rw-r--r-- 1 lfs lfs 9 May 21 11:53 dummy.c
drwxr-xr-x 22 lfs lfs 4096 May 21 11:45 gcc-4.0.2
-rwxr-Sr-t 1 root root 14802 May 20 16:01 gcc-4.0.2-specs-1.patch
-rwxr-Sr-t 1 root root 31793160 May 20 11:08 gcc-4.0.2.tar.bz2
drwxr-xr-x 3 lfs lfs 4096 May 21 11:49 gcc-build
-rwxr-Sr-t 1 root root 2221 May 20 13:23 glibc-2.3.6-static-nss-fix-shy-1.patch
-rwxr-Sr-t 1 root root 14014977 May 20 13:22 glibc-2.3.6.tar.bz2
drwxr-xr-x 15 lfs lfs 4096 Sep 11 2007 gmp-4.2.2
-rwxr-Sr-t 1 root root 1747068 May 20 18:12 gmp-4.2.2.tar.bz2
drwxr-xr-x 2 lfs lfs 4096 May 20 18:17 gmp-build
-rwxr-Sr-t 1 root root 2539721 May 20 13:16 linux-libc-headers-2.6.12.0.tar.bz2
然后我用root用户执行
[root@zebecpc sources]# rm -rf dummy.c a.out
[root@zebecpc sources]# echo 'main(){}' > dummy.c
[root@zebecpc sources]# cc dummy.c
[root@zebecpc sources]# ./a.out
可以运行
切换回lfs用户,执行root用户编译的a.out文件
lfs:/mnt/lfs/sources$ ./a.out
lfs:/mnt/lfs/sources$
没有问题
大家帮我看看,mpfr是否可以不用,怎么关掉它?
a.out找不到是什么原因? 感觉lfs用户编译的a.out有问题
这两个问题有关系吗?
谢谢 |
|