While compiling CPython 3.13.7 on Cygwin I obtained the following error during the make
step:
In file included from ./Include/internal/pycore_backoff.h:12, from ./Include/internal/pycore_code.h:12, from ./Include/internal/pycore_interp.h:16, from ./Include/internal/pycore_runtime.h:17, from ./Modules/timemodule.c:7: ./Modules/timemodule.c: In function ‘time_clockid_converter’: ./Include/pymacro.h:77:13: error: static assertion failed: "sizeof(clk_id) == sizeof(*p)" 77 | static_assert((cond), #cond); \ | ^~~~~~~~~~~~~ ./Modules/timemodule.c:203:5: note: in expansion of macro ‘Py_BUILD_ASSERT’ 203 | Py_BUILD_ASSERT(sizeof(clk_id) == sizeof(*p)); | ^~~~~~~~~~~~~~~ make: *** [Makefile:3543: Modules/timemodule.o] Error 1
ChatGPT explained to me, that the assertion would be based on the assumption, that all POSIX-like platforms are expected to have clockid_t == int
, where clk_id
is of type clockid_t
(“Clock IDs”), and p
would be an int*
. On Cygwin, this would be different, withclockid_t
being long
(32 bit or 64 bit, build-dependent). Furthermore, ChatGPT told me that, in essence, the difference would not matter much. ChatGPT proposed a “fix” in Modules/timemodule.c
:
#if !defined(__CYGWIN__) Py_BUILD_ASSERT(sizeof(clk_id) == sizeof(*p)); #endif
And indeed this resolves this build error.
I do not know if this is a real solution, though. Possibly it is against the notion of an assertion to ignore it in cases where it isn’t met, but I am not a Python core developer.
However, this problem prevents CPython 3.13.7 from compiling on Cygwin without the abovementioned ChatGPT proposition.
There are some more problems related to compiling Python 3.13.7 on Cygwin, but I’ll report on these separately, as I consider them to be a completely different matter.