本机宿主系统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. MasterCard信用卡测试卡号-creditcard-1

    MasterCard信用卡测试卡号-creditcard-1 510510510510510051111111111111185454545454545454550000000000000455555 ...

  2. ubuntu下virtualenv的复制

    将一个用户下的virtualenv复制到另一个用户下.直接复制无法使用,source后的python依旧是系统自带的python. 原始env名:/home/llx/work/nn/nnenv.bak ...

  3. 基于jQuery的图片左右轮播,基本原理通用

    毕竟新人,写点基础的小东西,希望能和大家沟通交流,提高自己的水平. 这个是应用较多的轮播部分,希望能和大家分享一下思路,拓宽视野. 话不多说,上内容. 我的思路很简单就是通过判断index值的大小变化 ...

  4. windows 环境下安装plpython语言环境到postgresql数据库

    1.1       安装plpython 在windows环境 1.1.1      下载http://legacy.python.org/ftp//python/3.2.5/python-3.2.5 ...

  5. yii2定义模版

    首先复制vendor\yiisoft\yii2-gii\generators\crud\default目录到根目录下的giitemplate/crud(这个目录自己新建), 然后打开gii配置文件,添 ...

  6. 安装 SQL Server 2005 的硬件和软件要求(官方全面)

    SQL Server 2005 安装要求 本主题介绍了安装 SQL Server 205 的硬件和软件要求,以及查看安装文档的说明. 硬件和软件要求(32 位和 64 位) 访问 SQL Server ...

  7. hadoop1中hdfs原理详解

    HDFS是Hadoop Distribute File System的简称,也是Hadoop的一个分布四文件系统 一.HDFS的主要设计理念 1.存储超大文件 这里的 “超大文件” 是指几百MB .G ...

  8. Mac双系统切换

    苹果系统和WIN7系统  切换和使用说明 先按住“alt(opfion)”不放手,然后在按开机键,会进入选择页面,选择win8 会进入 windos页面 ,选择MACintos h HD(Mac)会进 ...

  9. C# string LastIndexOf()

    IndexOf(“FindText",start,len) 中的Start和Len是从左往右数的 LastIndexOf(“FindText",start,len)中的则是从右往左 ...

  10. NCPC 2012 Bread Sorting

    逆序对数的应用: 逆序对数的写法有,二分,树状数组,分治: 学习一下: 树状数组版: 代码: #include<cstdio> #include<cstring> #inclu ...