Summary
PyO3 0.28 (PR #5866) switched Windows linking to Rust's raw-dylib and hardcoded the imported DLL name as python3X.dll. This regressed MSYS2/MinGW (*-pc-windows-gnu) downstream builds, where the Python DLL is named libpython3X.dll (Unix-style lib prefix). Every Python C-API symbol now comes back undefined at link time.
This was already flagged by @ognevny on the merged PR but doesn't have a tracking issue:
#5866 (comment)
hi, this change seem to regress MINGW downstream builds, probably because we use libpython3.dll library (it uses the lib prefix like any other UNIX environment)
The previous escape hatch (generate-import-lib) is now a deprecated no-op per the 0.28 changelog, so downstreams have no way to opt out aside from pinning pyo3 = "0.27.x".
Downstream impact
Truncated link error from the failing log:
ld.exe: ...libpyo3-*.rlib: undefined reference to `PyUnicode_FromStringAndSize'
ld.exe: ...libpyo3-*.rlib: undefined reference to `Py_GenericAlias'
ld.exe: ...libpyo3-*.rlib: undefined reference to `PyDict_New'
... (many more)
collect2.exe: error: ld returned 1 exit status
Proposed direction
Emit the lib-prefixed DLL name in extern_python_dll! / the raw-dylib import on *-pc-windows-gnu targets when the Python install is the MSYS2-style one — or expose a build-script knob so downstreams can override the import name.
Summary
PyO3 0.28 (PR #5866) switched Windows linking to Rust's
raw-dyliband hardcoded the imported DLL name aspython3X.dll. This regressed MSYS2/MinGW (*-pc-windows-gnu) downstream builds, where the Python DLL is namedlibpython3X.dll(Unix-stylelibprefix). Every Python C-API symbol now comes back undefined at link time.This was already flagged by @ognevny on the merged PR but doesn't have a tracking issue:
#5866 (comment)
The previous escape hatch (
generate-import-lib) is now a deprecated no-op per the 0.28 changelog, so downstreams have no way to opt out aside from pinningpyo3 = "0.27.x".Downstream impact
Truncated link error from the failing log:
Proposed direction
Emit the
lib-prefixed DLL name inextern_python_dll!/ theraw-dylibimport on*-pc-windows-gnutargets when the Python install is the MSYS2-style one — or expose a build-script knob so downstreams can override the import name.