snesrev / zelda3

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

build errors on macOS Ventura (13.5.1) #271

Closed yvan1990 closed 1 year ago

yvan1990 commented 1 year ago

Describe your bug here. And how to reproduce it.

All listed methods for producing the build on Mac aren't working for me

Just typing "make" into the terminal produces this error:

cc -c -O2 -Werror -I . -I/usr/local/include/SDL2 -D_THREAD_SAFE -DSYSTEM_VOLUME_MIXER_AVAILABLE=0 src/messaging.c -o src/messaging.o src/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 src/messaging.c:1: src/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 src/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: *** [src/messaging.o] Error 1

While typing "make -j$(nproc)" results in this error:

zsh: command not found: nproc … Extracting game resources /usr/bin/env python3 assets/restool.py --extract-from-rom src/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 src/messaging.c:1: src/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 src/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 ^ snes/snes.c:33:23: error: passing arguments to 'ppu_init' without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] snes->ppu = ppu_init(snes); ^ src/zelda_rtl.c:267:24: error: passing arguments to 'ppu_init' without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] g_zenv.ppu = ppu_init(NULL); ^ 3 errors generated. make: [src/messaging.o] Error 1 make: Waiting for unfinished jobs.... 1 error generated. make: [snes/snes.o] Error 1 1 error generated. make: [src/zelda_rtl.o] Error 1

And finally, entering "clang++ sdl2-config --cflags -O2 -ozelda3 .c snes/.c sdl2-config --libs" generates the following output:

zsh: no matches found: *.c

So I tried changing it to "clang++ sdl2-config --cflags -O2 -ozelda3 snes/*.c sdl2-config --libs" which generated the following output:

clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated] clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated] clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated] clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated] clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated] clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated] clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated] clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated] clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated] clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated] clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated] In file included from snes/apu.c:9: In file included from snes/snes.h:16: snes/ppu.h:10:10: fatal error: 'snes/saveload.h' file not found

include "snes/saveload.h"

^~~~~ 1 error generated. In file included from snes/cart.c:8: In file included from snes/cart.h:13: In file included from snes/snes.h:16: snes/ppu.h:10:10: fatal error: 'snes/saveload.h' file not found

include "snes/saveload.h"

^~~~~ 1 error generated. In file included from snes/cpu.c:10: In file included from snes/snes.h:16: snes/ppu.h:10:10: fatal error: 'snes/saveload.h' file not found

include "snes/saveload.h"

^~~~~ 1 error generated. In file included from snes/dma.c:8: In file included from snes/dma.h:13: In file included from snes/snes.h:16: snes/ppu.h:10:10: fatal error: 'snes/saveload.h' file not found

include "snes/saveload.h"

^~~~~ 1 error generated. In file included from snes/input.c:8: In file included from snes/input.h:13: In file included from snes/snes.h:16: snes/ppu.h:10:10: fatal error: 'snes/saveload.h' file not found

include "snes/saveload.h"

^~~~~ 1 error generated. In file included from snes/ppu.c:8: snes/ppu.h:10:10: fatal error: 'snes/saveload.h' file not found

include "snes/saveload.h"

^~~~~ 1 error generated. In file included from snes/snes.c:11: In file included from snes/snes.h:16: snes/ppu.h:10:10: fatal error: 'snes/saveload.h' file not found

include "snes/saveload.h"

^~~~~ 1 error generated. In file included from snes/snes_other.c:8: In file included from snes/snes.h:16: snes/ppu.h:10:10: fatal error: 'snes/saveload.h' file not found

include "snes/saveload.h"

^~~~~ 1 error generated. In file included from snes/tracing.c:10: In file included from snes/tracing.h:12: In file included from snes/snes.h:16: snes/ppu.h:10:10: fatal error: 'snes/saveload.h' file not found

include "snes/saveload.h"

^~~~~ 1 error generated.

What is your build target?

Mac

impeeza commented 1 year ago

This could be related to: https://github.com/snesrev/zelda3/issues/266

yvan1990 commented 1 year ago

This could be related to: #266

While there does seem to be some correlation, the most important factor seems to be that some outdated coding methods were used. Not being fluent in C myself, I don’t know if this was for either backwards or cross-platform compatibility, but it’s possible that there may need to be an entirely different fork for the Mac port to address this issue.

dreamlibrarian commented 1 year ago

Wandering into the Makefile and adding -Wno-strict-prototypes to CFLAGS mitigates this for now, at least.

This is replicable by building on any platform with Clang 15, looks like, and will likely become more critical after C2x ships and some platform starts using it by default.

yvan1990 commented 1 year ago

Thank you! That got things running.

qurious-pixel commented 1 year ago

Duplicate of https://github.com/snesrev/zelda3/issues/251

266 is a different error.

make -j $(sysctl -n hw.ncpu) is what you would use for mac, or just enter your number of threads.

Mark as closed if resolved

yvan1990 commented 1 year ago

@qurious-pixel make -j $(sysctl -n hw.ncpu) is what’s used in lieu of make -j $(nproc) on mac.That still doesn’t resolve the issue of needing to add -Wno-strict-prototypes to CFLAGS.

Sorry about not closing the topic before.