libgcc_s and static linking problem

Olivier Delannoy olivier.delannoy@gmail.com
Fri Dec 16 13:34:00 GMT 2005


Hello,
I am new to the list and I am not sure it's the good place for such
question. If I am at the wrong place, please give me hints on where I
should ask this question.

First, I would like to understand the content of libgcc_s.so  ?
My second question is When does a program require libgcc_s ?

I am asking those question because I am having trouble to generate a
static version of my program using gcc 3.3.X on slackware. The same
build process executed on GCC 4.0.0 on redhat works well. I have
checked for the availability of the libgcc_s.so in both case and find
this library at the same place in both case. The annoying error
message follows


/bin/sh ../../../../../libtool --tag=CXX --mode=link g++  -g -O2   -o
yml_worker_xtremweb -all-static -L/home/ode/these/dev/build/lib -lutil
-lpthread    yml_worker_xtremweb-YmlWorker.o
../../../../../src/Yml/Worker/libymlworker.la
g++ -g -O2 -o yml_worker_xtremweb -static
yml_worker_xtremweb-YmlWorker.o  -L/home/ode/these/dev/build/lib
../../../../../src/Yml/Worker/.libs/libymlworker.a
/home/ode/these/dev/build/lib/libutil.a -L/usr/lib
-L/usr/i486-slackware-linux/bin -L/usr/i486-slackware-linux/lib
-L/usr/lib/gcc-lib/i486-slackware-linux/../../../i486-slackware-linux/lib
-L/usr/lib/gcc-lib/i486-slackware-linux/../.. -ldl /usr/lib/libexpat.a
-lpthread /usr/lib/./libstdc++.a -lm -lc -lgcc_s
/usr/lib/gcc-lib/i486-slackware-linux/3.3.6/../../../../i486-slackware-linux/bin/ld:
cannot find -lgcc_s
collect2: ld returned 1 exit status

The problem here is that libgcc_s.so is avvailable in /usr/lib which
appears in the -L line I also made this simple check
ld -L/usr/lib -lgcc_s and ld complains on the _start symbol missing
which means ld find the lib.


Thanks for your help



More information about the Gcc-help mailing list