Subject: Re: Pkgsrc zlib vs. base zlib, NetBSD
To: None <firstname.lastname@example.org>
From: James K. Lowden <email@example.com>
Date: 06/08/2007 19:57:11
Gary Thorpe wrote:
> > > These symbols are found in the pkgsrc version but not in the
> > /usr/lib
> > > version. Should I try moving the -lz around so it comes before
> > > -L/usr/lib?
> > "All `-L' options apply to all `-l' options,
> > regardless of the order in which the options appear."
> > You may wish to spend a little more time with "info ld".
> The problem was one mistyped environment variable using '-R' instead of
> '-L' (which is in the very first line of my edited output).
> Now the build finishes and has a real problem at the end (here is the
> complete output to be more helpful):
> video/hq2x32.o video/hq3x16.o video/hq3x32.o video/hq4x16.o
> video/hq4x32.o video/ntsc.o video/copyvwin.o linux/audio.o
> linux/battery.o linux/sdlintrf.o linux/sdllink.o linux/sw_draw.o
> linux/safelib.o zip/unzip.o zip/zpng.o -I/usr/pkg/include -pipe -I.
> -I/usr/local/include -I/usr/include -D__UNIXSDL__ -D__BSDSDL__
> -I/usr/local/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -D_THREAD_SAFE
> -I/usr/pkg -march=pentium3 -O3 -fomit-frame-pointer -s -fno-rtti
> -L/usr/pkg/lib -Wl,-rpath,/usr/pkg/lib -L/usr/local/lib -L/usr/lib -lz
> -L/usr/local/lib -Wl,-rpath,/usr/local/lib -lSDL -lpthread -L/usr/pkg
> -lpng -lm -lcurses
> ld: warning: libz.so.0, needed by /usr/pkg/lib/libpng.so, may conflict
> with libz.so.1
(For linker errors, it's usually just the whole last command, the one that
produces the executable that matters. In this case, the one that begins
"g++ -o zsnes".)
I'm not sure how to clear up that warning, but let's recap what you're
telling the linkers, in case it helps.
ld(1) is using this search path:
^^^ not that helpful
I think that boils down to
The runtime linker's instructions agree:
And the libraries' symbols are resolved in this order:
I would try this order instead:
and I'd guess you could move -lpthread to the end.
It may be, though, that two parts of your executable are demanding
different major verions (0 and 1) of libz.so. If so, they would need to
be brought into agreement -- by relinking, at least -- before the
resulting executable could be safely run.