Skip to content

Build failure of 3.12.9 on Cygwin #130423

Open
@matzeri

Description

@matzeri

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

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions