tech-toolchain archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Host requirements to build the Tools binaries
On Fri, 2024-08-16 at 16:24 +1200, Lloyd Parkes wrote:
> I'll look at the gpt source code tomorrow.
And all done. I can build tools on Linux with GCC 14 and a run of the
mill NetBSD 10.99.10.
I had to replace GNU make 3.81 in src/external/gpl2/gmake/dist with GNU
make 4.4.1 in src/external/gpl3/gmake/dist. I extracted make-
4.4.1.tar.gz from the GNU web site and ran "mv make-4.4.1 dist".
Here are my notes and a diff of everything that isn't in
src/external/gpl3/gmake/dist.
Ngā mihi,
Lloyd
Our situation is that NetBSD tools don't build with GCC 14 on
Linux. There may be other places and other things that don't build
with GCC 14, but that is not what we are looking at here.
1) GCC 14 doesn't allow the use of undeclared functions.
This is a problem for a tools build on Linux because (uniquely) Linux
avoids declaring many functions unless you ask nicely. To compound
matters slighty, all other POSIX and POSIX-like systems use that same
"ask nicely" mechanism to turn off other function declarations.
The fix is to define the following symbols when compiling on Linux.
2) GNU make 3.81 can't be built with GCC 14.
GNU make 3.81 has too much old code in it and it simply doesn't work
with GCC 14. GNU make 4.4.1 seems to work fine.
3) GCC 14 doesn't allow *int and *long to be mixed.
The gpt(1) program passes a value of type *daddr_t to a function
expecting a value of type *off_t. This is OK on NetBSD because both
types are always 64 bit. On Linux daddr_t is always 32 bit and so GCC
14 refuses to compile it.
The gpt(1) program will need to be made more portable.
diff -r 6f2160078904 sbin/gpt/biosboot.c
--- a/sbin/gpt/biosboot.c Tue Aug 13 17:54:59 2024 +0000
+++ b/sbin/gpt/biosboot.c Sat Aug 17 12:39:17 2024 +1200
@@ -267,7 +267,7 @@
#endif
int ch;
gpt_t ngpt = gpt;
- daddr_t start = 0;
+ off_t start = 0;
uint64_t size = 0;
int active = 0;
unsigned int entry = 0;
diff -r 6f2160078904 tools/Makefile.host
--- a/tools/Makefile.host Tue Aug 13 17:54:59 2024 +0000
+++ b/tools/Makefile.host Sat Aug 17 12:39:17 2024 +1200
@@ -49,6 +49,11 @@
HOST_INSTALLPROG?=${HOST_BINDIR}/${HOSTPROGNAME}${HOSTEXEEXT}
.undef LINKS
+.if !empty(.MAKE.OS:M*Linux*)
+HOST_CPPFLAGS+= -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED
+HOST_CPPFLAGS+= -D_DEFAULT_SOURCE
+.endif
+
SRCS?= ${HOSTPROG}.c
SRCS+= ${HOST_SRCS}
diff -r 6f2160078904 tools/gmake/Makefile
--- a/tools/gmake/Makefile Tue Aug 13 17:54:59 2024 +0000
+++ b/tools/gmake/Makefile Sat Aug 17 12:39:17 2024 +1200
@@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.4 2014/08/18 06:58:51 christos Exp $
#
-GNUHOSTDIST= ${.CURDIR}/../../external/gpl2/gmake/dist
+GNUHOSTDIST= ${.CURDIR}/../../external/gpl3/gmake/dist
CONFIGURE_ENV+= CC=${HOST_CC:Q} \
CFLAGS=${HOST_CFLAGS:Q} \
Home |
Main Index |
Thread Index |
Old Index