home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / gnu / gcc / bug / 1964 < prev    next >
Encoding:
Text File  |  1992-07-23  |  2.5 KB  |  51 lines

  1. Newsgroups: gnu.gcc.bug
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!eng.umd.edu!cross
  3. From: cross@eng.umd.edu (Chris P. Ross)
  4. Subject: gcc bug?
  5. Message-ID: <199207212129.AA01305@fomalhaut.eng.umd.edu>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Tue, 21 Jul 1992 13:29:00 GMT
  10. Approved: bug-gcc@prep.ai.mit.edu
  11. Lines: 38
  12.  
  13.   Hi.  I have another situation that I am curious about.  Perhaps I just
  14. don't know how to get gcc to do what I want, but I thought it was worth
  15. asking...
  16.  
  17.   I'm trying to compile an X client program on a Sun Sparc (SunOS 4.1.1)
  18. and I want it to be staticly linked to the X libraries, but dynamicly
  19. linked to the C library.
  20.  
  21.   The line that make produces is:
  22.  
  23. 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
  24.  
  25.   This is, of course, the line setup through imake.  So, it has a -static
  26. *and* a -dynamic.  I'll get back to this.
  27.  
  28.   The link line that I see by using gcc -v (other than that, it's the
  29. same line as above) is:
  30.  
  31. /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
  32.  
  33.   Now, this line will die, failing to find the routines _dlsym, _dlopen,
  34. and _dlclose.  These routines exist in a library for which there is no .a,
  35. only a .so.*.  So, the fix for that would be to have the above line read:
  36.  
  37. /usr/local/gnu/lib/gcc-lib/sun3-sunos4.1/2.2.2/ld -e start -dc -dp -Bstatic -o chooser-static /lib/cr
  38. t0.o /lib/Mcrt1.o -L../.././lib/Xaw -L../.././lib/Xmu -L../.././lib/Xt -L../.././extensions/lib -L../
  39. .././lib/X -L/usr/local/gnu/lib/gcc-lib/sun3-sunos4.1/2.2.2 -L/usr/local/gnu/lib chooser.o -lXaw -lXm
  40. u -lXt -lXext -lX11 ../.././lib/Xdmcp/libXdmcp.a -lgcc -Bdynamic -lc -L/usr/lib/f68881 -lgcc
  41.  
  42. instead.  The -Bdynamic before the -lc will create a dynamic link to the dl
  43. library.  I was assuming that -dynamic on the compile line would do this,
  44. but it appears not to.  Is there any way to get this behaviour, short of
  45. hand-linking?
  46.  
  47.   Thanks...
  48.  
  49.                                  - Chris Ross
  50.  
  51.