[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

share/zoneinfo: use gcc #5

Open
saper opened this issue Jun 25, 2023 · 5 comments
Open

share/zoneinfo: use gcc #5

saper opened this issue Jun 25, 2023 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@saper
Copy link
Contributor
saper commented Jun 25, 2023

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.

@chettrick
Copy link
Owner

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.

@chettrick chettrick added the bug Something isn't working label Jun 27, 2023
@saper
Copy link
Contributor Author
saper commented Jun 27, 2023

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.

@saper
Copy link
Contributor Author
saper commented Jun 27, 2023

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.

@chettrick
Copy link
Owner
chettrick commented Jul 28, 2023

This issue is now not fatal to a build, as -Werror has been removed from ${CFLAGS} in 1947277, and 8498986 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.

@chettrick
Copy link
Owner

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 d853304 implements and enables the ${HOST_CC} make variable throughout the build.

@chettrick chettrick self-assigned this Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants