[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

GCC-3.0, -static, and -shared-libgcc



It appears that the command line I use in gcc-2.9x for building s
static version of a program fails with gcc-3.0.  It also appears, from
the documentation, that there is a switch to make it work anyway.

This works with the 2.9x version.

  g++ -o bin/program o/object1.o ... -static

This fails

  g++-3.0 -o bin/program o/object1.o ... -static

because gcc-3.0 cannot find the libgcc_s.a file.

  /usr/bin/ld: cannot find -lgcc_s

Indeed, there is no such thing.  According to the man page

  g++-3.0 -o bin/program o/object1.o ... -static -shared-libgcc

ought to prevent a search for the libgcc_s.a library.  Instead, it
returns the same error.

I built gcc-3.0 from source (gcc-3.0-3.0.3ds3) to see if there was a
libgcc_s.a file.  I found none.

So.  I thought I might try to hack it

  cd /usr/lib/gcc-lib/i386-linux=3.0.3
  ln -s libgcc.a libgcc_s.a

  g++-3.0 -o bin/program o/object1.o ... -static

Voila.  The file links and runs.  There is a note in the man page
about how C++ programs need to use a shared version of libgcc.  Can
you shed some light on this?  Should I expect this program run
properly?



Reply to: