Fails to build with GCC 15 due to -Wincompatible-pointer-types
With GCC 15, function declarations with no parameters can no longer be used for functions that take parameters.
As a result, pyo fails to build from source with GCC 15 with the following error:
[ 13s] gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -g -DOPENSSL_LOAD_CONF -fwrapv -fno-semantic-interposition -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -g -IVendor/ -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -g -IVendor/ -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g -fPIC -DUSE_PORTAUDIO -DUSE_PORTMIDI -DUSE_OSC -DUSE_JACK -DJACK_NEW_API -Iinclude -I/usr/include -I/usr/local/include -I/usr/include/python3.12 -c src/engine/dummymodule.c -o build/temp.linux-x86_64-cpython-312/src/engine/dummymodule.o -Wno-strict-prototypes -Wno-strict-aliasing -O3 -g0 -DNDEBUG
[ 13s] src/engine/dummymodule.c: In function ‘Dummy_setProcMode’:
[ 13s] src/engine/dummymodule.c:48:35: error: assignment to ‘void (*)(void)’ from incompatible pointer type ‘void (*)(Dummy *)’ [-Wincompatible-pointer-types]
[ 13s] 48 | self->muladd_func_ptr = Dummy_postprocessing_ii;
[ 13s] | ^
[ 13s] src/engine/dummymodule.c:29:13: note: ‘Dummy_postprocessing_ii’ declared here
[ 13s] 29 | static void Dummy_postprocessing_ii(Dummy *self) { POST_PROCESSING_II };
[ 13s] | ^~~~~~~~~~~~~~~~~~~~~~~
[ 13s] src/engine/dummymodule.c:52:35: error: assignment to ‘void (*)(void)’ from incompatible pointer type ‘void (*)(Dummy *)’ [-Wincompatible-pointer-types]
[ 13s] 52 | self->muladd_func_ptr = Dummy_postprocessing_ai;
[ 13s] | ^
[ 13s] src/engine/dummymodule.c:30:13: note: ‘Dummy_postprocessing_ai’ declared here
[ 13s] 30 | static void Dummy_postprocessing_ai(Dummy *self) { POST_PROCESSING_AI };
[ 13s] | ^~~~~~~~~~~~~~~~~~~~~~~
That would be too much of a refactor to do this at the moment (not even sure how I will handle that)... I can repro in godbolt, but Apple clang seems to be more compliant than gcc! Is it working on your side if you add "-Wno-incompatible-pointer-types" in the extra_compile_args?
This issue is already fixed with https://github.com/belangeo/pyo/commit/425bb1119641e04d6b978880197211b587775cce
I was running against different errors with gcc15.
src/engine/dummymodule.c: In function ‘Dummy_compute_next_data_frame’:
src/engine/dummymodule.c:109:6: error: too many arguments to function ‘self->muladd_func_ptr’; expected 0, have 1
109 | (*self->muladd_func_ptr)(self);
| ~^~~~~~~~~~~~~~~~~~~~~~~ ~~~~
In file included from src/engine/dummymodule.c:24:
include/pyomodule.h:616:12: note: declared here
616 | void (*muladd_func_ptr)(); \
| ^~~~~~~~~~~~~~~
include/dummymodule.h:29:5: note: in expansion of macro ‘pyo_audio_HEAD’
29 | pyo_audio_HEAD
| ^~~~~~~~~~~~~~
These can be "fixed" by using -std=c17 , but then it still fails with:
src/engine/vbap.c:16:41: error: ‘M_PI’ undeclared here (not in a function)
16 | static float ang_to_rad = (float)(2.0 * M_PI / 360.0);
| ^~~~
error: command '/usr/bin/gcc' failed with exit code 1
Is there a path to making pyo work in linux? Right now it seems like you can't build any version.
Confirming this issue on Manjaro Linux with GCC 15.2.1 and Python 3.13.
Error Summary: Multiple compilation errors related to function pointers with incompatible signatures, including:
-
error: too many arguments to function 'self->mode_func_ptr'; expected 0, have 1 -
error: too many arguments to function 'self->muladd_func_ptr'; expected 0, have 1
Affected files:
-
src/engine/dummymodule.c -
src/engine/triggermodule.c - Multiple other modules
Attempted workarounds:
- Installing with
--minimalflag still fails with the same errors - Installing from PyPI (1.0.5) and latest git both fail
The root cause appears to be in include/pyomodule.h:614-616 where function pointers are declared without parameters:
void (*mode_func_ptr)();
void (*muladd_func_ptr)();
But they're called throughout the codebase with self as an argument, which is now rejected by GCC 15.
Looking forward to PR #313 being merged!