嘛,最近都在构建LFS。
遇到的问题很多,所以就在这里做个总结吧。
一、准备条件
软件版本:ubuntu-11.10-server-i386/LFS7.0
参考文档:http://www.linuxfromscratch.org/lfs/view/7.0/index.html
安装环境:virtualbox4.1.8
备份资料:virtualbox安装增强工具,设置共享文件夹,共享文件。
检查环境:
Binutils: version-check.sh: line 8: ld: command not found
version-check.sh: line 9: bison: command not found
yacc not found
bzip2, Version 1.0.5, 10-Dec-2007.
Coreutils: 8.5
diff (GNU diffutils) 3.0
find (GNU findutils) 4.4.2
version-check.sh: line 17: gawk: command not found
/usr/bin/awk -> /usr/bin/mawk
version-check.sh: line 21: gcc: command not found
version-check.sh: line 22: /lib/libc.so.6: No such file or directory
grep (GNU grep) 2.9
gzip 1.3.12
Linux version 3.0.0-12-generic-pae (buildd@vernadsky) (gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3) ) #20-Ubuntu SMP Fri Oct 7 16:37:17 UTC 2011
version-check.sh: line 26: m4: command not found
version-check.sh: line 27: make: command not found
patch 2.6.1
Perl version=’5.12.4′;
GNU sed version 4.2.1
tar (GNU tar) 1.25
version-check.sh: line 32: makeinfo: command not found
Texinfo:
xz (XZ Utils) 5.0.0
version-check.sh: line 34: gcc: command not found
Compilation failed
发现不符合开发条件,于是安装必要的软件:build-essential、texinfo、bison、gawk
下载LFS的必要软件源码:狂下载了半天,还是发现几个软件无法下载,IPRoute2(2.6.39)、Man-pages(3.35)、Zlib(1.2.5),只能重新寻找地址下载了。
Man-pages-3.36(必须先安装git,然后用git下载这个软件)
到此,全部需要下载的东西都下载完全了。
解压文件出现问题:
tar (child): bzip2: Cannot exec: Too many levels of symbolic links
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
回到root状态,删掉$LFS下的tools文件夹,回到根目录下,发现有一个tools,把它也删掉。然后再重新声称tools文件夹:
mkdir -v $LFS/tools
ln -sv $LFS/tools /
做完这两步,再进入lfs用户状态,解压应该已经没问题了。
一、构建临时系统
No.1 起步就被绊倒(执行binutils出错make install)
make[4]: Leaving directory `/lfs/sources/binutils-build/ld’
make[3]: Leaving directory `/lfs/sources/binutils-build/ld’
make[2]: Leaving directory `/lfs/sources/binutils-build/ld’
make[1]: Nothing to be done for `all-target’.
make[1]: Leaving directory `/lfs/sources/binutils-build’
lfs@ubuntu:/lfs/sources/binutils-build$ make install
make[1]: Entering directory `/lfs/sources/binutils-build’
/bin/bash ../binutils-2.21.1/mkinstalldirs /tools /tools
make[2]: Entering directory `/lfs/sources/binutils-build/bfd’
make install-recursive
make[3]: Entering directory `/lfs/sources/binutils-build/bfd’
Making install in doc
make[4]: Entering directory `/lfs/sources/binutils-build/bfd/doc’
test -z “/tools/share/info” || /bin/mkdir -p “/tools/share/info”
/bin/mkdir: cannot create directory `/tools/share’: Permission denied
make[4]: *** [install-info-am] Error 1
make[4]: Leaving directory `/lfs/sources/binutils-build/bfd/doc’
Making install in po
make[4]: Entering directory `/lfs/sources/binutils-build/bfd/po’
make[4]: Nothing to be done for `install’.
make[4]: Leaving directory `/lfs/sources/binutils-build/bfd/po’
make[4]: Entering directory `/lfs/sources/binutils-build/bfd’
make[5]: Entering directory `/lfs/sources/binutils-build/bfd’
make[5]: Nothing to be done for `install-exec-am’.
test -z “/tools/include” || /bin/mkdir -p “/tools/include”
/bin/mkdir: cannot create directory `/tools/include’: Permission denied
make[5]: *** [install-bfdincludeHEADERS] Error 1
make[5]: Leaving directory `/lfs/sources/binutils-build/bfd’
make[4]: *** [install-am] Error 2
make[4]: Leaving directory `/lfs/sources/binutils-build/bfd’
make[3]: *** [install-recursive] Error 1
make[3]: Leaving directory `/lfs/sources/binutils-build/bfd’
make[2]: *** [install] Error 2
make[2]: Leaving directory `/lfs/sources/binutils-build/bfd’
make[1]: *** [install-bfd] Error 2
make[1]: Leaving directory `/lfs/sources/binutils-build’
make: *** [install] Error 2
检查原因是tools的文件夹权限不足,把所有人改成lfs就行了。
No2.编译gcc出错
/usr/include/features.h:323:26: fatal error: bits/predefs.h: No such file or directory
compilation terminated.
make[3]: *** [_muldi3.o] Error 1
make[3]: Leaving directory `/lfs/sources/gcc-build/i686-pc-linux-gnu/libgcc’
make[2]: *** [all-stage1-target-libgcc] Error 2
make[2]: Leaving directory `/lfs/sources/gcc-build’
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/lfs/sources/gcc-build’
make: *** [all] Error 2
貌似缺失64位的dev库,安装libc6-dev-amd64
on
on