Bug#438641: /usr/bin/ld: cannot find -lgcc_s
Package: gcc-4.1
Version: 4.1.2-15
Severity: normal
Hi,
I'm trying to build a shared library which is linked statically against
any lib it needs; the -Wl,-static flag there seems to trigger the
following error when the -Wl,-z,defs is in place:
/usr/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status
Here's a simple C file, foo.c, to reproduce the problem:
void foo(void) {
return;
}
Build with:
cc -c -o foo.o foo.c
cc -shared -Wl,-z,defs -o libfoo.so foo.o -Wl,-static
There's no package in the archive providing libgcc_s.a, and I checked
an old gcc-4.1 build log for i386, and only libgcc_s.so seems to be
built.
However, I looked in /usr/lib/gcc/i486-linux-gnu/4.1.3 and found the
symbol in libgcc_eh.a. After I ran "ln -s libgcc_eh.a libgcc_s.a", I
could build the above simple program.
I don't know which signification "libgcc_eh" and "libgcc_s" have, but
it seems to me either gcc should look for libgcc_eh in the above case,
or that it should build libgcc_s.a, or that it shoud symlink libgcc_s.a
towards libgcc_eh.a.
Bye,
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.22-1-686 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages gcc-4.1 depends on:
ii binutils 2.18~cvs20070812-1 The GNU assembler, linker and bina
ii cpp-4.1 4.1.2-15 The GNU C preprocessor
ii gcc-4.1-base 4.1.2-15 The GNU Compiler Collection (base
ii libc6 2.6.1-1 GNU C Library: Shared libraries
ii libgcc1 1:4.2.1-4 GCC support library
Versions of packages gcc-4.1 recommends:
ii libc6-dev 2.6.1-1 GNU C Library: Development Librari
pn libmudflap0-dev <none> (no description available)
-- no debconf information
--
Loïc Minier
Reply to: