Skip to content

Warning when linking Python extension module written in Rust #16120

Description

@dnicolodi

The linking of a Python extension module written in Rust results in this warning:

 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

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

To Reproduce
See the project in this repository https://github.com/dnicolodi/rust-pyo3-meson The warning can be seen here https://github.com/dnicolodi/rust-pyo3-meson/actions/runs/31894115936/job/95034642886#step:5:269

system parameters

  • what operating system: Windows (there is no warning on Linux or macOS)
  • what meson --version: 1.12.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    not-our-bugBug in upstream software

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions