Linker output warning on expected linker output
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
With rustc 1.99.0-nightly (d453bdd8f 2026-08-14) I get this warning when linking a cdylib crate on Windows:
warning: linker stdout: Creating library rust_pyo3.cp315-win_amd64.dll.lib and object rust_pyo3.cp315-win_amd64.dll.exp
|
= note: `#[warn(linker_messages)]` on by default
warning: 1 warning emitted
I think this is expected output from the linker and it should not be reported as a warning. This seems to be either a regression of #136096 or a case not covered by the fix to that issue.
The compilation is driven by Meson rather than Cargo, thus the command line options passed to rustc may be unusual. This is the command that produces the warning, wrapped for readability:
"rustc" \
"-C" "linker=link" \
"--color=always" \
"-C" "debug-assertions=no" \
"-C" "overflow-checks=no" \
"-C" "embed-bitcode=no" \
"--crate-type" "cdylib" \
"-C" "link-arg=/release" \
"-C" "link-arg=/nologo" \
"-Cdefault-linker-libraries" \
"-Clink-arg=/nodefaultlib:libcmt" \
"-Clink-arg=/defaultlib:msvcrt" \
"--edition=2024" \
"-C" "opt-level=3" \
"--crate-name" "rust_pyo3_cp315_win_amd64" \
"--emit" "dep-info=rust_pyo3.cp315-win_amd64.pyd.p\rust_pyo3.cp315-win_amd64.d" \
"--emit" "link=rust_pyo3.cp315-win_amd64.pyd" \
"-C" "metadata=rust_pyo3.cp315-win_amd64.pyd@sha" \
"--check-cfg" "cfg(docsrs)" \
"--check-cfg" "cfg(test)" \
"--cfg" "feature=\"default\"" \
"-Z" "unstable-options" \
"--env-set" "OUT_DIR=D:\a\rust-pyo3-meson\rust-pyo3-meson\.mesonpy-833bppcm\meson" \
"--env-set" "CARGO_MANIFEST_DIR=D:\a\rust-pyo3-meson\rust-pyo3-meson\\" \
"--env-set" "CARGO_MANIFEST_PATH=D:\a\rust-pyo3-meson\rust-pyo3-meson\Cargo.toml" \
"--env-set" "CARGO_PKG_VERSION=1.0.0" \
"--env-set" "CARGO_PKG_VERSION_MAJOR=1" \
"--env-set" "CARGO_PKG_VERSION_MINOR=0" \
"--env-set" "CARGO_PKG_VERSION_PATCH=0" \
"--env-set" "CARGO_PKG_VERSION_PRE=" \
"--env-set" "CARGO_PKG_AUTHORS=" \
"--env-set" "CARGO_PKG_NAME=rust-pyo3" \
"--env-set" "CARGO_PKG_HOMEPAGE=" \
"--env-set" "CARGO_PKG_REPOSITORY=" \
"--env-set" "CARGO_PKG_LICENSE=" \
"--env-set" "CARGO_PKG_LICENSE_FILE=" \
"--env-set" "CARGO_PKG_RUST_VERSION=" \
"--env-set" "CARGO_PKG_README=" \
"--env-set" "CARGO_CRATE_NAME=rust_pyo3" \
"--extern" "pyo3=subprojects\pyo3-0.29.2\libpyo3+0_29.rlib" \
"-Clink-arg=C:\hostedtoolcache\windows\Python\3.15.0-rc.1\x64\libs\python315.lib" \
"-Lsubprojects\pyo3-0.29.2" \
"-Lsubprojects\libc-0.2.189" \
"-Lsubprojects\once_cell-1.21.4" \
"-Lsubprojects\pyo3-ffi-0.29.2" \
"-Lsubprojects\portable-atomic-1.15.0" \
"-Lsubprojects\pyo3-macros-0.29.2" \
"-LC:\hostedtoolcache\windows\Python\3.15.0-rc.1\x64\libs" \
"-C" "link-arg=/SUBSYSTEM:CONSOLE"
../src/lib.rs
This can be reproduced building this project https://github.com/dnicolodi/rust-pyo3-meson with Meson. Building the same with Cargo does not result in a similar warning to be emitted.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the warning with the linked rust-pyo3-meson project using its Meson-driven rustc command, then compare it with the Cargo build that does not warn. Trace how rustc handles linker stdout under #[warn(linker_messages)] for the Windows cdylib case; done means expected linker output is not reported as a warning while relevant linker diagnostics remain visible.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100