Re: Glibc build fail

"Xi Ruoyao" ([email protected] via lfs-support Mailing List) <[email protected]>
Newsgroups gmane.linux.lfs.support
Message-ID <[email protected]>
On Thu, 2024-11-07 at 19:08 +0000, kevadesu wrote:
> Hi, sorry to intrude and disturb everyone with this post, but I'm having some
> issues with compiling Glibc 2.40 in Chapter 5.5
> Book is Linux From Scratch - Version 12.2-systemd
> The following error appears:
> 
> x86_64-lfs-linux-gnu-gcc -Wl,-rpath-link=/mnt/lfs/sources/glibc/build:/mnt/
> lfs/sources/glibc/build/math:/mnt/lfs/sources/glibc/build/elf:/mnt/lfs/
> sources/glibc/build/dlfcn:/mnt/lfs/sources/glibc/build/nss:/mnt/lfs/sources/
> glibc/build/nis:/mnt/lfs/sources/glibc/build/rt:/mnt/lfs/sources/glibc/build/
> resolv:/mnt/lfs/sources/glibc/build/mathvec:/mnt/lfs/sources/glibc/build/
> support:/mnt/lfs/sources/glibc/build/nptl -o /mnt/lfs/sources/glibc/build/
> support/links-dso-program -pie -Wl,-z,pack-relative-relocs -Wl,-O1 -nostdlib -
> nostartfiles -Wl,-z,mark-plt   -Wl,-z,relro  /mnt/lfs/sources/glibc/build/csu/
> Scrt1.o /mnt/lfs/sources/glibc/build/csu/crti.o `x86_64-lfs-linux-gnu-gcc -
> Wl,-z,mark-plt --print-file-name=crtbeginS.o` /mnt/lfs/sources/glibc/build/
> support/links-dso-program.o -lstdc++ -lgcc -lgcc_s  -Wl,-dynamic-linker=/usr/
> lib/ld-linux-x86-64.so.2  /mnt/lfs/sources/glibc/build/libc.so.6 /mnt/lfs/
> sources/glibc/build/libc_nonshared.a -Wl,--as-needed /mnt/lfs/sources/glibc/
> build/elf/ld.so -Wl,--no-as-needed -lgcc  `x86_64-lfs-linux-gnu-gcc -Wl,-
> z,mark-plt --print-file-name=crtendS.o` /mnt/lfs/sources/glibc/build/csu/
> crtn.o
> /mnt/lfs/tools/lib/gcc/x86_64-lfs-linux-gnu/14.2.0/../../../../x86_64-lfs-
> linux-gnu/bin/ld: cannot find -lgcc_s: No such file or directory
> collect2: error: ld returned 1 exit status

This shouldn't happen building LFS.  At the point building Chapter 5
Glibc, libstdc++ is not available so Glibc will build links-dso-program-
c instead of links-dso-program which requires C++.  The former also does
not need -lgcc_s.  In my log:

checking whether x86_64-lfs-linux-gnu-g++ can link programs... no

and then...

x86_64-lfs-linux-gnu-gcc -Wl,-rpath-link=/mnt/build_dir/sources/glibc-
2.40/build:/mnt/build_dir/sources/glibc-
2.40/build/math:/mnt/build_dir/sources/glibc-
2.40/build/elf:/mnt/build_dir/sources/glibc-
2.40/build/dlfcn:/mnt/build_dir/sources/glibc-
2.40/build/nss:/mnt/build_dir/sources/glibc-
2.40/build/nis:/mnt/build_dir/sources/glibc-
2.40/build/rt:/mnt/build_dir/sources/glibc-
2.40/build/resolv:/mnt/build_dir/sources/glibc-
2.40/build/mathvec:/mnt/build_dir/sources/glibc-
2.40/build/support:/mnt/build_dir/sources/glibc-2.40/build/nptl -o
/mnt/build_dir/sources/glibc-2.40/build/support/links-dso-program-c -pie
-Wl,-z,pack-relative-relocs -Wl,-O1 -nostdlib -nostartfiles -Wl,-z,mark-
plt   -Wl,-z,relro  /mnt/build_dir/sources/glibc-2.40/build/csu/Scrt1.o
/mnt/build_dir/sources/glibc-2.40/build/csu/crti.o `x86_64-lfs-linux-
gnu-gcc -Wl,-z,mark-plt --print-file-name=crtbeginS.o`
/mnt/build_dir/sources/glibc-2.40/build/support/links-dso-program-c.o  -
Wl,-dynamic-linker=/usr/lib/ld-linux-x86-64.so.2 
/mnt/build_dir/sources/glibc-2.40/build/libc.so.6
/mnt/build_dir/sources/glibc-2.40/build/libc_nonshared.a -Wl,--as-needed
/mnt/build_dir/sources/glibc-2.40/build/elf/ld.so -Wl,--no-as-needed -
lgcc  `x86_64-lfs-linux-gnu-gcc -Wl,-z,mark-plt --print-file-
name=crtendS.o` /mnt/build_dir/sources/glibc-2.40/build/csu/crtn.o

So does your build have "yes" instead for "whether x86_64-lfs-linux-gnu-
g++ can link programs"?  Can you attach config.log in your build
directory for analysis?

-- 
Xi Ruoyao <[email protected]>
School of Aerospace Science and Technology, Xidian University

-- 
http://lists.linuxfromscratch.org/sympa/info/lfs-support
Unsubscribe: See the above information page
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.