Subject: pkg/18333: CFLAGS weirdness
To: None <gnats-bugs@gnats.netbsd.org>
From: Jan Schaumann <jschauma@lapdog.netbsd.org>
List: netbsd-bugs
Date: 09/18/2002 22:04:07
>Number:         18333
>Category:       pkg
>Synopsis:       CFLAGS+= not working, observed in pkgtools/rpm2pkg, possibly problem with zlib/buildlinks2
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 18 19:06:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Jan Schaumann
>Release:        NetBSD 1.6H
>Organization:
	
>Environment:
	
	
System: NetBSD lapdog 1.6H NetBSD 1.6H (WUFF) #5: Sat Sep 14 14:53:43 EDT 2002 jschauma@lapdog:/usr/src/sys/arch/i386/compile/WUFF i386
Architecture: i386
Machine: i386
>Description:
	It appears that something odd is happening in pkgtools/rpm2pkg wrt to
	CFLAGS.  If it is set in /etc/mk.conf, CFLAGS+= does add to the definition.
	If it is not set, all's peachy.

	Example:

(81) [rpm2pkg]$ pwd
/usr/pkgsrc/pkgtools/rpm2pkg
(82) [rpm2pkg]$ grep CFLAGS /etc/mk.conf
CFLAGS=-O2 -march=pentium -mcpu=pentiumpro
(83) [rpm2pkg]$ grep CFLAGS Makefile 
CFLAGS+=        -I${BUILDLINK_DIR}/include/rpm 
		${CFLAGS} ${LDFLAGS} ${LIBS} -o ${WRKSRC}/rpm2pkg
(84) [rpm2pkg]$ make
===> Extracting for rpm2pkg-1.2
===> Required installed package rpm>=2.4.3: rpm-2.5.4 found
===> Patching for rpm2pkg-1.2
===> Buildlinking for rpm2pkg-1.2
===> Configuring for rpm2pkg-1.2
===> Building for rpm2pkg-1.2
/usr/pkgsrc/pkgtools/rpm2pkg/work/.buildlink/bin/cc /usr/pkgsrc/pkgtools/rpm2pkg/files/rpm2pkg.c  -I/usr/pkg/include -O2 -march=pentium -mcpu=pentiumpro -L/usr/pkg/lib  -Wl,-R/usr/pkg/lib -L/usr/pkg/lib /usr/pkgsrc/pkgtools/rpm2pkg/work/.buildlink/lib/librpm.a -lintl -lz -o /usr/pkgsrc/pkgtools/rpm2pkg/work/rpm2pkg
/usr/pkgsrc/pkgtools/rpm2pkg/files/rpm2pkg.c:18: rpmlib.h: No such file or directory
*** Error code 1
Stop.
make: stopped in /usr/pkgsrc/pkgtools/rpm2pkg
*** Error code 1
Stop.
make: stopped in /usr/pkgsrc/pkgtools/rpm2pkg
(85) [rpm2pkg]$ 

(86) [rpm2pkg]$ grep CFLAGS /etc/mk.conf
#CFLAGS=-O2 -march=pentium -mcpu=pentiumpro
(87) [rpm2pkg]$ make
===> Building for rpm2pkg-1.2
/usr/pkgsrc/pkgtools/rpm2pkg/work/.buildlink/bin/cc /usr/pkgsrc/pkgtools/rpm2pkg/files/rpm2pkg.c  -I/usr/pkg/include -O2 -I/usr/pkgsrc/pkgtools/rpm2pkg/work/.buildlink/include/rpm -L/usr/pkg/lib  -Wl,-R/usr/pkg/lib -L/usr/pkg/lib /usr/pkgsrc/pkgtools/rpm2pkg/work/.buildlink/lib/librpm.a -lintl -lz -o /usr/pkgsrc/pkgtools/rpm2pkg/work/rpm2pkg
/usr/pkgsrc/pkgtools/rpm2pkg/work/.buildlink/lib/librpm.a(signature.o): In function `verifyPGPSignature':
signature.o(.text+0xa63): warning: tempnam() possibly used unsafely, use mkstemp() or mkdtemp()
(88) [rpm2pkg]$ 


	However, if I place the line which adds to the CFLAGS in the Makefile
	to below 
	.include "../../devel/zlib/buildlink2.mk"
	things work fine again:

(96) [rpm2pkg]$ grep CFLAGS /etc/mk.conf
CFLAGS=-O2 -march=pentium -mcpu=pentiumpro
(97) [rpm2pkg]$ fc -s 87
make
===> Extracting for rpm2pkg-1.2
===> Required installed package rpm>=2.4.3: rpm-2.5.4 found
===> Patching for rpm2pkg-1.2
===> Buildlinking for rpm2pkg-1.2
===> Configuring for rpm2pkg-1.2
===> Building for rpm2pkg-1.2
/usr/pkgsrc/pkgtools/rpm2pkg/work/.buildlink/bin/cc /usr/pkgsrc/pkgtools/rpm2pkg/files/rpm2pkg.c  -I/usr/pkg/include -O2 -march=pentium -mcpu=pentiumpro -I/usr/pkgsrc/pkgtools/rpm2pkg/work/.buildlink/include/rpm -L/usr/pkg/lib  -Wl,-R/usr/pkg/lib -L/usr/pkg/lib /usr/pkgsrc/pkgtools/rpm2pkg/work/.buildlink/lib/librpm.a -lintl -lz -o /usr/pkgsrc/pkgtools/rpm2pkg/work/rpm2pkg
/usr/pkgsrc/pkgtools/rpm2pkg/work/.buildlink/lib/librpm.a(signature.o): In function `verifyPGPSignature':
signature.o(.text+0xa63): warning: tempnam() possibly used unsafely, use mkstemp() or mkdtemp()

>How-To-Repeat:
	Set CFLAGS in /etc/mk.conf
	cd /usr/pkgsrc/pkgtools/rpm2pkg
	make
>Fix:
	Sorry, no clue.
>Release-Note:
>Audit-Trail:
>Unformatted: