Subject: Re: building -current on FreeBSD fails
To: None <current-users@netbsd.org>
From: Mark Valentine <mark@valentine.me.uk>
List: current-users
Date: 06/05/2003 18:18:05
> From: uwe@ptc.spbu.ru ("Valeriy E. Ushakov")
> Date: Mon 28 Apr, 2003
> Subject: Re: building -current on FreeBSD fails

> On Mon, Apr 28, 2003 at 14:48:37 +0200, Ronald van der Pol wrote:
> > But what would be the fix for the endian symbols below? This is a
> > "build tools".
> 
> The quick workaround is to build with
> 
>     ac_cv_header_sys_endian_h=no
> 
> in the environment to force the build to use netbsd's <sys/endian.h>.

I just came across this problem.

installboot seems to assume it gets the endian macros via <sys/types.h>
(which includes <machine/endian.h>).

It would seem more correct to explicitly include the host's <sys/endian.h>
(not <machine/endian.h>) in tools code which needs these routines.  This
seems to work at least on NetBSD and FreeBSD.

The (hastily attempted) patch below got me through "build.sh release"
for NetBSD/sparc on my FreeBSD/i386 host.

I guess it would be more conservative to put the #includes in #ifdef
__FreeBSD__, but that depends if there are really any host systems which
have these endian macros but *son't* make them available via <sys/endian.h>.

		Cheers,

		Mark.

P.S.  I haven't really touched NetBSD since release 0.8, so treat me
as a newbie...  However, I feel right at home straight off the bat with
the NetBSD build system - sure beats the bloated mess that FreeBSD's
has become.  Great job!

Index: usr.sbin/installboot/bbinfo.c
===================================================================
RCS file: /netbsd/cvs/src/usr.sbin/installboot/bbinfo.c,v
retrieving revision 1.8
diff -u -r1.8 bbinfo.c
--- usr.sbin/installboot/bbinfo.c	15 Apr 2003 14:22:13 -0000	1.8
+++ usr.sbin/installboot/bbinfo.c	5 Jun 2003 05:20:10 -0000
@@ -46,6 +46,7 @@
 #endif
 
 #include <sys/param.h>
+#include <sys/endian.h>
 
 #include <assert.h>
 #include <err.h>
Index: usr.sbin/installboot/sum.c
===================================================================
RCS file: /netbsd/cvs/src/usr.sbin/installboot/sum.c,v
retrieving revision 1.2
diff -u -r1.2 sum.c
--- usr.sbin/installboot/sum.c	19 Apr 2002 07:08:53 -0000	1.2
+++ usr.sbin/installboot/sum.c	5 Jun 2003 04:22:10 -0000
@@ -72,6 +72,7 @@
 #endif	/* !__lint */
 
 #include <sys/types.h>
+#include <sys/endian.h>
 
 #include <assert.h>
 #include <stdio.h>
Index: usr.sbin/installboot/arch/alpha.c
===================================================================
RCS file: /netbsd/cvs/src/usr.sbin/installboot/arch/alpha.c,v
retrieving revision 1.14
diff -u -r1.14 alpha.c
--- usr.sbin/installboot/arch/alpha.c	15 Apr 2003 14:22:13 -0000	1.14
+++ usr.sbin/installboot/arch/alpha.c	5 Jun 2003 05:20:53 -0000
@@ -106,6 +106,7 @@
 #endif
 
 #include <sys/param.h>
+#include <sys/endian.h>
 
 #include <assert.h>
 #include <err.h>
Index: usr.sbin/installboot/arch/amiga.c
===================================================================
RCS file: /netbsd/cvs/src/usr.sbin/installboot/arch/amiga.c,v
retrieving revision 1.2
diff -u -r1.2 amiga.c
--- usr.sbin/installboot/arch/amiga.c	15 Apr 2003 14:22:14 -0000	1.2
+++ usr.sbin/installboot/arch/amiga.c	5 Jun 2003 05:21:13 -0000
@@ -45,6 +45,7 @@
 #endif	/* !__lint */
 
 #include <sys/param.h>
+#include <sys/endian.h>
 #include <sys/stat.h>
 
 #include <assert.h>
Index: usr.sbin/installboot/arch/i386.c
===================================================================
RCS file: /netbsd/cvs/src/usr.sbin/installboot/arch/i386.c,v
retrieving revision 1.6
diff -u -r1.6 i386.c
--- usr.sbin/installboot/arch/i386.c	8 May 2003 20:33:44 -0000	1.6
+++ usr.sbin/installboot/arch/i386.c	5 Jun 2003 05:21:24 -0000
@@ -46,6 +46,7 @@
 #endif
 
 #include <sys/param.h>
+#include <sys/endian.h>
 
 #include <assert.h>
 #include <err.h>
Index: usr.sbin/installboot/arch/macppc.c
===================================================================
RCS file: /netbsd/cvs/src/usr.sbin/installboot/arch/macppc.c,v
retrieving revision 1.6
diff -u -r1.6 macppc.c
--- usr.sbin/installboot/arch/macppc.c	15 Apr 2003 14:22:14 -0000	1.6
+++ usr.sbin/installboot/arch/macppc.c	5 Jun 2003 05:21:35 -0000
@@ -46,6 +46,7 @@
 #endif
 
 #include <sys/param.h>
+#include <sys/endian.h>
 
 #include <assert.h>
 #include <err.h>
Index: usr.sbin/installboot/arch/pmax.c
===================================================================
RCS file: /netbsd/cvs/src/usr.sbin/installboot/arch/pmax.c,v
retrieving revision 1.10
diff -u -r1.10 pmax.c
--- usr.sbin/installboot/arch/pmax.c	15 Apr 2003 14:22:14 -0000	1.10
+++ usr.sbin/installboot/arch/pmax.c	5 Jun 2003 05:22:07 -0000
@@ -109,6 +109,7 @@
 #endif
 
 #include <sys/param.h>
+#include <sys/endian.h>
 
 #include <assert.h>
 #include <err.h>
Index: usr.sbin/installboot/arch/sparc.c
===================================================================
RCS file: /netbsd/cvs/src/usr.sbin/installboot/arch/sparc.c,v
retrieving revision 1.8
diff -u -r1.8 sparc.c
--- usr.sbin/installboot/arch/sparc.c	15 Apr 2003 14:22:14 -0000	1.8
+++ usr.sbin/installboot/arch/sparc.c	5 Jun 2003 05:22:19 -0000
@@ -46,6 +46,7 @@
 #endif
 
 #include <sys/param.h>
+#include <sys/endian.h>
 
 #include <assert.h>
 #include <err.h>
Index: usr.sbin/installboot/arch/sparc64.c
===================================================================
RCS file: /netbsd/cvs/src/usr.sbin/installboot/arch/sparc64.c,v
retrieving revision 1.13
diff -u -r1.13 sparc64.c
--- usr.sbin/installboot/arch/sparc64.c	15 May 2002 02:18:24 -0000	1.13
+++ usr.sbin/installboot/arch/sparc64.c	5 Jun 2003 05:22:29 -0000
@@ -70,6 +70,7 @@
 #endif	/* !__lint */
 
 #include <sys/param.h>
+#include <sys/endian.h>
 
 #include <assert.h>
 #include <err.h>
Index: usr.sbin/installboot/arch/vax.c
===================================================================
RCS file: /netbsd/cvs/src/usr.sbin/installboot/arch/vax.c,v
retrieving revision 1.9
diff -u -r1.9 vax.c
--- usr.sbin/installboot/arch/vax.c	15 Apr 2003 14:22:14 -0000	1.9
+++ usr.sbin/installboot/arch/vax.c	5 Jun 2003 05:22:57 -0000
@@ -79,6 +79,7 @@
 #endif
 
 #include <sys/param.h>
+#include <sys/endian.h>
 
 #include <assert.h>
 #include <err.h>

-- 
"Tigers will do ANYTHING for a tuna fish sandwich."
"We're kind of stupid that way."   *munch* *munch*
  -- <http://www.calvinandhobbes.com>