Skip to content

Cannot compile a crate with a crate-type = ["rlib"] dependency #1691

@danielhenrymantilla

Description

@danielhenrymantilla

See danielhenrymantilla/rust-uninit#4

Steps to reproduce the problem

Have a crate with a crate-type = ["rlib"] dependency (that gets used):

cd $(mktemp -d)

cargo init --lib --name foo

cargo new --lib bar && echo 'bar = { path = "bar" }' >> Cargo.toml

cat >>bar/Cargo.toml<<\#\ END
[lib]
crate-type = ["rlib"]
# END

echo 'use ::bar;' >> src/lib.rs

cargo miri test

The last command fails with:

error: extern location for bar does not exist: /private/var/folders/m_/347zzk7j6nz08tt6z3tnd3z00000gn/T/tmp.c7NSx84d/target/x86_64-apple-darwin/debug/deps/libbar-03d28c0dc71f4bad.rmeta
 --> src/lib.rs:8:7
  |
8 | use ::bar;
  |       ^^^
  • When I tried to debug this with a -vv flag, the copy-pasted compilation invocation of crate bar yielded no compilation artifacts (mainly, no .rmeta file).

Host context

  • As you can see from the error message, this, at least, happens on the x86_64-apple-darwin platform; will try to test this on Linux now Same for x86_64-unknown-linux-gnu.

  • cargo -V
    cargo 1.51.0-nightly (783bc43c6 2021-01-20)
    

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-cargoArea: affects the cargo wrapper (cargo miri)C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions