Skip to content

cargo-miri does not support .json target files #2053

Closed
@budde25

Description

@budde25

rustc 1.61.0-nightly (76d770ac2 2022-04-02)
When I run cargo miri test with a custom target I get an error

If I run cargo miri test --target ./x86_64-os.json I get

error: target path "./x86_64-os.json" is not a valid file

Caused by:
  No such file or directory (os error 2)
fatal error: failed to run xargo

same error if I try thiscargo miri test --target x86_64-os.json

then I tried a fully qualified path cargo miri test --target /home/budd/Code/os/x86_64-os.json
and it said

error: Xargo doesn't support files as an argument to --target. Use `--target foo` instead of `--target foo.json`.
note: run with `RUST_BACKTRACE=1` for a backtrace
fatal error: failed to run xargo

finally I tried without the .json as cargo miri test --target /home/budd/Code/os/x86_64-os and got a panic

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: StripPrefixError(())', src/tools/cargo/src/cargo/core/compiler/fingerprint.rs:1290:60
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: `"/home/budd/.rustup/toolchains/nightly-2022-04-03-x86_64-unknown-linux-gnu/bin/cargo" "check" "--release" "--manifest-path" "/tmp/xargo.buKrTnrXV4hZ/Cargo.toml" "--target" "/home/budd/Code/os/x86_64-os" "-p" "std"` failed with exit code: Some(101)
note: run with `RUST_BACKTRACE=1` for a backtrace
fatal error: failed to run xargo

If custom target files are not supported by miri I think the error should be more clear, especially the first one that just said file not valid.
Also this target works perfectly fine without miri.

the x86_64-os.json is bellow.

{
  "llvm-target": "x86_64-unknown-none-gnu",
  "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",
  "pre-link-args": {
    "ld.lld": [
      "--script=src/arch/x86_64/linker.ld"
    ]
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-targetArea: concerns targets outside of what we currently supportC-proposalCategory: a proposal for something we might want to do, or maybe not; details still being worked out

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions