Skip to content

--print native-static-libs with --emit metadata prints nothing #137384

Open
@ChrisDenton

Description

@ChrisDenton

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

Metadata

Metadata

Assignees

Labels

A-CLIArea: Command-line interface (CLI) to the compilerC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions