home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!decwrl!mips!sdd.hp.com!hpscdc!cupnews0.cup.hp.com!hppad.waterloo.hp.com!hppad!hpfcso!hpcuhb!hpcuhe!curtw
- From: curtw@hpcuhe.cup.hp.com (Curt Wohlgemuth)
- Newsgroups: comp.sys.hp
- Subject: Re: -lPW problems again!
- Message-ID: <31480212@hpcuhe.cup.hp.com>
- Date: 30 Jul 92 21:57:51 GMT
- References: <NEAL.92Jul29163818@neal.ctd.comsat.com>
- Organization: Hewlett Packard, Cupertino
- Lines: 49
-
- neal@neal.ctd.comsat.com (Neal Becker) writes:
-
- > OK, I thought I had this think licked. It says:
- > regcmp and regex are kept in /lib/libPW.a. Unfortunately,
- > /lib/libPW.a also contains some functions that have the same names as
- > functions contained in the default C library, /lib/libc.a. To prevent
- > unexpected results due to these name conflicts, always search libc
- > before searching libPW. This is done with the ld (or cc) command line
- > option sequence -lc -lPW which satisifies all standard C functions
- > from libc then searches libPW for the regcmp and regex functions
- > (there is also an implied -lc following the explicit -lPW to satisfy
- > any additional C functions required by regcmp and regex).
- >
- > So why do I get this?
- >
- > /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
-
-
-
-
- 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
- > /bin/ld: Unsatisfied symbols:
- > free (code)
- > malloc (code)
- > write (code)
- > ----------
-
- I'm not completely sure of this, but...
-
- cc(1) sticks an implicit "-lc" as the last argument to the linker for you,
- as it says in the description above. By default, though, you're linking
- your "xmgr" application with shared libraries; the linker will __not__
- search any shared library on the link line twice.
-
- You have (at least) two alternatives:
-
- 1) Link "xmgr" with archive libraries: "-Wl,-a,archive", at the _front_
- of your cc command line; or set the envvar LDOPTS="-a archive".
-
- 2) Make sure the last "-lc" that cc sends to ld is the archive version:
- specify "-Wl,-a,archive" at the _end_ of your cc command line. This
- will result in this link line:
-
- ld /lib/crt0.o ... -lm -.c -lPW -a archive -lc
-
- which will force /lib/libc.a to be used to resolve those unsats generated
- by libPW.a
-
- Official disclaimer specified, etc., etc.
-
- Curt Wohlgemuth
- California Language Lab
-