Subject: pkg/9914: bogus use of unset MOTIFBASE in bsd.pkg.mk
To: None <gnats-bugs@gnats.netbsd.org>
From: None <John.P.Darrow@wheaton.edu>
List: netbsd-bugs
Date: 04/17/2000 14:51:12
>Number: 9914
>Category: pkg
>Synopsis: bogus use of unset MOTIFBASE in bsd.pkg.mk
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Apr 17 14:52:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: John Darrow
>Release: pkgsrc 2000-04-17
>Organization:
Computing Services, Wheaton College, Wheaton, IL
>Environment:
System: NetBSD jdarrowpiii.wheaton.edu 1.4V NetBSD 1.4V (JDARROW) #0: Tue Mar 21 15:04:28 CST 2000 jdarrow@jdarrowpiii.wheaton.edu:/var/src/sys/arch/i386/compile/JDARROW i386
>Description:
bsd.pkg.mk only defines MOTIFBASE if USE_MOTIF is set (lines 101-109).
However, it later uses MOTIFBASE in setting LDFLAGS if any of USE_MOTIF,
USE_X11BASE, or USE_X11 is set (lines 218-220).
Later, it sets MOTIFLIB using MOTIFBASE, without any conditionals at all
(line 629).
As a result of these, programs can end up with library link paths (-L) and
runtime loader paths (-Wl,-R) of /lib. While /lib doesn't currently exist
in a default installation of NetBSD, it does result in an unnecessary lookup
both at link time and at runtime. And somebody using /lib for something of
their own could possibly get burned.
>How-To-Repeat:
Build Mesa, notice configure line:
checking whether the C compiler (cc -O2 -Wl,-R/lib -L/lib -Wl,-R/usr/X11R6/lib -L/usr/X11R6/lib -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -Wl,-R/lib -L/lib -Wl,-R/usr/X11R6/lib -L/usr/X11R6/lib -Wl,-R/usr/pkg/lib -L/usr/pkg/lib) works... yes
See that configure line contains bogus "-Wl,-R/lib -L/lib" entries.
Search around in bsd.pkg.mk.
>Fix:
Conditionalize all MOTIFBASE stuff on USE_MOTIF. We should also then
conditionalize the use of MOTIFLIB in MAKE_ENV.
Index: /var/pkgsrc/mk/bsd.pkg.mk
===================================================================
RCS file: /source/cvs/netbsd/current/pkgsrc/mk/bsd.pkg.mk,v
retrieving revision 1.1.1.77
diff -u -r1.1.1.77 bsd.pkg.mk
--- bsd.pkg.mk 2000/04/17 18:48:12 1.1.1.77
+++ bsd.pkg.mk 2000/04/17 21:47:27
@@ -216,15 +216,22 @@
.endif
.if defined(USE_MOTIF) || defined(USE_X11BASE) || defined(USE_X11)
-LDFLAGS+= -Wl,-R${MOTIFBASE}/lib -L${MOTIFBASE}/lib -Wl,-R${X11BASE}/lib -L${X11BASE}/lib
+.if defined(USE_MOTIF)
+LDFLAGS+= -Wl,-R${MOTIFBASE}/lib -L${MOTIFBASE}/lib
.endif
+LDFLAGS+= -Wl,-R${X11BASE}/lib -L${X11BASE}/lib
+.endif
LDFLAGS+= -Wl,-R${LOCALBASE}/lib -L${LOCALBASE}/lib
MAKE_ENV+= LDFLAGS="${LDFLAGS}"
CONFIGURE_ENV+= LDFLAGS="${LDFLAGS}" M4="${M4}" YACC="${YACC}"
MAKE_FLAGS?=
MAKEFILE?= Makefile
-MAKE_ENV+= PATH=${PATH}:${LOCALBASE}/bin:${X11BASE}/bin PREFIX=${PREFIX} LOCALBASE=${LOCALBASE} X11BASE=${X11BASE} MOTIFLIB="${MOTIFLIB}" CFLAGS="${CFLAGS}"
+MAKE_ENV+= PATH=${PATH}:${LOCALBASE}/bin:${X11BASE}/bin PREFIX=${PREFIX} LOCALBASE=${LOCALBASE} X11BASE=${X11BASE} CFLAGS="${CFLAGS}"
+
+.if defined(USE_MOTIF)
+MAKE_ENV+= MOTIFLIB="${MOTIFLIB}"
+.endif
.if exists(/usr/bin/fetch)
FETCH_CMD?= /usr/bin/fetch
@@ -626,7 +633,9 @@
PKG_DBDIR?= ${DESTDIR}/var/db/pkg
# shared/dynamic motif libs
+.if defined(USE_MOTIF)
MOTIFLIB?= -L${MOTIFBASE}/lib -L${X11BASE}/lib -L${LOCALBASE}/lib -Wl,-R${MOTIFBASE}/lib -Wl,-R${X11BASE}/lib -Wl,-R${LOCALBASE}/lib -lXm
+.endif
# Define SMART_MESSAGES in /etc/mk.conf for messages giving the tree
# of depencies for building, and the current target.
>Release-Note:
>Audit-Trail:
>Unformatted: