Subject: Re: Packages that use X, but not IMAKE, fail to find all libs
To: Tim Rightnour <root@garbled.net>
From: Frederick Bruckman <fb@enteract.com>
List: tech-pkg
Date: 11/14/1998 10:35:45
On Sat, 14 Nov 1998, Tim Rightnour wrote:

> Your fix would have lost the -Wl targets on elf, causing the generated binaries
> to be completely useless.  (I didn't add -L${X11BASE}/lib because I believe it
> is allready pulled in by bsd.pkg.mk with a X11 package.)

AHA! That's the whole point. LDFLAGS=-L{X11BASE)/lib is _not_ in
CONFIGURE_ENV by default. [Run "make configure" on Mosaic, and then
view config.log in the work directory.] What's more, the existing
work-around for Mosaic doesn't work, because it gets clobbered by the
following in bsd.pkg.mk:

.if defined(USE_MOTIF) || defined(USE_X11)
LDFLAGS+=               -Wl,-R${X11BASE}/lib
.endif
LDFLAGS+=               -Wl,-R${LOCALBASE}/lib
MAKE_ENV+=              LDFLAGS="${LDFLAGS}"
CONFIGURE_ENV+=         LDFLAGS="${LDFLAGS}"

Frankly, I don't understand why. If LDFLAGS=-L/usr/X11R6/lib is set in
the environment before running make, as opposed to the Makefile, it
all comes through. Furthermore, CFLAGS is not so clobbered.

An alternative is to make this change to bsd.pkg.mk:

.if defined(USE_MOTIF) || defined(USE_X11)
-LDFLAGS+=               -Wl,-R${X11BASE}/lib
+LDFLAGS+=               -Wl,-R${X11BASE}/lib -L${X11BASE}/lib
.endif
LDFLAGS+=               -Wl,-R${LOCALBASE}/lib
MAKE_ENV+=              LDFLAGS="${LDFLAGS}"
CONFIGURE_ENV+=         LDFLAGS="${LDFLAGS}"

The analog for LOCALBASE doesn't seem to be necessary, as most
configure scripts add -L${prefix}/lib to LDFLAGS, (but it probably
couldn't hurt).

I truly feel that this is a rank error in the configure script, to
look for the X libs only in ${prefix}, even after stating "Found X
libraries in /usr/X11R6/lib, headers in /usr/X11R6/include," but I
can't figure out how to fix that. OTH, there are at least two packages
with this problem (Mosaic and rxvt), and there may be more, so maybe
it wouldn't be a bad idea to patch bsd.pkg.mk for their benefit.