[lfs-support] 1st $LFS_TGT-gcc compilation test fails

Pierre Labastie pierre.labastie at neuf.fr
Sun May 8 01:08:02 PDT 2016

On 08/05/2016 09:02, graham.crowe at telia.com wrote:
> Hi,
> I'm trying to build LFS 7.9 and the host system is Debian 8.4.0. The
> compilation test in chapter 5.7 "Glibc-2.23" fails:
>> $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
> collect2: error: ld returned 1 exit status
> However it works if add the argument -B/tools/lib, see the attached log file,
> I have also added -v for verbosity. So I guess something is wrong with either
> the binutils, gcc, or glibc steps. This failure causes the configure step for
> libstdc++-5.3.0 to fail. Any ideas?
> Thanks//Graham
Hi Graham,

>From the attached log:
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64'
 /mnt/lfs/tools/bin/../libexec/gcc/x86_64-lfs-linux-gnu/5.3.0/collect2 -plugin
-plugin-opt=-fresolution=/tmp/ccAdJoz8.res -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc
--sysroot=/mnt/lfs --eh-frame-hdr -m elf_x86_64 -dynamic-linker
/tools/lib64/ld-linux-x86-64.so.2 crt1.o crti.o
                      ^^^^^^ ^^^^^^
/tmp/ccq6OsYC.o -lgcc -lc -lgcc /mnt/lfs/tools/bin/../lib/gcc/x86_64-
lfs-linux-gnu/5.3.0/crtend.o crtn.o

The faulty part is denoted by ^^^^ (hope you read your mail with fixed width
font). Normally, it should be:
<LFS mount point>/tools/lib/../lib64/crt1.o
and same for crti.o crtn.o.

It looks like the glibc part went wrong. Did you log out and then in between
gcc compilation and glibc compilation? It might explain that $LFS_TGT was not
correctly set. Also double check your configure command. It is easy to forget
a backslash at the end of a line, and then miss part of the configure command.

Another diagnostic could be to add -Wl,-verbose to the test compilation
command, and see where ld looks for crt(x).o.


More information about the lfs-support mailing list