Skip to content

provide an opt-out of raw-dylib#6185

Open
davidhewitt wants to merge 7 commits into
PyO3:mainfrom
davidhewitt:raw-dylib-opt-out
Open

provide an opt-out of raw-dylib#6185
davidhewitt wants to merge 7 commits into
PyO3:mainfrom
davidhewitt:raw-dylib-opt-out

Conversation

@davidhewitt

Copy link
Copy Markdown
Member

This is my attempt to fix #6157

Where this differs from #6164 and #6182:

  • I don't try to extend raw-dylib linking to mingw for now, instead I make PyO3 fall back to requiring the full import lib.
  • I don't try to add "lib" prefix, unlike internal: [codex] try fix mingw libname #6164 (this is done automatically by the gnu linker)
  • Both PRs claim that mixed C/Rust projects might need the full import library; rather than guess at when this should happen I introduce PYO3_USE_RAW_DYLIB=0 opt-out.

I verified this by hand on a windows box in a mingw environment; it seems to work correctly where main is broken.

@davidhewitt davidhewitt requested a review from messense July 4, 2026 10:44
@davidhewitt

Copy link
Copy Markdown
Member Author

cc @chirizxc - I think by introducing a fallback to using the import lib (i.e. the "old" behaviour) this might be a better route to go down compared to #6164? Thanks for that PR and sorry I was so slow to get deep into it.

@messense

messense commented Jul 4, 2026

Copy link
Copy Markdown
Member

Providing a opt-out sounds good to me. Note that I did also verify a revision of #6182 on github actions in https://github.com/messense/pyo3/actions/runs/28695802239

@chirizxc

chirizxc commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

cc @chirizxc - I think by introducing a fallback to using the import lib (i.e. the "old" behaviour) this might be a better route to go down compared to #6164? Thanks for that PR and sorry I was so slow to get deep into it.

I'm fine with any option (since I don't use these platforms)

@ognevny what do you think about this?

@ognevny

ognevny commented Jul 4, 2026

Copy link
Copy Markdown

lgtm

@davidhewitt

Copy link
Copy Markdown
Member Author

Thanks all, I think I will proceed to merge this and ship 0.29.1. (Probably will get it live tomorrow.)

fn default_lib_name_windows(abi: PythonAbi, mingw: bool, debug: bool) -> Result<String> {
// mingw formats lib names like unix, and uses a "lib" prefix. We could let the linker
// handle "lib" prefix, but that means the `raw-dylib` name is incorrect (where the
// "lib" prefix is not automatically added).)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- // "lib" prefix is not automatically added).)
+ // "lib" prefix is not automatically added)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0.28 raw-dylib linking regressed MSYS2/MinGW (libpython3X.dll vs python3X.dll)

4 participants