Skip to content

Stop adding link-native-libraries flag by default in Emscripten platform in latest Rust#2991

Merged
messense merged 2 commits intoPyO3:mainfrom
ryanking13:no-z-flag
Feb 13, 2026
Merged

Stop adding link-native-libraries flag by default in Emscripten platform in latest Rust#2991
messense merged 2 commits intoPyO3:mainfrom
ryanking13:no-z-flag

Conversation

@ryanking13
Copy link
Copy Markdown
Contributor

@ryanking13 ryanking13 commented Feb 12, 2026

The problem with rust trying to link libc was fixed in rust-lang/libc#4002, and this flag is not needed anymore for recent rust versions.

Always adding this flag is preventing from using the stable Rust toolchain as -Z flag can only be used with the nightly toolchains. From Rust 1.93.0, it is possible to use stable toolchain to build to Emscripten target, so this PR removes this flag for Rust >= 1.93.0

cc: @hoodmane

@hoodmane
Copy link
Copy Markdown
Contributor

The change to rust libc that fixed this problem occurred on Fri Nov 1 2024. But we can only build on stable since 1.93.0. Maybe gate this code behind a check on the date? Anything from 2025 or later doesn't need it.

@ryanking13 ryanking13 changed the title Stop adding link-native-libraries flag by default in Emscripten platform Stop adding link-native-libraries flag by default in Emscripten platform in latest Rust Feb 12, 2026
@ryanking13
Copy link
Copy Markdown
Contributor Author

Updated the condition to only work in < Rust 1.93.0 which might be the most conservative approach.

Copy link
Copy Markdown
Member

@messense messense left a comment

Choose a reason for hiding this comment

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

Thanks!

@messense messense merged commit cb9ebcf into PyO3:main Feb 13, 2026
45 checks passed
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.

3 participants