tsoding / musializer

Music Visualizer
MIT License
877 stars 92 forks source link

[Build] nob build fails for macOS with "undeclared function 'kill'" #110

Closed jgabaut closed 3 months ago

jgabaut commented 4 months ago

The latest additions cause the nob build to fail on macOS.

Since I noticed a TODO in the source about checking the build for macOS, I went ahead and did so, and can confirm that commit 070b88ce can build and run correctly on Darwin kernel 23.4.0 arm64.

Then, I checked the subsequent commit c8486721, and it seems to still build fine.

The first commit that breaks is 1d229d93.

This commit introduces this line:

if (cancel) kill(pid, SIGKILL);

The workflow fails with:

./src/ffmpeg_linux.c:102:17: error: call to undeclared function 'kill'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

From my searches, defining _POSIX_C_SOURCE as a high enough value should ensure this does not happen, and it needs to be defined before any other definition.

Alas, I haven't been able to fix it.

Maybe it should be passed as a definition to the compiler instead, if there is no clear path to defining it first. Or it may be a red herring.

Edit: it seems _POSIX_C_SOURCE is not needed, but including signal.h is required from clang or something... I opened #111 to add the line.