GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Build failure of 3.12.9 on Cygwin · Issue #130423 · python/cpython

Build failure of 3.12.9 on Cygwin #130423

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
Build failure of 3.12.9 on Cygwin#130423
Copy link
Labels
OS-unsupportedbuildThe build process and cross-buildThe build process and cross-buildtopic-ctypestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@matzeri
matzeri
opened on Feb 21, 2025
Issue body actions

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.

$ grep  -s -- "-L/usr/lib" config.status
"MODULE__CTYPES_LDFLAGS=-L/usr/lib/../lib -lffi -ldl\n"\
S["LIBFFI_LIBS"]="-L/usr/lib/../lib -lffi -ldl"

failed module:

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/usr/lib/../lib -lffi -ldl -L. -lpython3.12 -o Modules/_ctypes.cpython-312-x86_64-cygwin.dll
/usr/lib/gcc/x86_64-pc-cygwin/12/../../../../x86_64-pc-cygwin/bin/ld: Modules/_ctypes/callproc.o: in function `py_dl_close':
/usr/src/debug/python312-3.12.9-1/Modules/_ctypes/callproc.c:1573:(.text+0x5b8): undefined reference to `_PyErr_SetLocaleString'
/usr/lib/gcc/x86_64-pc-cygwin/12/../../../../x86_64-pc-cygwin/bin/ld: Modules/_ctypes/callproc.o: in function `py_dl_open':
/usr/src/debug/python312-3.12.9-1/Modules/_ctypes/callproc.c:1555:(.text+0x6f8): undefined reference to `_PyErr_SetLocaleString'
collect2: error: ld returned 1 exit status
make: *** [Makefile:3130: Modules/_ctypes.cpython-312-x86_64-cygwin.dll] Error 1

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



### CPython versions tested on:

3.12

### Operating systems tested on:

Other

Activity

  1. matzeri
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Feb 21, 2025
  2. skirpichev
    added
    buildThe build process and cross-buildThe build process and cross-build
    on Feb 22, 2025
  3. ZeroIntensity
    added
    topic-ctypes
    on Feb 24, 2025
  4. jbigdata-git commented on Aug 11, 2025

    @jbigdata-git
    jbigdata-git
    on Aug 11, 2025
    More actions

    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.1

    3.12 ZIP downloaded from GIT
    -rwxr-xr-x 1 29927478 Aug 8 12:25 cpython-3.12.zip

    Configure 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 function whichmodule': ./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 1

    According 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_GetRequiredAttr

    And 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 function whichmodule': /home/jbdat/50-AI/cpython-3.12/./Modules/_pickle.c:1988:(.text+0xdc7e): undefined reference to _PySys_GetRequiredAttr'
    collect2: error: ld returned 1 exit status

    Can someone help me?

  5. encukou
    added
    OS-unsupported
    on Aug 11, 2025
  6. github-project-automation
    added this to Unsupported platformson Aug 11, 2025
  7. encukou commented on Aug 11, 2025

    @encukou
    encukou
    on Aug 11, 2025
    Member
    More actions

    I'm afraid I don't have Cygwing available to investigate this, but: did you make clean (or the stronger git clean -fxd) to remove artifacts from any previous builds?

  8. jbigdata-git commented on Aug 13, 2025

    @jbigdata-git
    jbigdata-git
    on Aug 13, 2025
    More actions

    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...

  9. encukou commented on Feb 13, 2026

    @encukou
    encukou
    on Feb 13, 2026
    Member
    More actions

    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!

  10. encukou
    closed this as not plannedon Feb 13, 2026
  11. github-project-automation
    moved this to Done in Unsupported platformson Feb 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-unsupportedbuildThe build process and cross-buildThe build process and cross-buildtopic-ctypestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    • Unsupported platforms
      Status
      Done
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.