Article View: gnu.gcc.bug
Article #179gcc bug?
From: Chris P. Ross
Date: Tue, 21 Jul 1992 13:29
Date: Tue, 21 Jul 1992 13:29
37 lines
2563 bytes
2563 bytes
Hi. I have another situation that I am curious about. Perhaps I just
don't know how to get gcc to do what I want, but I thought it was worth
asking...
I'm trying to compile an X client program on a Sun Sparc (SunOS 4.1.1)
and I want it to be staticly linked to the X libraries, but dynamicly
linked to the C library.
The line that make produces is:
gcc -fpcc-struct-return -o chooser-static chooser.o -O2 -static -L../.././lib/Xaw -lXaw -L../.././lib/Xmu -lXmu -L../.././lib/Xt -lXt -L../.././extensions/lib -lXext -L../.././lib/X -lX11 ../.././lib/Xdmcp/libXdmcp.a -dynamic -ldl -L/usr/local/X11R5/lib
This is, of course, the line setup through imake. So, it has a -static
*and* a -dynamic. I'll get back to this.
The link line that I see by using gcc -v (other than that, it's the
same line as above) is:
/usr/local/gnu/lib/gcc-lib/sun3-sunos4.1/2.2.2/ld -e start -dc -dp -Bstatic -o chooser-static /lib/crt0.o /lib/Mcrt1.o -L../.././lib/Xaw -L../.././lib/Xmu -L../.././lib/Xt -L../.././extensions/lib -L../.././lib/X -L/usr/local/gnu/lib/gcc-lib/sun3-sunos4.1/2.2.2 -L/usr/local/gnu/lib chooser.o -lXaw -lXmu -lXt -lXext -lX11 ../.././lib/Xdmcp/libXdmcp.a -lgcc -lc -L/usr/lib/f68881 -lgcc
Now, this line will die, failing to find the routines _dlsym, _dlopen,
and _dlclose. These routines exist in a library for which there is no .a,
only a .so.*. So, the fix for that would be to have the above line read:
/usr/local/gnu/lib/gcc-lib/sun3-sunos4.1/2.2.2/ld -e start -dc -dp -Bstatic -o chooser-static /lib/cr
t0.o /lib/Mcrt1.o -L../.././lib/Xaw -L../.././lib/Xmu -L../.././lib/Xt -L../.././extensions/lib -L../
.././lib/X -L/usr/local/gnu/lib/gcc-lib/sun3-sunos4.1/2.2.2 -L/usr/local/gnu/lib chooser.o -lXaw -lXm
u -lXt -lXext -lX11 ../.././lib/Xdmcp/libXdmcp.a -lgcc -Bdynamic -lc -L/usr/lib/f68881 -lgcc
instead. The -Bdynamic before the -lc will create a dynamic link to the dl
library. I was assuming that -dynamic on the compile line would do this,
but it appears not to. Is there any way to get this behaviour, short of
hand-linking?
Thanks...
- Chris Ross
Technical Details
Message-ID:
<199207212129.AA01305@fomalhaut.eng.umd.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!eng.umd.edu!crossShow Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!eng.umd.edu!cross From: cross@eng.umd.edu (Chris P. Ross) Subject: gcc bug? Message-ID: <199207212129.AA01305@fomalhaut.eng.umd.edu> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Tue, 21 Jul 1992 13:29:00 GMT Approved: bug-gcc@prep.ai.mit.edu Lines: 38