snesrev / zelda3

https://discord.gg/AJJbJAzNNJ
Other
4.27k stars 354 forks source link

failed to build with SDL2 2.26.5 on macOS 13.3.1 #251

Closed foldfree closed 1 year ago

foldfree commented 1 year ago

Describe your bug here. And how to reproduce it.

cc -c -O2 -Werror -I/opt/homebrew/include/SDL2 -D_THREAD_SAFE -DSYSTEM_VOLUME_MIXER_AVAILABLE=0 messaging.c -o messaging.o
messaging.c:2394:21: error: passing arguments to 'VWF_RenderSingle' without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
    VWF_RenderSingle(TEXTCMD_PARAM(cmd));
                    ^
In file included from messaging.c:1:
./messaging.h:110:6: error: a function declaration without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
void VWF_RenderSingle();
     ^
                      void
messaging.c:2512:6: error: a function declaration without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
void VWF_RenderSingle(int c) {  // 8ecab8
     ^
3 errors generated.
make: *** [messaging.o] Error 1

What is your build target?

Mac

qurious-pixel commented 1 year ago

What is your compiler? What does cc --version show?

Builds with apple-clang-13, gcc-11, clang-14 using SDL 2.26.5 tested on MacOS Monterey

set your CFLAGS to specify c11

CFLAGS="-std=c11 -O2 -Werror" make

foldfree commented 1 year ago

Thank you for helping qurious-pixel, here are the outputs of the commands below. As you can see, I am on clang 14.0.3, maybe that has to do with the bug.

 cc --version
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: arm64-apple-darwin22.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
CFLAGS="-std=c11 -O2 -Werror" make
cc -c -std=c11 -O2 -Werror -I/opt/homebrew/include/SDL2 -D_THREAD_SAFE -DSYSTEM_VOLUME_MIXER_AVAILABLE=0 ancilla.c -o ancilla.o
cc -c -std=c11 -O2 -Werror -I/opt/homebrew/include/SDL2 -D_THREAD_SAFE -DSYSTEM_VOLUME_MIXER_AVAILABLE=0 attract.c -o attract.o
cc -c -std=c11 -O2 -Werror -I/opt/homebrew/include/SDL2 -D_THREAD_SAFE -DSYSTEM_VOLUME_MIXER_AVAILABLE=0 audio.c -o audio.o
cc -c -std=c11 -O2 -Werror -I/opt/homebrew/include/SDL2 -D_THREAD_SAFE -DSYSTEM_VOLUME_MIXER_AVAILABLE=0 config.c -o config.o
cc -c -std=c11 -O2 -Werror -I/opt/homebrew/include/SDL2 -D_THREAD_SAFE -DSYSTEM_VOLUME_MIXER_AVAILABLE=0 dungeon.c -o dungeon.o
cc -c -std=c11 -O2 -Werror -I/opt/homebrew/include/SDL2 -D_THREAD_SAFE -DSYSTEM_VOLUME_MIXER_AVAILABLE=0 ending.c -o ending.o
cc -c -std=c11 -O2 -Werror -I/opt/homebrew/include/SDL2 -D_THREAD_SAFE -DSYSTEM_VOLUME_MIXER_AVAILABLE=0 glsl_shader.c -o glsl_shader.o
cc -c -std=c11 -O2 -Werror -I/opt/homebrew/include/SDL2 -D_THREAD_SAFE -DSYSTEM_VOLUME_MIXER_AVAILABLE=0 hud.c -o hud.o
cc -c -std=c11 -O2 -Werror -I/opt/homebrew/include/SDL2 -D_THREAD_SAFE -DSYSTEM_VOLUME_MIXER_AVAILABLE=0 load_gfx.c -o load_gfx.o
cc -c -std=c11 -O2 -Werror -I/opt/homebrew/include/SDL2 -D_THREAD_SAFE -DSYSTEM_VOLUME_MIXER_AVAILABLE=0 main.c -o main.o
cc -c -std=c11 -O2 -Werror -I/opt/homebrew/include/SDL2 -D_THREAD_SAFE -DSYSTEM_VOLUME_MIXER_AVAILABLE=0 messaging.c -o messaging.o
messaging.c:2394:21: error: passing arguments to 'VWF_RenderSingle' without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
    VWF_RenderSingle(TEXTCMD_PARAM(cmd));
                    ^
In file included from messaging.c:1:
./messaging.h:110:6: error: a function declaration without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
void VWF_RenderSingle();
     ^
                      void
messaging.c:2512:6: error: a function declaration without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
void VWF_RenderSingle(int c) {  // 8ecab8
     ^
3 errors generated.
make: *** [messaging.o] Error 1
qurious-pixel commented 1 year ago

I was able to test this again. Treating the warning as a warning will allow it to build.

CFLAGS="-Wno-deprecated-non-protoype" make

foldfree commented 1 year ago

Just tried and it seems to work just fine, zelda3 is build and running as expected. Thank you