【问题标题】:Linux from Scratch 5.7.2 Toolchain sanity check从零开始的 Linux 5.7.2 工具链完整性检查
【发布时间】:2016-04-28 10:56:08
【问题描述】:

我前段时间开始了“Linux from Scratch”项目。首先,我从 Ubuntu 15.10 64bit 开始,并根据 PDF 文件进行所有操作。通过第 5.7.2 段中的检查,它没有工作。之后我重新开始,使用 CentOS 7.2,但它不起作用。在这两次尝试中,我在编译和安装以前的包时都没有出错。

输入:

echo 'int main(){}' > dummy.c
$LFS_TGT-gcc dummy.c

输出:

/mnt/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/5.3.0/../../../../x86_64-lfs-linux-gnu/bin/ld: cannot find crt1.o: No such file or directory
/mnt/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/5.3.0/../../../../x86_64-lfs-linux-gnu/bin/ld: cannot find crti.o: No such file or directory
/mnt/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/5.3.0/../../../../x86_64-lfs-linux-gnu/bin/ld: cannot find -lc
/mnt/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/5.3.0/../../../../x86_64-lfs-linux-gnu/bin/ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status

输入:

readelf -l a.out | grep ': /tools'

输出:

readelf: Error: 'a.out': No such file

我没有找到适用于 StackOverFlow 或不同平台的解决方案。

这是version-check.sh 的输出:

lfs:~$ bash version-check.sh
bash, version 4.2.46(1)-release
/bin/sh -> /usr/bin/bash
Binutils: version 2.23.52.0.1-55.el7 20130226
bison (GNU Bison) 2.7
/usr/bin/yacc -> /usr/bin/bison
bzip2,  Version 1.0.6, 6-Sept-2010.
Coreutils:  8.22
diff (GNU diffutils) 3.3
find (GNU findutils) 4.5.11
GNU Awk 4.0.2
/usr/bin/awk -> /usr/bin/gawk
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4)
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4)
(GNU libc) 2.17
grep (GNU grep) 2.20
gzip 1.5
Linux version 3.10.0-327.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) ) #1 SMP Thu Nov 19 22:10:57 UTC 2015
m4 (GNU M4) 1.4.16
GNU Make 3.82
GNU patch 2.7.1
Perl version='5.16.3';
sed (GNU sed) 4.2.2
tar (GNU tar) 1.26
makeinfo (GNU texinfo) 5.1
xz (XZ Utils) 5.1.2alpha
g++ compilation OK

我的 LSF 用户的 ~/.bashrc:

set +h
umask 022
LFS=/mnt/lfs
LC_ALL=POSIX
LFS_TGT=$(uname -m)-lfs-linux-gnu
PATH=/tools/bin:/bin:/usr/bin
export LFS LC_ALL LFS_TGT PATH

我的 LFS 用户的 ~/.bash_profile

exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash

感谢您的帮助!

【问题讨论】:

  • 当我第一次看到“我开始这个项目......”时,我很惊讶,过了一段时间我意识到你的意思是你开始学习它了。

标签: linux linux-from-scratch


【解决方案1】:

当您没有正确安装Binutils 软件包时会发生此错误。 ldbinutils 包提供。

请遵守书中提供的步骤,稍有偏差就会导致此类错误。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多