libgcc_s is not linked in applications. Any suggestion?

William Zhou armageddonmagic at 163.com
Wed Feb 22 08:04:42 PST 2006


Hi,

I have been trying to  learn how to build a toolchain these days.

I changed a little bit of the instructions.
1. The prefix of the cross toolchain goes to /ctools_i686-i586.2 instead 
of splitting in /cross-tools and /tools/ directories.
2. gcc-4.0.2-specs.patch is changed accordingly.
3. I changed --with--local-prefix=/tools to 
--with--local-prefix=/ctools_i686-i586.2

When the toolchain finishes, I run a test to see if it works and I got a 
small problem, libgcc_s.so* cannot be found.

The test method comes from LFS book.

# i586-pc-linux-gnu-gcc           dummy.c -o out.586      -Wl,--verbose 
&> dummy.i586

Here are some information from dummy.i586.

SEARCH_DIR("/ctools_i686-i586.2/i586-pc-linux-gnu/lib"); 
SEARCH_DIR("/ctools_i686-i586.2/lib");
.
.
attempt to open /ctools_i686-i586.2/lib/crt1.o succeeded
/ctools_i686-i586.2/lib/crt1.o
attempt to open /ctools_i686-i586.2/lib/crti.o succeeded
/ctools_i686-i586.2/lib/crti.o
attempt to open 
/ctools_i686-i586.2/lib/gcc/i586-pc-linux-gnu/4.0.2/crtbegin.o succeeded
/ctools_i686-i586.2/lib/gcc/i586-pc-linux-gnu/4.0.2/crtbegin.o
attempt to open /tmp/ccs81GZA.o succeeded
/tmp/ccs81GZA.o
attempt to open 
/ctools_i686-i586.2/lib/gcc/i586-pc-linux-gnu/4.0.2/libgcc.so failed
attempt to open 
/ctools_i686-i586.2/lib/gcc/i586-pc-linux-gnu/4.0.2/libgcc.a succeeded
attempt to open 
/ctools_i686-i586.2/lib/gcc/i586-pc-linux-gnu/4.0.2/libgcc_s.so failed
attempt to open 
/ctools_i686-i586.2/lib/gcc/i586-pc-linux-gnu/4.0.2/libgcc_s.a failed
attempt to open 
/ctools_i686-i586.2/lib/gcc/i586-pc-linux-gnu/4.0.2/../../../../i586-pc-linux-gnu/lib/libgcc_s.so 
succeeded
-lgcc_s 
(/ctools_i686-i586.2/lib/gcc/i586-pc-linux-gnu/4.0.2/../../../../i586-pc-linux-gnu/lib/libgcc_s.so)
attempt to open 
/ctools_i686-i586.2/lib/gcc/i586-pc-linux-gnu/4.0.2/libc.so failed
attempt to open 
/ctools_i686-i586.2/lib/gcc/i586-pc-linux-gnu/4.0.2/libc.a failed
attempt to open 
/ctools_i686-i586.2/lib/gcc/i586-pc-linux-gnu/4.0.2/../../../../i586-pc-linux-gnu/lib/libc.so 
failed
attempt to open 
/ctools_i686-i586.2/lib/gcc/i586-pc-linux-gnu/4.0.2/../../../../i586-pc-linux-gnu/lib/libc.a 
failed
attempt to open /ctools_i686-i586.2/lib/libc.so succeeded
opened script file /ctools_i686-i586.2/lib/libc.so
opened script file /ctools_i686-i586.2/lib/libc.so
attempt to open /ctools_i686-i586.2/lib/libc.so.6 succeeded
/ctools_i686-i586.2/lib/libc.so.6
attempt to open /ctools_i686-i586.2/lib/libc_nonshared.a succeeded
(/ctools_i686-i586.2/lib/libc_nonshared.a)elf-init.oS
attempt to open 
/ctools_i686-i586.2/lib/gcc/i586-pc-linux-gnu/4.0.2/libgcc.so failed
attempt to open 
/ctools_i686-i586.2/lib/gcc/i586-pc-linux-gnu/4.0.2/libgcc.a succeeded
attempt to open 
/ctools_i686-i586.2/lib/gcc/i586-pc-linux-gnu/4.0.2/libgcc_s.so failed
attempt to open 
/ctools_i686-i586.2/lib/gcc/i586-pc-linux-gnu/4.0.2/libgcc_s.a failed
attempt to open 
/ctools_i686-i586.2/lib/gcc/i586-pc-linux-gnu/4.0.2/../../../../i586-pc-linux-gnu/lib/libgcc_s.so 
succeeded
-lgcc_s 
(/ctools_i686-i586.2/lib/gcc/i586-pc-linux-gnu/4.0.2/../../../../i586-pc-linux-gnu/lib/libgcc_s.so)
attempt to open 
/ctools_i686-i586.2/lib/gcc/i586-pc-linux-gnu/4.0.2/crtend.o succeeded
/ctools_i686-i586.2/lib/gcc/i586-pc-linux-gnu/4.0.2/crtend.o
attempt to open /ctools_i686-i586.2/lib/crtn.o succeeded
/ctools_i686-i586.2/lib/crtn.o

And results of running ldd and strace
# ldd out.586
        linux-gate.so.1 =>  (0xffffe000)
        libgcc_s.so.1 => not found (WHY?)
        libc.so.6 => /ctools_i686-i586.2/lib/libc.so.6 (0xb7ecc000)
        /ctools_i686-i586.2/lib/ld-linux.so.2 (0xb7fe2000)

# strace ./out.586
execve("./out.586", ["./out.586"], [/* 16 vars */]) = 0
uname({sys="Linux", node="fantasy", ...}) = 0
brk(0)                                  = 0x804a000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or 
directory)
open("/ctools_i686-i586.2/etc/ld.so.cache", O_RDONLY) = -1 ENOENT (No 
such file or directory)
open("/ctools_i686-i586.2/lib/tls/i686/sse2/libgcc_s.so.1", O_RDONLY) = 
-1 ENOENT (No such file or directory)
stat64("/ctools_i686-i586.2/lib/tls/i686/sse2", 0xbffacf0c) = -1 ENOENT 
(No such file or directory)
open("/ctools_i686-i586.2/lib/tls/i686/libgcc_s.so.1", O_RDONLY) = -1 
ENOENT (No such file or directory)
stat64("/ctools_i686-i586.2/lib/tls/i686", 0xbffacf0c) = -1 ENOENT (No 
such file or directory)
open("/ctools_i686-i586.2/lib/tls/sse2/libgcc_s.so.1", O_RDONLY) = -1 
ENOENT (No such file or directory)
stat64("/ctools_i686-i586.2/lib/tls/sse2", 0xbffacf0c) = -1 ENOENT (No 
such file or directory)
open("/ctools_i686-i586.2/lib/tls/libgcc_s.so.1", O_RDONLY) = -1 ENOENT 
(No such file or directory)
stat64("/ctools_i686-i586.2/lib/tls", 0xbffacf0c) = -1 ENOENT (No such 
file or directory)
open("/ctools_i686-i586.2/lib/i686/sse2/libgcc_s.so.1", O_RDONLY) = -1 
ENOENT (No such file or directory)
stat64("/ctools_i686-i586.2/lib/i686/sse2", 0xbffacf0c) = -1 ENOENT (No 
such file or directory)
open("/ctools_i686-i586.2/lib/i686/libgcc_s.so.1", O_RDONLY) = -1 ENOENT 
(No such file or directory)
stat64("/ctools_i686-i586.2/lib/i686", 0xbffacf0c) = -1 ENOENT (No such 
file or directory)
open("/ctools_i686-i586.2/lib/sse2/libgcc_s.so.1", O_RDONLY) = -1 ENOENT 
(No such file or directory)
stat64("/ctools_i686-i586.2/lib/sse2", 0xbffacf0c) = -1 ENOENT (No such 
file or directory)
open("/ctools_i686-i586.2/lib/libgcc_s.so.1", O_RDONLY) = -1 ENOENT (No 
such file or directory)
stat64("/ctools_i686-i586.2/lib", {st_mode=S_IFDIR|0755, st_size=2784, 
...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 
0) = 0xb7f99000
writev(2, [{"./out.586", 9}, {": ", 2}, {"error while loading shared 
libra"..., 36}, {": ", 2}, {"libgcc_s.so.1", 13}, {": ", 2}, {"cannot 
open shared object file", 30}, {": ", 2}, {"No such file or directory", 
25}, {"\n", 1}], 10./out.586: error while loading shared libraries: 
libgcc_s.so.1: cannot open shared object file: No such file or directory
) = 122
exit_group(127)                         = ?

The file libgcc_s.so* exists in /ctools_i686-i586.2/i586-pc-linux-gnu/lib.
/ctools_i686-i586.2/i586-pc-linux-gnu/lib/libgcc_s.so.1
/ctools_i686-i586.2/i586-pc-linux-gnu/lib/libgcc_s.so

It seems the location of libgcc_s.so* is not correctly set. What should 
I do to make it search the directory 
/ctools_i686-i586.2/i586-pc-linux-gnu/lib/
instead ?

Any suggestions are appriciated. Thank you.

BTW, How do I reply to one specific thread instead of creating new ones 
every time? I use ThunderBird. Do I have to use another client?

William Zhou




More information about the cross-lfs mailing list