Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo miri setup failing on custom target #2771

Closed
bindsdev opened this issue Jan 30, 2023 · 3 comments
Closed

cargo miri setup failing on custom target #2771

bindsdev opened this issue Jan 30, 2023 · 3 comments

Comments

@bindsdev
Copy link

bindsdev commented Jan 30, 2023

I am attempting to use Miri in a bare metal project using my custom target. When I run cargo miri setup --target MY_TARGET, it prepares a sysroot for the target, but fails with:

error[E0464]: multiple candidates for `rmeta` dependency `core` found
 --> /home/binds/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core/lib.rs:4:9
  |
4 | pub use core::*;
  |         ^^^^
  |
  = note: candidate #1: /tmp/.tmpSCntaC/target/x86_64-prestige/release/deps/libcore-5484c1dfc1494680.rmeta
  = note: candidate #2: /tmp/.tmpSCntaC/target/x86_64-prestige/release/deps/libcore-fe8fccd3bdf8e7b3.rmeta

For more information about this error, try `rustc --explain E0464`.
error: could not compile `rustc-std-workspace-core` due to previous error
fatal error: failed to build sysroot: sysroot build failed

I am at a loss for what could be causing this. Even if I cargo clean, the same error occurs. I will put anything I believe relevant to help solve this:

rustc -vV:

rustc 1.69.0-nightly (e972bc808 2023-01-29)
binary: rustc
commit-hash: e972bc8083d5228536dfd42913c8778b6bb04c8e
commit-date: 2023-01-29
host: x86_64-unknown-linux-gnu
release: 1.69.0-nightly
LLVM version: 15.0.7

My custom target:

{
    "llvm-target": "x86_64-unknown-none",
    "data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
    "arch": "x86_64",
    "target-endian": "little",
    "target-pointer-width": "64",
    "target-c-int-width": "32",
    "os": "none",
    "executables": true,
    "linker-flavor": "ld.lld",
    "linker": "rust-lld",
    "panic-strategy": "abort",
    "disable-redzone": true,
    "features": "-mmx,-sse,+soft-float",
    "code-model": "kernel",
    "pre-link-args": {
        "ld.lld": [
            "--gc-sections",
            "-T.cargo/linker.ld"
        ]
    }
}

It seems like JSON targets began to be supported as of #2744, so I don't think its an issue with Miri's support for it.

.cargo/config.toml:

[unstable]
build-std = ["core", "compiler_builtins", "alloc"]
build-std-features = ["compiler-builtins-mem"]

rust-toolchain.toml:

[toolchain]
channel = "nightly"
components = ["rust-src", "rustfmt", "clippy", "miri"]
@RalfJung
Copy link
Member

RalfJung commented Jan 30, 2023 via email

@bindsdev
Copy link
Author

bindsdev commented Jan 30, 2023

The error looks similar to #2705... Does 'cargo miri setup' without --target work?

No, it does not (x86_64-unknown-linux-gnu)

@RalfJung
Copy link
Member

So, exact duplicate of #2705?

In that case please post over there with your OS details, and the output of cargo miri setup -v. I am at a complete loss about what might be causing this but maybe there's a pattern...

@bindsdev bindsdev closed this as not planned Won't fix, can't repro, duplicate, stale Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants