本机宿主系统archlinux,lfs SVN-20130711,参考文档

1.在离开或重新进入当前工作环境 (比如 su 成为 root 或者其他用户) 时不要忘记检查 $LFS 是否设置好。

echo $LFS
export LFS=/mnt/lfs

 

2.这个命令:

ln -sv $LFS/tools  /

在宿主系统上创建一个 /tools 符号链接。它将指向 LFS 分区上的$LFS/tools 目录,此命令相当于:

ln -sv $LFS/tool  /tools

之后可用ls  -l 在根目录看到生成了一个链接

lrwxrwxrwx    root root    15 Apr 10 19:03 tools -> /mnt/lfs//tools

 

3.第一遍编译Binutils,出师不利,开始就出错了,卡在开头,耗费一个下午的时间,方才解决(中间在1024放纵了好久……阿弥陀佛)

configure时没错,make时出错,错误信息类似下面:

../../../binutils-2.23.2/bfd/doc/bfd.texinfo:325: unknown command `colophon'
../../../binutils-2.23.2/bfd/doc/bfd.texinfo:336: unknown command `cygnus'
make[3]: *** [bfd.info] Error 1
make[3]: Leaving directory `/mnt/lfs/sources/binutils-build/bfd/doc'
Making info in po
make[3]: Entering directory `/mnt/lfs/sources/binutils-build/bfd/po'
make[3]: Nothing to be done for `info'.
make[3]: Leaving directory `/mnt/lfs/sources/binutils-build/bfd/po'
make[3]: Entering directory `/mnt/lfs/sources/binutils-build/bfd'
make[3]: Nothing to be done for `info-am'.
make[3]: Leaving directory `/mnt/lfs/sources/binutils-build/bfd'
make[2]: *** [info-recursive] Error 1
make[2]: Leaving directory `/mnt/lfs/sources/binutils-build/bfd'
make[1]: *** [all-bfd] Error 2
make[1]: Leaving directory `/mnt/lfs/sources/binutils-build'
make: *** [all] Error 2

搜便世界,在这里找到个解决办法:

sed -i -e 's/@colophon/@@colophon/' \
-e 's/doc@cygnus.com/doc@@cygnus.com/' bfd/doc/bfd.texinfo

当时正在新建的 binutils-build 下,此目录中的bfd/doc/ 中没有bfd.texinfo 文件,而在 binutils-2.23.2/bfd/doc/中,所以命令改为(注意,sed不可执行多次):

sed -i -e 's/@colophon/@@colophon/' \
-e 's/doc@cygnus.com/doc@@cygnus.com/' ../binutils-2.23.2/bfd/doc/bfd.texinfo

成功编译! 此前还稀里糊涂的运行过make clean,  make distclean等命令,删除过目录,重新下载binutils包,但都没奏效,如果上面的方法不行,可以试试这些。此外,如果怀疑是gcc版本的问题,在宿主系统要求中gcc的部分,有这个note

On some distributions, there have been reports that some libraries used by gcc can be in an inconsistent state and that this interferes with building some LFS packages. To check this, look in /usr/lib and possibly /usr/lib64 for libgmp.la, libmpfr.la, and libmpc.la. Either all three should be present or absent, but not only one or two. If the problem exists on your system, either rename or delete the .la files or install the appropriate missing package.

我运行version-check.sh后发现没有 libgmp.la, libmpfr.la,  libmpc.la这三个货,可以从这下手解决。

4.第一遍编译gcc,这条命令没有解释清楚

sed -i '/k prot/agcc_cv_libc_provides_ssp=yes' gcc/configure

-i 选项表示将改变直接写入文件

/k prot/ 会搜索到这行

# Test for stack protector support in target C library

将/k prot/写成/stack protector/或许更容易理解。

接下来不是将"k prot" 替换成后边那句,而是在这行后边插入agcc_cv_libc_provides_ssp=yes

就成了

# Test for stack protector support in target C library
agcc_cv_libc_provides_ssp=yes

5.第一遍gcc,出错:

configure: error: in `/mnt/lfs/sources/gcc-build/i686-lfs-linux-gnu/libatomic':
configure: error: C compiler cannot create executables
See `config.log' for more details.
Makefile:11514: recipe for target 'configure-target-libatomic' failed
make[1]: *** [configure-target-libatomic] Error 1
make[1]: Leaving directory '/mnt/lfs/sources/gcc-build'
Makefile:837: recipe for target 'all' failed
make: *** [all] Error 2

原因:libatomic未禁用。

解决:在前一步的configure选项中,加入 --disable-libatomic 选项 (另一个方案,自己没试,供参考)

6.安装 Linux API 头文件, 解压内核。之前在程序包说明的部分提到内核要用最新的

 Linux 内核相对经常更新,经常是因为发现了新的安全弱点。只要勘误表没有声明,总应该使用最新的 3.10.x 内核版本。

对于速度受限或者带宽昂贵的用户,想要升级 Linux 内核,可以分别下载程序包的基线版本和补丁。这可能会节省一些时间或开销。 

下载patch文件,解压到内核目录,用这个命令将补丁打上

patch  -p1 < patch-3.10.36

其中,patch-3.10.36 为解压后的补丁文件

7.编译glibc, configure错误:

checking for autoconf... autoconf
checking whether autoconf works... no
configure: error:
*** These critical programs are missing or too old: make
*** Check the INSTALL file for required versions.

fuck,这个问题如此困难,是make版本的问题。而我用的lfs因为要看中文的,所以不是最新的,也就会有版本相关的bug。踏破铁鞋,搜到一个解决办法,给glibc-2.17里的configure打个补丁,点击此处下载该补丁,即configure-make4.patch ,放到glibc-2.17的目录,然后在该目录执行:

patch  <configure-make4.patch 

下载这个文件可能需要fuck the gfw,在下面贴出此patch的内容:

--- configure    -- ::09.792647617 +
+++ configure.fix -- ::26.479246078 +
@@ -, +, @@
ac_prog_version=`$MAKE --version >& | sed -n 's/^.*GNU Make[^0-9]*\([0-9][0
-.]*\).*$/\/p'`
case $ac_prog_version in
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
- 3.79* | .[]*)
+ 3.79* | .[]* | .[]*)
ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
*) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;

之后make出错:

/mnt/lfs/sources/glibc-build/resolv/libresolv_pic.a(gethnamaddr.os):/mnt/lfs/sources/glibc-2.17/resolv/gethnamaddr.c:636: more undefined references to `__stack_chk_guard' follow
collect2: error: ld returned 1 exit status
../Makerules:446: recipe for target '/mnt/lfs/sources/glibc-build/resolv/libresolv.so' failed
make[2]: *** [/mnt/lfs/sources/glibc-build/resolv/libresolv.so] Error 1
make[2]: Leaving directory '/mnt/lfs/sources/glibc-2.17/resolv'
Makefile:233: recipe for target 'resolv/others' failed
make[1]: *** [resolv/others] Error 2
make[1]: Leaving directory '/mnt/lfs/sources/glibc-2.17'
Makefile:9: recipe for target 'all' failed
make: *** [all] Error 2

问题居然出在第一遍gcc时那句:

sed -i '/k prot/agcc_cv_libc_provides_ssp=yes' gcc/configure

忘了执行……fuck!!  stupid!!,之前光查它什么意思了,忘了运行之,只好再搞一遍……

8.第二遍binutils, 如果是重新解压的,不要忘了到binutils-2.23.2目录里执行那条sed命令。

9.第二遍gcc,configure出错:

configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
their locations.

前面没理解对,这一步

tar -Jxf ../mpfr-3.1..tar.xz
mv -v mpfr-3.1. mpfr
tar -Jxf ../gmp-5.1..tar.xz
mv -v gmp-5.1. gmp
tar -zxf ../mpc-1.0..tar.gz
mv -v mpc-1.0. mpc

mpfr,gmp,mpc三个文件夹的正确位置应为gcc-4.8.1目录,我误以为直接在$LFS/source目录解压然后重命名了……

10.没有第10条。接下来的包顺利地一塌糊涂,直接闯到了第三部分,编制LFS!

to be continued...

lfs遇到的一些问题--准备阶段的更多相关文章

  1. lfs遇到的一些问题--后续阶段

    1.安装GPM-1.20.7,make install出错: prog/display-buttons.c:39:57: 致命错误:gpm.h:没有那个文件或目录 #include <gpm.h ...

  2. LFS 中文版手册发布:如何打造自己的 Linux 发行版

    您是否想过打造您自己的 Linux 发行版?每个 Linux 用户在他们使用 Linux 的过程中都想过做一个他们自己的发行版,至少一次.我也不例外,作为一个 Linux 菜鸟,我也考虑过开发一个自己 ...

  3. lfs遇到的一些问题--编制LFS

    1.chroot后不要再打开新的终端了,没法用,还可能使系统崩溃.另外如果需要去睡觉,重启后要再次挂载并填充/dev和挂载虚拟内核文件系统,并再次运行chroot,可以将下列命令保存为脚本,重启后一次 ...

  4. 《从LFS到自己的Linux发行版》系列教程:一步到位体验LFS11.0

    ​​ 目录 前言 第一节:LFS 准备工作 第二节:一步完成你的 LFS11.0 第三节:开启你的 LFS 系统 结语 前言 如果你把从源代码开始编译构建一个操作系统的工作当成厨师做一桌菜的话,Lin ...

  5. LFS(Linux From Scratch)构建过程全记录(五):交叉工具链的构建

    写在前面 本文将详细讲述如何构建工具链 前置知识 在LFS-BOOK中,我们需要学习一些关于"交叉编译"的内容,详见书本 安装Binutils-2.39 我们cd到sources文 ...

  6. 【基于WPF+OneNote+Oracle的中文图片识别系统阶段总结】之篇一:WPF常用知识以及本项目设计总结

    篇一:WPF常用知识以及本项目设计总结:http://www.cnblogs.com/baiboy/p/wpf.html 篇二:基于OneNote难点突破和批量识别:http://www.cnblog ...

  7. 你真的会玩SQL吗?之逻辑查询处理阶段

    你真的会玩SQL吗?系列目录 你真的会玩SQL吗?之逻辑查询处理阶段 你真的会玩SQL吗?和平大使 内连接.外连接 你真的会玩SQL吗?三范式.数据完整性 你真的会玩SQL吗?查询指定节点及其所有父节 ...

  8. Openfire阶段实践总结

    从3月开始研究Openfire,其实就是要做一套IM系统,也正是这个原因才了解到Openfire.之前还真没想过有这么多的开源产品可以做IM,而且也没想到XMPP这个协议竟然如何强大.看来还是标准为先 ...

  9. 【Win 10应用开发】分阶段进行数据绑定

    使用x:Bind扩展标记进行数据绑定,是在编译阶段完成,至于说性能优化方面,大概主要是优化CPU资源的使用,因为免去了运行阶段进行绑定的过程.当然,使用这个标记仅仅是绑定上的优化,并不包括数据源.数据 ...

随机推荐

  1. Hive - 建表和加载数据指令小结 以及使用Load data指令的注意事项

    类似Mysql的数据库概念: hive> CREATE DATABASE cui; hive> USE cui; 创建表: CREATE TABLE test( first STRING, ...

  2. 基于NodeJs的网页爬虫的构建(二)

    好久没写博客了,这段时间已经忙成狗,半年时间就这么没了,必须得做一下总结否则白忙.接下去可能会有一系列的总结,都是关于定向爬虫(干了好几个月后才知道这个名词)的构建方法,实现平台是Node.JS. 背 ...

  3. centOS 6.4 mysql安装

    1 直接安装 yum install mysql mysql-server 2 启动mysql /usr/bin/mysqld_safe --user=mysql & 启动时,如果出现Can' ...

  4. python的一个表达式的计算(超简单)

    运行的过程如下: 输入计算表达式:3+5 计算结果:8 然后再次显示计算表达式,等待输入完成后,再次显示结果,依此循环.   作为初学者再适合不过,代码也简单,如下所示: #!/usr/bin/env ...

  5. js hover放大效果

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  6. wap开发之滑动事件(swipe、tap、swipeleft、swiperight)等

    最近一直找在wap端可以实现的swipe等滑动事件的方法,开始研究了jquery-mobile,zepto,结果由于jqm太大.zepto有不少缺陷.为此研究了zepto,想把里面的swipe事件独立 ...

  7. 转: Android异步加载图像小结

    转:http://blog.csdn.net/sgl870927/article/details/6285535 研究了android从网络上异步加载图像,现总结如下: (1)由于android UI ...

  8. tr设置border无效的解决方法

    给table的css添加属性:border-collapse: collapse; 边框不折叠的表格 行,列,行组是不具有border的

  9. WPF中将四个数字字符串值(比如:"10,10,300,300")转为Rect

    RectConverter rectConverter = new RectConverter(); string parseString = viewportEntry.Text; if (pars ...

  10. 查看sqlserver数据库的端口号

    最近正在用sqlserver作为java的数据库进行开发,在写连接字符串的时候,想起一个问题,怎么查找sqlserver的端口号呢?有两种方法 1,用存储过程 --查询端口号exec sys.sp_r ...