LinuxSir.cn,穿越时空的Linuxsir!

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

lfs 到第六章出了一点问题

[复制链接]
发表于 2008-10-31 11:53:30 | 显示全部楼层 |阅读模式
在做 第六章 安装系统基础软件 编译gcc时出现

/sources/gcc-build/./gcc/xgcc -B/sources/gcc-build/./gcc/ -B/usr/i686-pc-linux-gnu/bin/ -B/usr/i686-pc-linux-gnu/lib/ -isystem /usr/i686-pc-linux-gnu/include -isystem /usr/i686-pc-linux-gnu/sys-include -O2 -O2 -g -O2   -DIN_GCC    -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -I. -I. -I../../gcc-4.1.2/gcc -I../../gcc-4.1.2/gcc/. -I../../gcc-4.1.2/gcc/../include -I../../gcc-4.1.2/gcc/../libcpp/include   -g0 -finhibit-size-directive -fno-inline-functions -fno-exceptions -fno-zero-initialized-in-bss -fno-unit-at-a-time  -fno-omit-frame-pointer \
          -c ../../gcc-4.1.2/gcc/crtstuff.c -DCRT_BEGIN \
          -o crtbegin.o
In file included from ../../gcc-4.1.2/gcc/crtstuff.c:68:
../../gcc-4.1.2/gcc/tsystem.h:90:19: error: stdio.h: No such file or directory
../../gcc-4.1.2/gcc/tsystem.h:93:23: error: sys/types.h: No such file or directory
../../gcc-4.1.2/gcc/tsystem.h:96:19: error: errno.h: No such file or directory
../../gcc-4.1.2/gcc/tsystem.h:103:20: error: string.h: No such file or directory
../../gcc-4.1.2/gcc/tsystem.h:104:20: error: stdlib.h: No such file or directory
../../gcc-4.1.2/gcc/tsystem.h:105:20: error: unistd.h: No such file or directory
In file included from /sources/gcc-build/./gcc/include/syslimits.h:7,
                 from /sources/gcc-build/./gcc/include/limits.h:11,
                 from ../../gcc-4.1.2/gcc/tsystem.h:108,
                 from ../../gcc-4.1.2/gcc/crtstuff.c:68:
/sources/gcc-build/./gcc/include/limits.h:122:61: error: limits.h: No such file or directory
In file included from ../../gcc-4.1.2/gcc/crtstuff.c:68:
../../gcc-4.1.2/gcc/tsystem.h:111:18: error: time.h: No such file or directory
make[2]: *** [crtbegin.o] Error 1
make[2]: Leaving directory `/sources/gcc-build/gcc'
make[1]: *** [all-gcc] Error 2
make[1]: Leaving directory `/sources/gcc-build'
make: *** [all] Error 2


我用gcc 编译
#include <stdio.h>

int main( int argc, char *argv[] )
{
printf("test for gcc \r\n");
return 0;
}

也没说少stdio.h啊,出现这个问题可能原因是什么?如何修复呢?
 楼主| 发表于 2008-10-31 11:58:25 | 显示全部楼层
版本是gcc-4.1.2,在编译第六章时将第五章所编译的东西删除后再编译的
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-10-31 14:42:19 | 显示全部楼层
没人回答么? 以后大家遇到这种问题,最好是不但将生成的删除,还要将源文件也删了,可能是前面加了patch的原因或者是前面用sed改过,结贴了。
回复 支持 反对

使用道具 举报

发表于 2008-10-31 16:35:53 | 显示全部楼层
这个错误很明显提示没有头文件,莫非是你编译的linux-headers都没复制过去?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-10-31 17:03:08 | 显示全部楼层
这用的不是gcc,而是编译gcc中产生的xgcc,估计搜索路径有问题
回复 支持 反对

使用道具 举报

发表于 2008-10-31 22:03:41 | 显示全部楼层
xgcc 是 bootstrap 时产生出来反覆编译及校验之用

会否是宿主系统的编译环境未建立好?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-10-31 23:24:26 | 显示全部楼层
应该不是,此处已chroot了,脱离了宿主环境;我将以前在宿主环境下的源程序以及编译文件删除,重新来一遍就ok了;应该是在宿主环境遗留了什么东西导致的
回复 支持 反对

使用道具 举报

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

本版积分规则

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