This is most likely an FAQ, and I apologize for that. But the mail
archives seem to be having issues. Using webcache and search engines,
I've been able to find where some people have asked about this or
something similar, but I haven't been able to find the answers.
Anyway, after doing the make install of glibc-2.16.0 as directed in step
5.7, I attempt to compile a dummy C program to test the toolchain.
> echo 'main(){}' > dummy.c
> $LFS_TGT-gcc dummy.c
This fails as the linker is unable to find crt1.o. Here's the relevant
section of output from $LFS_TGT-gcc -v:
COMPILER_PATH=/mnt/lfs/tools/bin/../libexec/gcc/x86_64-lfs-linux-gnu/4.7.1/:/mnt/lfs/tools/bin/../libexec/gcc/:/mnt/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/4.7.1/../../../../x86_64-lfs-linux-gnu/bin/
LIBRARY_PATH=/mnt/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/4.7.1/:/mnt/lfs/tools/bin/../lib/gcc/:/mnt/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/4.7.1/../../../../x86_64-lfs-linux-gnu/lib/:/mnt/lfs/tools/lib
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64'
/mnt/lfs/tools/bin/../libexec/gcc/x86_64-lfs-linux-gnu/4.7.1/collect2
--sysroot=/mnt/lfs --eh-frame-hdr -m elf_x86_64 -dynamic-linker
/tools/lib64/ld-linux-x86-64.so.2 crt1.o crti.o
/mnt/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/4.7.1/crtbegin.o
-L/mnt/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/4.7.1
-L/mnt/lfs/tools/bin/../lib/gcc
-L/mnt/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/4.7.1/../../../../x86_64-lfs-linux-gnu/lib
-L/mnt/lfs/tools/lib /tmp/ccBLVS1U.o -lgcc -lc -lgcc
/mnt/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/4.7.1/crtend.o crtn.o
/mnt/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/4.7.1/../../../../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/4.7.1/../../../../x86_64-lfs-linux-gnu/bin/ld:
cannot find crti.o: No such file or directory
The install of glibc placed it in /tools/lib, and supplying that info on
the command line (-B/tools/lib) allows the compile to succeed:
COMPILER_PATH=/tools/lib/:/mnt/lfs/tools/bin/../libexec/gcc/x86_64-lfs-linux-gnu/4.7.1/:/mnt/lfs/tools/bin/../libexec/gcc/:/mnt/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/4.7.1/../../../../x86_64-lfs-linux-gnu/bin/
LIBRARY_PATH=/tools/lib/:/mnt/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/4.7.1/:/mnt/lfs/tools/bin/../lib/gcc/:/mnt/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/4.7.1/../../../../x86_64-lfs-linux-gnu/lib/:/mnt/lfs/tools/lib
COLLECT_GCC_OPTIONS='-v' '-B' '/tools/lib' '-mtune=generic' '-march=x86-64'
/mnt/lfs/tools/bin/../libexec/gcc/x86_64-lfs-linux-gnu/4.7.1/collect2
--sysroot=/mnt/lfs --eh-frame-hdr -m elf_x86_64 -dynamic-linker
/tools/lib64/ld-linux-x86-64.so.2 /tools/lib/crt1.o /tools/lib/crti.o
/mnt/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/4.7.1/crtbegin.o
-L/tools/lib -L/mnt/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/4.7.1
-L/mnt/lfs/tools/bin/../lib/gcc
-L/mnt/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/4.7.1/../../../../x86_64-lfs-linux-gnu/lib
-L/mnt/lfs/tools/lib /tmp/ccfKHIb7.o -lgcc -lc -lgcc
/mnt/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/4.7.1/crtend.o
/tools/lib/crtn.o
Using -B/mnt/lfs/tools/lib also works, as expected:
COMPILER_PATH=/mnt/lfs/tools/lib/:/mnt/lfs/tools/bin/../libexec/gcc/x86_64-lfs-linux-gnu/4.7.1/:/mnt/lfs/tools/bin/../libexec/gcc/:/mnt/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/4.7.1/../../../../x86_64-lfs-linux-gnu/bin/
LIBRARY_PATH=/mnt/lfs/tools/lib/:/mnt/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/4.7.1/:/mnt/lfs/tools/bin/../lib/gcc/:/mnt/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/4.7.1/../../../../x86_64-lfs-linux-gnu/lib/:/mnt/lfs/tools/lib
COLLECT_GCC_OPTIONS='-v' '-B' '/mnt/lfs/tools/lib' '-mtune=generic'
'-march=x86-64'
/mnt/lfs/tools/bin/../libexec/gcc/x86_64-lfs-linux-gnu/4.7.1/collect2
--sysroot=/mnt/lfs --eh-frame-hdr -m elf_x86_64 -dynamic-linker
/tools/lib64/ld-linux-x86-64.so.2 /mnt/lfs/tools/lib/crt1.o
/mnt/lfs/tools/lib/crti.o
/mnt/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/4.7.1/crtbegin.o
-L/mnt/lfs/tools/lib
-L/mnt/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/4.7.1
-L/mnt/lfs/tools/bin/../lib/gcc
-L/mnt/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/4.7.1/../../../../x86_64-lfs-linux-gnu/lib
-L/mnt/lfs/tools/lib /tmp/ccOcNwMs.o -lgcc -lc -lgcc
/mnt/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/4.7.1/crtend.o
/mnt/lfs/tools/lib/crtn.o
So, clearly the problem is that ld isn't looking for crt1.o where it
resides. Obviously, I've done something wrong on a preceding step, but
I'm unable to find it.
But I don't know which step is wrong. Did make install of glibc install
it in the wrong place? Is ld looking in the wrong place? Did gcc tell ld
to look in the wrong place? I see that gcc did supply
-L/mnt/lfs/tools/lib to ld, which clearly didn't help for the .o files,
but only for libraries.
Now, I could go on, ignoring this issue. Compiling binutils again is
next, and I'm pretty sure I can pass appropriate options to configure to
enable binutils to compile properly. But I'm worried that this will
cause problems farther down the line, so I'd prefer to fix this cleanly
now, rather than continue to jump through hoops as the build progresses.
Any thoughts?
--
Chris J. Breisch<http://www.sports-gazer.com>
--
http://linuxfromscratch.org/mailman/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page