discobsd
discobsd copied to clipboard
share/zoneinfo: use gcc
When building on FreeBSD 14, "cc" is clang 16. This makes the build fail like this:
cd zoneinfo; make
cc -O -g -Wall -Werror -idirafter /big/sw/discobsd/include -c zdump.c -o zdump.o
zdump.c:26:1: error: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
show(zone, t, v)
^
zdump.c:48:1: error: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
readerr(fp, progname, filename)
^
zdump.c:61:1: error: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
tzdecode(codep)
^
zdump.c:74:1: error: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
main(argc, argv)
^
4 errors generated.
quick fix is this:
diff --git a/share/zoneinfo/Makefile b/share/zoneinfo/Makefile
index 7cfd33b..82ed5d9 100644
--- a/share/zoneinfo/Makefile
+++ b/share/zoneinfo/Makefile
@@ -20,7 +20,7 @@ LOCALTIME= US/Pacific
CFLAGS= -O
LINTFLAGS= -phbaxc
-CC= cc
+CC= gcc
CFLAGS+= -g -Wall -Werror -idirafter $(TOPSRC)/include
TZCSRCS= zic.c scheck.c ialloc.c
Instead, I could also add -Wno-deprecated-non-prototype
but to CFLAGS, but not all compilers might know this.
I'm working on a commit to add a ${HOST_CC}
make variable, similar to how NetBSD handles ${HOST_CC}
in /tools, to remedy the issues like this one.
At least it will make it easy to do:
$ make HOST_CC=some_specific_compiler_name
for any OS that needs it, while not affecting ${CC}
in the rest of the build.
Great, this was just a stop-gap measure to get it build in my series of patches to get it working on my FreeBSD. Which gcc are you using normally?
gcc 11 seems to be a bit too new to compile this, not to mention clang 16 I have now in -CURRENT.
I am a bit confused about how -DCROSS
works, especially how can I have a cross-tool like ar
that partially uses host headers like, say <stdio.h>
and our target headers.
This issue is now not fatal to a build, as -Werror has been removed from ${CFLAGS} in 194727747062f42e4746ec00880d35a4bbb358cb, and 849898631ac78af8ac8d7519dfc3426b705678fd for /share/zoneinfo specifically. It is now only a warning with Clang 16.
I will leave this issue open until zoneinfo has been fixed properly.
I'm working on a commit to add a
${HOST_CC}
make variable, similar to how NetBSD handles${HOST_CC}
in /tools, to remedy the issues like this one.At least it will make it easy to do:
$ make HOST_CC=some_specific_compiler_name
for any OS that needs it, while not affecting
${CC}
in the rest of the build.
The commit d8533040deeb6f149527042206c3ae7e9db3e19e implements and enables the ${HOST_CC} make variable throughout the build.