: > I have this message when I try to compile using options -g or -p with -lm :
: >
: > ld : Output file requires shared library 'libc.so.4'
: > gcc: Internal compiler error: program ld goto fatal signal 6.
: >
: > I tried -g apart and -lm apart, the compilation was fine.
: > Can you help me?
: Is this with the Slackware 2.2 distribution? I believe there is a bug, and
: I think the following is a fix. It worked for me.
: > cd /usr/lib/gcc-lib/i486-linux/2.6.3
: edit "specs"
: Now change these old lines:
: %{mieee-fp:-lieee} %{p:-lgmon -lc_p} %{pg:-lgmon -lc_p} ....<continued!>
: %{!p:%{!pg:%{!g*:-lc} %{g*:-lg}}}
: to this:
: %{mieee-fp:-lieee} %{p:-lgmon -lc_p -lc} %{pg:-lgmon -lc_p -lc} ....<cont'ed!>
: ^^^ ^^^
: %{!p:%{!pg:%{!g*:-lc} %{g*:-lg -lc}}}
: ^^^
: I think that should work.
Actually, it's much simpler than that. The problem is that when using -g,
the compiler tries to find a libg.sa, i.e., the stub file for libg.so.4, in
order to compile the source program as a shared object, using the shared
object libc, compiled with -g (that is, libg.so.4). However, that file is
not there, as very few users will need to debug libc code. Nevertheless,
the loader (ld, that is) is quite fussy about not being able to find the
file, and complains. The solution is to:
1. go in /usr/lib and
2. ln -s libc.sa libg.sa
effectively instructing the loader to use the standard libc.sa when wanting
to use libg.sa. The above problem does not exist when compiling staticly,
since a symbolic link named libg.a already exists in /usr/lib, pointing to
libc.a.
Dimitri