-
Notifications
You must be signed in to change notification settings - Fork 93
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
can't find target file on nightlies >= 2017-12-24 #186
Comments
This is showing up in the compiler-builtins project as well and is almost for sure caused by rust-lang/rust#46630 which primarily pulled in rust-lang/cargo#4788, the real culprit. In rust-lang/cargo#4788 the behavior of Cargo was tweaked to alter the cwd of the rustc process to always be at the workspace root (fixes a few bugs in Cargo and locks down the behavior for procedural macros). My guess is that when building libcore the cwd is changing to the rust-src root, not the project's cwd which has the custom target spec. @japaric would it be possible for xargo to perhaps to rely on and update |
set RUST_TARGET_PATH when compiling the sysroot to let rustc find custom target specification files located in the current directory closes #186
I'm not sure if this is fully resolved. While everything seems to be working for dependencies declared in $ xargo build --target=aarch64-none-elf -vv
+ "rustc" "--print" "sysroot"
+ "rustc" "--print" "target-list"
+ RUSTFLAGS="--sysroot /$home/.xargo"
+ "cargo" "build" "--target=aarch64-none-elf" "-vv"
Compiling rlibc v1.0.0
Running `rustc --crate-name rlibc /$home/.cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/rlibc-1.0.0/src/lib.rs --crate-type lib --emit=dep-info,link -C panic=abort -C debuginfo=2 -C metadata=430eb7b99c5e6c03 -C extra-filename=-430eb7b99c5e6c03 --out-dir /$project/target/aarch64-none-elf/debug/deps --target aarch64-none-elf -L dependency=/$project/target/aarch64-none-elf/debug/deps -L dependency=/$project/target/debug/deps --cap-lints warn --sysroot /$home/.xargo`
error: Error loading target specification: Could not find specification for target "aarch64-none-elf"
|
= help: Use `--print target-list` for a list of built-in targets
error: Could not compile `rlibc`. |
@SergioBenitez What you are seeing, I would say, is (unintentional) breakage caused by rust-lang/cargo#4788 and is outside Xargo's jurisdiction. The issue appears even if you are not using Xargo: $ cargo new --lib foo
$ cd foo
$ echo '#![no_std]' > src/lib.rs
$ cargo add heapless
$ rustc -Z unstable-options --target x86_64-unknown-linux-gnu --print target-spec-json > foo.json
$ cargo build --target foo
Compiling untagged-option v0.1.1
error: Error loading target specification: Could not find specification for target "foo" Due to rust-lang/cargo#4788 now all users of custom targets will have to set RUST_TARGET_PATH to the directory that contains the specification file if they have any dependency declared in Cargo.toml. I would suggest opening a Cargo issue regarding the breakage. Xargo is correctly doing the only job it has: building and managing the sysroot -- as you said Xargo.toml works. |
Beginning with
rustc 1.24.0-nightly (c284f8807 2017-12-24)
,xargo
fails to build a project with a custom target with the following error message:The same under older nightlies works just fine:
I've tried
xargo clean
,rm -rf ~/.xargo
, wiping and reinstalling the latest nightly releases, and wiping and reinstallingxargo
, to no avail.From the looks of the logs, this looks like it might be either a bug in
cargo
/rustc
or a change in the way thatcargo
/rustc
finds custom target files.The text was updated successfully, but these errors were encountered: