NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

re: misc/51098: NetBSD-current fails to build on Debian 7 host



i've tracked this down to a "missing" -D_GNU_SOURCE when host-libiberty
is configuring.  basename(3) (and friends) are all in <string.h> but
a the normal compilation flags don't enable things outside of some other
standard, and so the decl is missed.  we also need to ensure that host
programs use the host libiberty config.h.

i'm not sure what the right solution to this is.  the patch below gets
beyond the latest error, but it's kind of linux specific and not really
something we want to commit as-is.


.mrg.


diff -up -r usr.bin/backend/Makefile usr.bin/backend/Makefile
--- usr.bin/backend/Makefile	2016-03-26 18:05:34.732652354 -0700
+++ usr.bin/backend/Makefile	2016-05-02 23:15:21.252423686 -0700
@@ -8,6 +8,8 @@ SRCS=		${G_OBJS:.o=.c} ${G_out_file:T} r
 
 BOTH_CPPFLAGS+=	-I. -I${GCCARCH} ${G_ALL_CFLAGS:M-D*} ${G_INCLUDES:M-I*:N-I.*}
 CPPFLAGS+=	${BOTH_CPPFLAGS} -DTARGET_NAME=\"${MACHINE_GNU_PLATFORM}\"
+HOST_CPPFLAGS+=	-I${HOST_LIBIBERTYOBJ}/libiberty
+HOST_CPPFLAGS+=	-D_GNU_SOURCE
 HOST_CPPFLAGS+=	${BOTH_CPPFLAGS} -DGENERATOR_FILE
 DPSRCS+=	insn-attr.h insn-codes.h insn-config.h insn-flags.h tree-check.h
 CPPFLAGS+=	-I${DIST}/libgcc
@@ -20,6 +22,8 @@ HOSTPROG_CXX=	1
 
 .include <bsd.own.mk>
 
+HOST_LIBIBERTYOBJ!=	cd ${.CURDIR}/../host-libiberty && ${PRINTOBJDIR}
+
 # XXX ${G_OBJS:.o=.c} is invalid in GCC 5.3, but work around for now
 BUILDSYMLINKS+=	${GNUHOSTDIST}/gcc/wide-int-print.cc wide-int-print.c
 BUILDSYMLINKS+=	${GNUHOSTDIST}/gcc/wide-int.cc wide-int.c
diff -up -r usr.bin/host-libiberty/Makefile usr.bin/host-libiberty/Makefile
--- usr.bin/host-libiberty/Makefile	2014-03-15 17:07:58.000000000 -0700
+++ usr.bin/host-libiberty/Makefile	2016-05-02 23:04:35.488389145 -0700
@@ -1,5 +1,7 @@
 #	$NetBSD: Makefile,v 1.3 2014/03/16 00:07:58 uwe Exp $
 
+HOST_CFLAGS+=	-D_GNU_SOURCE
+
 libiberty/libiberty.a:
 	[ ! -d libiberty ] && mkdir libiberty || true
 	(cd libiberty; \


Home | Main Index | Thread Index | Old Index