`--print native-static-libs` with `--emit metadata` prints nothing
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
It should be possible to print the necessary native libs without actually creating the static library. However, combining --emit metadata with --print native-static-libs does not print anything.
I tried this:
$ rustc /dev/null --print native-static-libs --crate-type staticlib --emit metadata
I expected to see this printed to the console:
note: Link against the following native artifacts when linking against this static library. The order and any duplication can be significant on some platforms.
note: native-static-libs: -lgcc_s -lutil -lrt -lpthread -lm -ldl -lc
Instead, this happened: the output is empty.
If I run without --emit metadata it works:
$ rustc /dev/null --print native-static-libs --crate-type staticlib
note: Link against the following native artifacts when linking against this static library. The order and any duplication can be significant on some platforms.
note: native-static-libs: -lgcc_s -lutil -lrt -lpthread -lm -ldl -lc
However, this also creates libnull.a.
Meta
rustc --version --verbose:
rustc 1.87.0-nightly (f04bbc60f 2025-02-20)
binary: rustc
commit-hash: f04bbc60f8c353ee5ba0677bc583ac4a88b2c180
commit-date: 2025-02-20
host: x86_64-unknown-linux-gnu
release: 1.87.0-nightly
LLVM version: 20.1.0
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
Start by reproducing the two rustc commands in the issue and compare their output and generated files. Trace the handling of --print native-static-libs together with --emit metadata; done means the native library note is printed without creating libnull.a.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100