home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / hp / 8781 < prev    next >
Encoding:
Internet Message Format  |  1992-07-31  |  2.8 KB

  1. Path: sparky!uunet!olivea!decwrl!mips!sdd.hp.com!hpscdc!cupnews0.cup.hp.com!hppad.waterloo.hp.com!hppad!hpfcso!hpcuhb!hpcuhe!curtw
  2. From: curtw@hpcuhe.cup.hp.com (Curt Wohlgemuth)
  3. Newsgroups: comp.sys.hp
  4. Subject: Re: -lPW problems again!
  5. Message-ID: <31480212@hpcuhe.cup.hp.com>
  6. Date: 30 Jul 92 21:57:51 GMT
  7. References: <NEAL.92Jul29163818@neal.ctd.comsat.com>
  8. Organization: Hewlett Packard, Cupertino
  9. Lines: 49
  10.  
  11. neal@neal.ctd.comsat.com (Neal Becker) writes:
  12.  
  13. > OK, I thought I had this think licked.  It says:
  14. >       regcmp and regex are kept in /lib/libPW.a.  Unfortunately,
  15. >       /lib/libPW.a also contains some functions that have the same names as
  16. >       functions contained in the default C library, /lib/libc.a.  To prevent
  17. >       unexpected results due to these name conflicts, always search libc
  18. >       before searching libPW.  This is done with the ld (or cc) command line
  19. >       option sequence -lc -lPW which satisifies all standard C functions
  20. >       from libc then searches libPW for the regcmp and regex functions
  21. >       (there is also an implied -lc following the explicit -lPW to satisfy
  22. >       any additional C functions required by regcmp and regex).
  23. > So why do I get this?
  24. > /a/flyhalf/images/X11R4/contrib/clients/xmgr-2.07%     cc main.o xmgr.o events.o malerts.o fileswin.o blockwin.o eblockwin.o printwin.o drawwin.o comwin.o compwin.o setwin.o ptswin.o editpwin.o regionwin.o statuswin.o symwin.o tickwin.o graphwin.o worldwin.o strwin.o labelwin.o locatewin.o framewin.o monwin.o plotone.o stubs.o files.o utils.o drawticks.o fit.o fourier.o io.o graphutils.o graphutils2.o setutils.o setprops.o regionutils.o objutils.o computils.o defaults.o checkon.o params.o getparms.o compute
  25.  
  26.  
  27.  
  28.  
  29. o xvlib.o draw.o ps.o mif.o hp.o chersh.o pars.o WidgetWrap.o motifutils.o -o xmgr  -L/usr/lib/X11R4 -L/usr/lib/Motif1.1 -lXm -lXt -lX11 -lm -lc -lPW
  30. > /bin/ld: Unsatisfied symbols:
  31. >    free (code)
  32. >    malloc (code)
  33. >    write (code)
  34. > ----------
  35.  
  36. I'm not completely sure of this, but...
  37.  
  38. cc(1) sticks an implicit "-lc" as the last argument to the linker for you,
  39. as it says in the description above.  By default, though, you're linking
  40. your "xmgr" application with shared libraries; the linker will __not__
  41. search any shared library on the link line twice.
  42.  
  43. You have (at least) two alternatives:
  44.  
  45. 1) Link "xmgr" with archive libraries:  "-Wl,-a,archive", at the _front_
  46.    of your cc command line; or set the envvar LDOPTS="-a archive".
  47.  
  48. 2) Make sure the last "-lc" that cc sends to ld is the archive version:
  49.    specify "-Wl,-a,archive" at the _end_ of your cc command line.  This
  50.    will result in this link line:
  51.  
  52.    ld /lib/crt0.o ... -lm -.c -lPW -a archive -lc
  53.  
  54.    which will force /lib/libc.a to be used to resolve those unsats generated
  55.    by libPW.a
  56.  
  57. Official disclaimer specified, etc., etc.
  58.  
  59. Curt Wohlgemuth
  60. California Language Lab
  61.