1.chroot后不要再打开新的终端了,没法用,还可能使系统崩溃。另外如果需要去睡觉,重启后要再次挂载并填充/dev和挂载虚拟内核文件系统,并再次运行chroot,可以将下列命令保存为脚本,重启后一次运行
mount /dev/sda9 /mnt/lfs mount -v --bind /dev $LFS/dev mount -vt devpts devpts $LFS/dev/pts mount -vt proc proc $LFS/proc mount -vt sysfs sysfs $LFS/sys if [ -h $LFS/dev/shm ]; then link=$(readlink $LFS/dev/shm) mkdir -p $LFS/$link mount -vt tmpfs shm $LFS/$link unset link else mount -vt tmpfs shm $LFS/dev/shm fi chroot "$LFS" /tools/bin/env -i HOME=/root TERM="$TERM" PS1='u:w$ ' PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin /tools/bin/bash --login +h
2,安装Linux api头文件,执行 make mrproper出错:
make: /bin/sh: Command not found Makefile:579: /sources/linux-3.10/arch//Makefile: No such file or directory make: gcc: Command not found
添加链接:
ln -sf /bin/bash /bin/sh ln -sv /tools/lib/ld-linux.so.2 /lib/ld-linux.so.2
3. 该中文版文档提供的Man-pages包下载地址失效了,之前没下到这个包,到 这里可以下载。别把Man-pages和Man-DB当成一个了。
4.glibc测试之后执行grep Error glibc-check-log ,显示如下错误:
make[2]: [/sources/glibc-build/posix/annexc.out] Error 1 (ignored) make[2]: *** [/sources/glibc-build/nptl/tst-cancel4.out] Error 1 make[2]: *** [/sources/glibc-build/nptl/tst-cancel5.out] Error 1 make[2]: *** [/sources/glibc-build/nptl/tst-cancelx4.out] Error 1 make[2]: *** [/sources/glibc-build/nptl/tst-cancelx5.out] Error 1 make[1]: *** [nptl/tests] Error 2 make[2]: [/sources/glibc-build/conform/run-conformtest.out] Error 1 (ignored)
和文档声明的可忽略错误不大一致,但忽略之后也没遇到问题
常用中文区域数据 :
localedef -i zh_CN -f GB18030 zh_CN localedef -i zh_CN -f GBK zh_CN localedef -i zh_CN -f UTF-8 zh_CN localedef -i zh_CN -f GB2312 zh_CN localedef -i zh_HK -f UTF-8 zh_CN localedef -i zh_HK -f BIG5-HKSCS zh_CN localedef -i zh_TW -f EUC-TW zh_CN localedef -i zh_TW -f UTF-8 zh_CN localedef -i zh_TW -f BIG5 zh_CN
5.binutils包,make出错:
make[2]: *** [info-recursive] Error 1 make[2]: Leaving directory `/sources/binutils-build/bfd' make[1]: *** [all-bfd] Error 2 make[1]: Leaving directory `/sources/binutils-build' make: *** [all] Error 2
make clean, make distclean,重来一遍,居然好了
6.安装gcc,安装测试成功后有个:
echo 'main(){}' > dummy.c cc dummy.c -v -Wl,--verbose &> dummy.log readelf -l a.out | grep ': /lib'
应该有输出,可我这没有。不过后面几个检查都正常
7.coreutils,make出错:
help2man: can't get '--help' info from man/expr.td/expr make[2]: *** [man/expr.1] Error 127 make[2]: Leaving directory `/sources/coreutils-8.21' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/sources/coreutils-8.21' make: *** [all] Error 2
这个有点麻烦,出错原因可能在上面gcc那里,dummy函数测试没有输出,可要是重新从gcc那开始也太麻烦了。参照这里的一个帖子,我拼凑出了个解决办法,有可能不对:
执行
expr --help
输出大概是
./expr: error while loading shared libraries: libgmp.so.10: cannot open shared object file: No such file or directory
说明加载libgmp.so.10这个共享库时出错了,在coreutls-8.21目录下执行
ldd src/expr
输出类似下面:
linux-vdso.so.1 (0x00007fffad9a9000)
libgmp.so.10 => not found
libc.so.6 => /tools/lib/libc.so.6
我仿照前面的章节自己给它添加了链接
mv -v /usr/lib/libgmp.so.10* /lib/ ln -sfv /lib/libgmp.so.10 /usr/lib/libgmp.so.10
之后make就通过了。
但执行ldconfig -v 检查还有问题,还带出来前面的一个(据情况而定):
ldconfig: Cannot stat /usr/lib/libncursesw.so: No such file or directory
ldconfig: Cannot stat /usr/lib/libgmp.so: No such file or directory
以下两条命令修复:
ln -sfv /lib/libncursesw.so.5 /usr/lib/libncursesw.so ln -sfv /lib/libgmp.so.10 /usr/lib/libgmp.so
8.安装bash,make出错:
/bin/sh: error while loading shared libraries: libncursesw.so.5: cannot open shared object file: No such file or directory make: [install] Error 127 (ignored)
又是动态库的问题
ln -sv /lib/libncursesw.so.5 /tools/lib/libncursesw.so.5
9. gettext-0.18.3,make出错:
make[4]: Entering directory `/sources/gettext-0.18.1.3/gettext-tools/src' /bin/sh ../libtool --tag=CC --mode=link gcc -std=gnu99 -g -O2 -o msgcmp msgcmp-msgcmp.o msgcmp-msgl-fsearch.o libgettextsrc.la -lm libtool: link: cannot find the library `/mnt/lfs/sources/gettext-0.18.1.3/gettext-tools/gnulib-lib/libgettextlib.la' or unhandled argument `/mnt/lfs/sources/gettext-0.18.1.3/gettext-tools/gnulib-lib/libgettextlib.la' make[4]: *** [msgcmp] Error 1 make[4]: Leaving directory `/sources/gettext-0.18.1.3/gettext-tools/src'
这是个令人伤感的问题,它让我认识到了先前做了好多错事……说来话长,看看这 可恶的教训。在lfs准备阶段,曾编译过这个包,当时没把它删除,这次再用,出问题了。删掉源码包,重新解压编译。
10.编译iproute2-3.9.0,make出错:
lnstat.c: In function 'build_hdr_string': lnstat.c:169:30: error: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to provide an explicit length? [-Werror=sizeof-pointer-memaccess] memset(th.hdr[i], 0, sizeof(th.hdr[i]));