Skip to content

Fix Windows GNU staticlib output naming - #4231

Merged
UebelAndre merged 1 commit into
bazelbuild:mainfrom
cerisier:cerisier/windows-gnu-staticlib-naming
Aug 15, 2026
Merged

Fix Windows GNU staticlib output naming#4231
UebelAndre merged 1 commit into
bazelbuild:mainfrom
cerisier:cerisier/windows-gnu-staticlib-naming

Conversation

@cerisier

Copy link
Copy Markdown
Contributor

Summary

Make Rust static-library naming ABI-aware on Windows.

Rust emits lib<crate>.a for the GNU and GNULLVM Windows ABIs, while MSVC emits <crate>.lib. The generated Rust toolchain currently selects .lib from the operating system alone, and determine_lib_name removes the lib prefix for every Windows static library. As a result, Bazel declares an output different from the file emitted by rustc for Windows GNU-like targets.

This change passes the target ABI through repository and toolchain generation, selects .a for Windows GNU/GNULLVM static libraries, and preserves their lib prefix. MSVC behavior and Windows dynamic-library naming remain unchanged.

Regression coverage exercises the extension mapping, rendered toolchain metadata, final GNU/GNULLVM/MSVC static-library names, and the unchanged GNU cdylib name.

@cerisier
cerisier marked this pull request as ready for review August 15, 2026 09:18

@UebelAndre UebelAndre left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you!

@UebelAndre
UebelAndre added this pull request to the merge queue Aug 15, 2026
Merged via the queue into bazelbuild:main with commit ca5c131 Aug 15, 2026
3 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.

2 participants