Unable to statically link a native library if there a dynamic library in the same directory.
Open
Nobody has claimed this yet.
A-linkage
C-bug
S-needs-repro
T-compiler
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Code
rustc -L native='/usr/local/Cellar/libplist/2.4.0/lib' -l static=plist-2.0 main.rs
Meta
rustc --version --verbose:
rustc 1.79.0-nightly (aed2187d5 2024-04-27)
binary: rustc
commit-hash: aed2187d53b8789e3a37f50ae36f894a2a679077
commit-date: 2024-04-27
host: x86_64-apple-darwin
release: 1.79.0-nightly
LLVM version: 18.1.4
Error output
There were both of a dynamic library file and a static library file in the lib directory.
The program was built successfully, but it was linked with a dynamic library rather than the static library.
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 rustc command with both dynamic and static library files in the native library directory, using the reported nightly version and macOS environment. Trace native library selection and linking behavior, then verify that the static library is selected and add a regression test covering the directory contents and command-line options.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system, compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100