Subject: cross-building on freebsd broken?
To: None <tech-toolchain@netbsd.org>
From: Simon Gerraty <sjg@juniper.net>
List: tech-toolchain
Date: 09/19/2005 08:44:28
It has been a while since I built -current this way, but now cannot
get past building the tools.

#   compile  fdisk/fdisk.lo
cc -O -I/NetBSD/current/tools/FreeBSD-4.10-i386/include -I
/NetBSD/current/obj/i386/obj/NetBSD/current/src/tools/compat -I/c/sjg
/work/NetBSD/current/obj/i386/obj/NetBSD/current/src/tools/compat/inc
lude  -I/NetBSD/current/src/tools/fdisk/../compat -DHAVE_NBTOOL_CONFI
G_H=1  -D_FILE_OFFSET_BITS=64  -c -o fdisk.lo.o    /NetBSD/current/sr
c/tools/fdisk/../../sbin/fdisk/fdisk.c
/NetBSD/current/src/tools/fdisk/../../sbin/fdisk/fdisk.c: In function
 `print_part':
/NetBSD/current/src/tools/fdisk/../../sbin/fdisk/fdisk.c:616: syntax 
error before `PRId64'
/NetBSD/current/src/tools/fdisk/../../sbin/fdisk/fdisk.c: In function
 `print_mbr_partition':
/NetBSD/current/src/tools/fdisk/../../sbin/fdisk/fdisk.c:675: syntax 
error before `PRId64'

The needed definition needs to come from int_fmtio.h, which won't be
found by the above -I's and since this is being built for the host, is
probably not appropriate anyway.

The following patch did the trick for me.
It isn't perfect, but 12/18 of the archs we support also use lld.
The odd ones out are: alpha, amd64, mips, powerpc, sh5 and sparc.

--sjg

Index: sbin/fdisk/fdisk.c
===================================================================
RCS file: /cvsroot/src/sbin/fdisk/fdisk.c,v
retrieving revision 1.93
diff -u -p -r1.93 fdisk.c
--- sbin/fdisk/fdisk.c	27 Aug 2005 22:43:40 -0000	1.93
+++ sbin/fdisk/fdisk.c	19 Sep 2005 15:38:54 -0000
@@ -101,6 +101,9 @@ static char lbuf[LBUF];
 #ifndef PRIdaddr
 #define PRIdaddr PRId64
 #endif
+#ifndef PRId64
+#define PRId64	"lld"
+#endif
 
 #ifndef _PATH_DEFDISK
 #define _PATH_DEFDISK	"/dev/rwd0d"