LinuxSir.cn,穿越时空的Linuxsir!

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

宿主gentoo,安装lfs时gcc报错,5.4,如何解决?

[复制链接]
发表于 2007-2-15 16:54:45 | 显示全部楼层 |阅读模式
具体现象为
  make bootstrap的时候报错,报错如下:

  1. sources/gcc-build $ make bootstrap>/dev/null
  2. /tools/x86_64-unknown-linux-gnu/bin/ld: skipping incompatible /usr/lib/../lib/libc.so when searching for -lc
  3. /tools/x86_64-unknown-linux-gnu/bin/ld: skipping incompatible /usr/lib/../lib/libc.a when searching for -lc
  4. /tools/x86_64-unknown-linux-gnu/bin/ld: skipping incompatible /usr/lib/libc.so when searching for -lc
  5. /tools/x86_64-unknown-linux-gnu/bin/ld: skipping incompatible /usr/lib/libc.a when searching for -lc
  6. /tools/x86_64-unknown-linux-gnu/bin/ld: cannot find -lc
  7. collect2: ld returned 1 exit status
  8. make[3]: *** [32/libgcc_s.so] Error 1
  9. make[2]: *** [stmp-multilib] Error 2
  10. make[1]: *** [stage1_build] Error 2
  11. make: *** [bootstrap] Error 2
复制代码


俺的gentoo x86_64,kernel为:2.6.19.2,gcc为4.1.1,不知道跟这个有关系吗?
cpu: Core 2 DUO T5500
发表于 2007-2-16 03:10:02 | 显示全部楼层
感觉是补丁没打对,我以前也碰过,不过没解决:(。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-2-16 09:08:50 | 显示全部楼层
我又重复来了一次以便详细记录

1、查看gcc和patch
  1. lfs@gentoo /app/sources $ ll |grep gcc
  2. -rw-r--r--  1 lfs  root    14802 Feb 15 14:02 gcc-4.0.3-specs-1.patch
  3. -rw-r--r--  1 lfs  root 32980638 Feb 15 14:02 gcc-4.0.3.tar.bz2
  4. -rw-r--r--  1 lfs  root     1295 Feb 15 14:02 inetutils-1.4.2-gcc4_fixes-3.patch
  5. -rw-r--r--  1 lfs  root     1440 Feb 15 14:02 kbd-1.12-gcc4_fixes-1.patch
  6. -rw-r--r--  1 lfs  root     1228 Feb 15 14:02 tar-1.15.1-gcc4_fix_tests-1.patch
复制代码
2、把gcc-4.0.3解开并打patch
  1. lfs@gentoo /app/sources $ tar xvf gcc-4.0.3.tar.bz2 >/dev/null
  2. lfs@gentoo /app/sources $ cd gcc-4.0.3
  3. lfs@gentoo /app/sources/gcc-4.0.3 $ patch -Np1 -i ../gcc-4.0.3-specs-1.patch
  4. patching file gcc/config/alpha/linux-elf.h
  5. patching file gcc/config/arm/linux-elf.h
  6. Hunk #1 succeeded at 88 (offset 1 line).
  7. patching file gcc/config/frv/linux.h
  8. patching file gcc/config/i386/gnu.h
  9. patching file gcc/config/i386/linux.h
  10. patching file gcc/config/i386/linux64.h
  11. patching file gcc/config/ia64/linux.h
  12. patching file gcc/config/linux.h
  13. patching file gcc/config/m32r/linux.h
  14. patching file gcc/config/m68k/linux.h
  15. patching file gcc/config/mips/linux.h
  16. patching file gcc/config/mips/linux64.h
  17. Hunk #1 succeeded at 47 (offset -13 lines).
  18. patching file gcc/config/mn10300/linux.h
  19. Hunk #1 succeeded at 37 with fuzz 1.
  20. patching file gcc/config/pa/pa-linux.h
  21. patching file gcc/config/rs6000/linux64.h
  22. Hunk #1 succeeded at 355 (offset 4 lines).
  23. patching file gcc/config/rs6000/sysv4.h
  24. Hunk #1 succeeded at 1125 (offset -6 lines).
  25. Hunk #2 succeeded at 1156 (offset -6 lines).
  26. patching file gcc/config/s390/linux.h
  27. patching file gcc/config/sh/linux.h
  28. Hunk #1 succeeded at 71 (offset 1 line).
  29. patching file gcc/config/sparc/linux.h
  30. patching file gcc/config/sparc/linux64.h
  31. patching file gcc/config/xtensa/linux.h
复制代码
3、开始编译gcc-4.0.3(路径确认没有错误)
  1. lfs@gentoo /app/sources/gcc-4.0.3 $ mkdir ../gcc-build
  2. lfs@gentoo /app/sources/gcc-4.0.3 $ cd ../gcc-build/
  3. lfs@gentoo /app/sources/gcc-build $ ../gcc-4.0.3/configure --prefix=/tools --libexecdir=/tools/lib \
  4. >          --with-local-prefix=/tools --disable-nls \
  5. >          --enable-shared --enable-languages=c
复制代码
4、报错如下:
  1. In file included from ../../gcc-4.0.3/gcc/tsystem.h:90,
  2.                  from ../../gcc-4.0.3/gcc/crtstuff.c:64:
  3. ./include/stdio.h:22:42: error: gentoo-multilib/amd64/stdio.h: No such file or directory
  4. In file included from ../../gcc-4.0.3/gcc/crtstuff.c:64:
  5. ../../gcc-4.0.3/gcc/tsystem.h:93:23: error: sys/types.h: No such file or directory
  6. ../../gcc-4.0.3/gcc/tsystem.h:96:19: error: errno.h: No such file or directory
  7. ../../gcc-4.0.3/gcc/tsystem.h:103:20: error: string.h: No such file or directory
  8. ../../gcc-4.0.3/gcc/tsystem.h:104:20: error: stdlib.h: No such file or directory
  9. ../../gcc-4.0.3/gcc/tsystem.h:105:20: error: unistd.h: No such file or directory
  10. In file included from ./include/syslimits.h:7,
  11.                  from ./include/limits.h:11,
  12.                  from ../../gcc-4.0.3/gcc/tsystem.h:108,
  13.                  from ../../gcc-4.0.3/gcc/crtstuff.c:64:
  14. ./include/limits.h:122:61: error: limits.h: No such file or directory
  15. In file included from ../../gcc-4.0.3/gcc/crtstuff.c:64:
  16. ../../gcc-4.0.3/gcc/tsystem.h:111:18: error: time.h: No such file or directory
  17. make[2]: *** [crtbegin.o] Error 1
  18. make[1]: *** [stage1_build] Error 2
  19. make: *** [bootstrap] Error 2
复制代码
patch的问题我上http://www.linuxfromscratch.org/patches/lfs/6.2/确认了,确实没有问题,谢谢楼上的回答,同时也希望其他朋友能提供帮助。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-2-16 11:14:02 | 显示全部楼层
补充一下,这个和我的gentoo有关系吗?
如果换到其他的发行版本,是不是会解决这个问题?
回复 支持 反对

使用道具 举报

发表于 2007-2-16 12:59:57 | 显示全部楼层
我遇到了和你一样的问题
在没有patch以前,gcc-4.0.3可以编译通过,在glibc时碰到了问题(还没解决),怀疑是gcc的问题,就把gcc打了patch,结果就出现了头文件(*.h)找不到的现象,后来再试一次,还是这样。
回头看看patch中究竟改了什么东东
回复 支持 反对

使用道具 举报

发表于 2007-2-16 16:27:53 | 显示全部楼层
你要看清楚,书上写了要 patch 的地方才 patch,别乱打。

我很久没看 LFS 了,有的地方也许记不清。
回复 支持 反对

使用道具 举报

发表于 2007-2-16 16:49:42 | 显示全部楼层
明白了,LFS中gcc做了两次,5.4应该是pass 1, 此时不要打补丁,在5.11时做gcc pass 2, 此时要打上补丁

不过我现在还没有做到5.11,
在5.6就卡住了,正在处理中
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-2-16 23:34:21 | 显示全部楼层
非常感谢楼上各位高手的回答,个人补充一下:
编译gcc-4.0.3的时候,打patch和不打patch都不行,不打patch时的报错如下:
  1. /tools//x86_64-unknown-linux-gnu/bin/ld: cannot find -lc
  2. collect2: ld returned 1 exit status
  3. make[3]: *** [32/libgcc_s.so] Error 1
  4. ......
复制代码
回复 支持 反对

使用道具 举报

发表于 2007-2-17 00:07:19 | 显示全部楼层
感觉是你之前有东西弄错了,造成 -lc(libc) 没被找到。

对了,如果是 x86_64 的话,要用 CLFS,而不是 LFS。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-2-17 00:58:26 | 显示全部楼层
Post by 晨想
感觉是你之前有东西弄错了,造成 -lc(libc) 没被找到。

对了,如果是 x86_64 的话,要用 CLFS,而不是 LFS。


谢谢,我想你说的是对的.也许这个lfs不适用于x86_64吧.
我认为前面出错的可能性不是很大.毕竟才进行到5.4,前面要做的东西很少,而且,我retry了至少五次~~~~~

顺便问一下,Beyond LinuxFromScratch(BLFS)或者CBLFS是否更适合我?
顺祝楼上所有人猪年快乐!
回复 支持 反对

使用道具 举报

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

本版积分规则

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