Repository navigation
Build failure of 3.12.9 on Cygwin #130423
Description
Activity
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Feb 21, 2025 - addedbuildThe build process and cross-buildThe build process and cross-build
on Feb 22, 2025 Hi,
I've been struggling for some time with compiling version 3.12.
My environment:
$ uname -a
CYGWIN_NT-10.0-26100 Data31 3.6.4-1.x86_64 2025-07-15 07:55 UTC x86_64 Cygwin
$ gcc -v
gcc version 13.4.0 (GCC)
$ make -v
GNU Make 4.4.13.12 ZIP downloaded from GIT
-rwxr-xr-x 1 29927478 Aug 8 12:25 cpython-3.12.zipConfigure ends OK
configure: WARNING:
Platform "x86_64-pc-cygwin" with compiler "gcc" is not supported by the
CPython core team, see https://peps.python.org/pep-0011/ for more information.Make, compile, complile, link… and
gcc -shared -Wl,--enable-auto-image-base Modules/_pickle.o -L/usr/local/lib/python3.12/config-3.12 -lpython3.12 -o Modules/_pickle.cpython-312.dll
/usr/lib/gcc/x86_64-pc-cygwin/13/../../../../x86_64-pc-cygwin/bin/ld: Modules/_pickle.o: in functionwhichmodule': ./Modules/_pickle.c:1988:(.text+0xdc7e): undefined reference to_PySys_GetRequiredAttr'
collect2: error: ld returned 1 exit status
make: *** [Makefile:2990: Modules/_pickle.cpython-312.dll] Error 1According to me everything seems OK, the C program containing the _PySys_GetRequiredAttr method has been compiled, the symbols are in the library for the link...
$ nm Python/sysmodule.o | grep GetRequiredAttr
0000000000001e00 T _PySys_GetRequiredAttr
00000000000025a0 T _PySys_GetRequiredAttrString
$ nm libpython3.12.a | grep GetRequiredAttr
U _PySys_GetRequiredAttr
U _PySys_GetRequiredAttrString
U _PySys_GetRequiredAttrString
U _PySys_GetRequiredAttr
0000000000001e00 T _PySys_GetRequiredAttr
00000000000025a0 T _PySys_GetRequiredAttrString
U _PySys_GetRequiredAttrAnd yet, no.
I tried many things, even, in despair, changing the compiler using MSVCS, vcpkg, etc., but no success.$ gcc -shared Modules/_pickle.o -lpython3.12 -o Modules/_pickle.cpython-312.dll
/usr/lib/gcc/x86_64-pc-cygwin/13/../../../../x86_64-pc-cygwin/bin/ld: Modules/_pickle.o: in functionwhichmodule': /home/jbdat/50-AI/cpython-3.12/./Modules/_pickle.c:1988:(.text+0xdc7e): undefined reference to_PySys_GetRequiredAttr'
collect2: error: ld returned 1 exit statusCan someone help me?
I'm afraid I don't have Cygwing available to investigate this, but: did you
make clean(or the strongergit clean -fxd) to remove artifacts from any previous builds?A little rusty with the C language...
export LDFLAGS="-L." allows me to go to the next problem...To investigate, I launched the compilation command which fails on Cygwin, on Linux... And it works
3.12, Cyqwin, command KO
$ uname -a
CYGWIN_NT-10.0-26100 Data31 3.6.4-1.x86_64 2025-07-15 07:55 UTC x86_64 Cygwin
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-cygwin/16/lto-wrapper.exe
Target: x86_64-pc-cygwin
Supported LTO compression algorithms: zlib zstd
gcc version 16.0.0 20250727 (experimental) (GCC)
$ gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -I./Include/internal -I. -I./Include -c ./Modules/ossaudiodev.c -o Modules/ossaudiodev.o
In file included from ./Include/Python.h:44,
from ./Modules/ossaudiodev.c:25:
./Include/object.h:135:9: error: initializer element is not constant
135 | (type)
| ^3.12, Linux, same command OK
$ uname -a
Linux Data31 6.6.87.2-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC Thu Jun 5 18:30:46 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Supported LTO compression algorithms: zlib zstd
gcc version 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04)
$ gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -I./Include/internal -I. -I./Include -c ./Modules/ossaudiodev.c -o Modules/ossaudiodev.o
$I also noticed that other .c files that use Python.h (so the variadic macros that cause the error) compile OK. I reused this command for ossaudiodev.c KO.
If anyone knows how to align the planets to compile on Cygwin...
Ultimately, Cygwin is an unsupported platform precisely because we don't have the relevant experts around.
Unfortunately, this is not an actionable issue in this repo. Consider the discussion forum or a Cygwin-specific place instead.
Good luck!
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsDone
Bug report
Bug description:
3.12.9 fails to build ctypes module on Cygwin if 3.12.8 is already installed as LIBFFI_LIBS
has "-L/usr/lib/../lib" and pull the installed version of "libpython3.12.dll.a" instead of the built one.
failed module:
inverting the order of library search solves the issue
$ gcc -shared -Wl,--enable-auto-image-base Modules/_ctypes/_ctypes.o Modules/_ctypes/callbacks.o Modules/_ctypes/callproc.o Modules/_ctypes/stgdict.o Modules/_ctypes/cfield.o -L. -L/usr/lib/../lib -lffi -ldl -lpython3.12 -o Modules/_ctypes.cpython-312-x86_64-cygwin.dll