On Sun, Jan 20, 2002 at 01:44:46PM -0800, [EMAIL PROTECTED] wrote: > 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
It shouldn't be looking for libgcc_s.a, it should use libgcc.a (which is in /usr/lib/gcc-lib/..../). > 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? The error seems to be in the specs file. In mine, I have: *libgcc: %{shared-libgcc:-lgcc_s%M -lgcc}%{static-libgcc:-lgcc}%{!shared-libgcc:%{!static-libgcc:%{shared:-lgcc_s%M -lgcc}}}%{!shared-libgcc:%{!static-libgcc:%{!shared:-lgcc}}} This pretty much decrypts into: - If -shared-libgcc, then use -lgcc_s - If -static-libgcc, then use -lgcc - If not -static-libgcc or -shared-libgcc, and -shared, then use -lgcc_s - If not -static-libgcc or -shared-libgcc, and -static, then use -lgcc And that is exactly what it should be, and should work. -- .----------=======-=-======-=========-----------=====------------=-=-----. / Ben Collins -- Debian GNU/Linux \ ` [EMAIL PROTECTED] -- [EMAIL PROTECTED] -- [EMAIL PROTECTED] ' `---=========------=======-------------=-=-----=-===-======-------=--=---'