LFS终于搭建完成了,总耗时在70小时左右。现在将其构建过程中的一些问题总结下:宿主系统用的是lfslivecd-x86-6.3-r2160(省去下载软件包和相关补丁的麻烦)。
一、整个构建LFS中总要遇到如下几个错误:
1、gcc4.3.2编译错误
编译产生如下错误
/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory
make[5]: *** [_muldi3.o] Error 1
make[5]: Leaving directory `/mnt/lfs/sources/gcc-build/x86_64-unknown-linux-gnu/32/libgcc'
make[4]: *** [multi-do] Error 1
make[4]: Leaving directory `/mnt/lfs/sources/gcc-build/x86_64-unknown-linux-gnu/libgcc'
make[3]: *** [all-multi] Error 2
make[3]: Leaving directory `/mnt/lfs/sources/gcc-build/x86_64-unknown-linux-gnu/libgcc'
make[2]: *** [all-stage1-target-libgcc] Error 2
make[2]: Leaving directory `/mnt/lfs/sources/gcc-build'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/mnt/lfs/sources/gcc-build'
make: *** [all] Error 2
起因:LFS宿主系统是64位的,做GCC的交叉编译会出错。
解决:更换宿主系统为32位或采用CLFS
参考:http://www.linuxsir.org/bbs/thread343363.html
2、chroot后glibc-2.5.1 make出错
编译产生如下错误
no gen-translit.pl < C-translit.h.in > C-translit.h.tmp
/bin/sh: no :command not found
make[2]:*** [C-translit.h] Error 127
make[2]:Leaving directory '/sources/glibc-2.5.1/locale'
make[1]: ***[locale/others] Error2
make[1]:Leaving directory '/sources/glibc-.2.5.1'
make : *** [all] Error2
起因:沒安perl或者perl不能正常工作(用perl -V可以进行简单测试。如一切正常就应无报错信息)。经检查编译的perl并没有问题,后发现是未正确复制perl的库造成
解决: 1、将PERL相关的LIB Copy过去(cp -Rv lib/* /tools/lib/perl5/5.8.8)。2、重编Glibc前必须重新生成Makefile文件(必须)。
参考:http://blog.chinaunix.net/u/13265/showart.php?id=477122
3、其它错误
除开上面的两个比较严重的错误外,基本是就是一些输入错误而引起的(后来在宿主上启用SSH后,改用复制粘贴,这一类问题基本不会出现)。
切记保证每一步操作的正确性,这样才有助于保证你LFS的成功。
二、通过这次LFS的构建学习到了不少东西(稍后有时间再把LFS文档各步之间关系整理一下)
1、对工具链有一个基本清楚的认识。
2、对tempfs、devfs、systemfs、udev几个文件系统有进一步的认识。
3、学习到Kernel相关的几个文件的作用。
4、sed的基本使用。
5、其它相关知识点的巩固。
最后说一下LFS虽然整个构建过程比较烦琐,只要你打好了基本功,LFS并不是遥不可及。如果有兴趣去尝试的网友,推荐你可以参考这两个文档《手把手教你如何建立自己的Linux系统 第二版》和《Linux From Scratch官方手册》。
Comments
There are no comments.
Leave a Reply