Build uses invalid flags with gcc: no option '-Wnullability-completeness', no option '-Wparentheses-equality'
Xmake Version
2.9.7
Operating System Version and Architecture
macOS
Describe Bug
Build fails with gcc due to unconditional usage of invalid flags:
cc1: error: '-Wno-error=nullability-completeness': no option '-Wnullability-completeness'
cc1: error: '-Wno-error=parentheses-equality': no option '-Wparentheses-equality'
Expected Behavior
Clang-specific flags are to be used conditionally on clang being the compiler.
Project Configuration
This is just the build error.
Additional Information and Error Logs
/opt/local/bin/gcc-mp-14 -c -fvisibility=hidden -Os -Wall -Wall -std=c99 -D_GNU_SOURCE=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_USE_MACOSX -Icore/src/lua/lua -Wno-error=deprecated-declarations -fno-strict-aliasing -Wno-error=nullability-completeness -Wno-error=parentheses-equality -I/opt/local/include -pipe -Os -arch ppc -o build/.objs/lua/macosx/ppc/release/core/src/lua/lua/lauxlib.c.o core/src/lua/lua/lauxlib.c
/opt/local/bin/gcc-mp-14 -c -fvisibility=hidden -Os -Wall -Wall -std=c99 -D_GNU_SOURCE=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_USE_MACOSX -Icore/src/lua/lua -Wno-error=deprecated-declarations -fno-strict-aliasing -Wno-error=nullability-completeness -Wno-error=parentheses-equality -I/opt/local/include -pipe -Os -arch ppc -o build/.objs/lua/macosx/ppc/release/core/src/lua/lua/lcode.c.o core/src/lua/lua/lcode.c
cc1: error: '-Wno-error=nullability-completeness': no option '-Wnullability-completeness'
cc1: error: '-Wno-error=nullability-completeness': no option '-Wnullability-completeness'
cc1: error: '-Wno-error=nullability-completeness': no option '-Wnullability-completeness'
cc1: error: '-Wno-error=nullability-completeness': no option '-Wnullability-completeness'
cc1: error: '-Wno-error=nullability-completeness': no option '-Wnullability-completeness'
cc1: error: '-Wno-error=nullability-completeness': no option '-Wnullability-completeness'
cc1: error: '-Wno-error=parentheses-equality': no option '-Wparentheses-equality'
cc1: error: '-Wno-error=parentheses-equality': no option '-Wparentheses-equality'
make: *** [build/.objs/lua/macosx/ppc/release/core/src/lua/lua/lbaselib.c.o] Error 1
too old gcc and macos version, you can temporarily remove here.
https://github.com/xmake-io/xmake/blob/3dd5c00c62dcd51ded121a9a0bdb524739fd0bec/core/xmake.sh#L17
@waruqi Yeah, I know where to remove it, however it looks like a bug to me: macOS version is irrelevant (this has nothing to do with SDK or cctools), and gcc version is the latest release of gcc14 (this month).
P. S. Checked release date of 14.3.0, okay, it is not this month, but it is the latest in the branch (May 23, 2025).
The xmake boot build script (xmake.sh) is limited. It only supports the Apple Clang to build xmake on macOS.
It cannot add different compilation configurations based on different compilers (gcc).
Please use xcode/clang to build xmake on macOS.
Well, as a matter of fact it worked fine with gcc, save for usage of two offending flags. It is neither possible to use exclusively clang (clang is broken on PowerPC) nor, importantly, desirable (we want to test with both major compilers). The first part may not sound a solid argument to someone not caring about the platform in question, but the testing one should hold, I believe.
But it is indeed non-trivial to handle flags conditionally, let it be, this can easily be fixed downstream. (The whole fix amounts to not forcing unsupported flags.) In this case the issue can be closed – hopefully anyone bumping into this bug finds it and fixes the script locally then.