echo icon indicating copy to clipboard operation
echo copied to clipboard

error: failed to run `rustc` to learn about target-specific information

Open coppock opened this issue 4 years ago • 8 comments

After running build.sh:

rm -f export_syms machine x86 hello.ko hello.kld ./objects/*.o hello.o
error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `rustc - --crate-name ___ --print=file-names --sysroot /home/pcoppock1/.xargo -Z force-unstable-if-unmarked --target x86_64-kernel-freebsd --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit code: 1)
--- stderr
error: Error loading target specification: Field target-c-int-width in target specification is required
  |
  = help: Use `--print target-list` for a list of built-in targets


error: `"cargo" "build" "--release" "--manifest-path" "/tmp/xargo.6bewgFfrvrSo/Cargo.toml" "--target" "x86_64-kernel-freebsd" "-p" "core"` failed with exit code: Some(101)
note: run with `RUST_BACKTRACE=1` for a backtrace

Is there any other information that would be useful in debugging this error?

Also, the target "x86_64-kernel-freebsd" is not built in to the Rust compiler. How is this target supported?

coppock avatar Mar 14 '20 17:03 coppock

The error message has one 'help' and one 'note' statement worth trying.

random532 avatar Mar 22 '20 05:03 random532

x86_64-kernel-freebsd is not in the list of build in targets, see: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_target/spec/index.html#modules

random532 avatar Mar 22 '20 15:03 random532

The error message has one 'help' and one 'note' statement worth trying.

I tried the help statement. As you stated in your second comment:

x86_64-kernel-freebsd is not in the list of build in targets, see: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_target/spec/index.html#modules

rustc --print target-list did not list "x86_64-kernel-freebsd." After looking at the code more closely, I think "x86_64-kernel-freebsd" is a custom target.

coppock avatar Mar 23 '20 11:03 coppock

I got the target spec. errors to disappear. Now I have a bunch of Rust errors. I've forked the repo.

coppock avatar Mar 31 '20 17:03 coppock

This repo is quite old and a lot has changed in Rust since then so I'm not surprised if this method doesn't work at all anymore. Xargo functionality is now found in Cargo I think. Using rust nightly of the time this repo was created is your best chance unless you want to spend a lot of time changing the code to work with newer rust.

johalun avatar Mar 31 '20 17:03 johalun

The allocator API also changed a lot but I can't recall if that was before or after I did this project.

johalun avatar Mar 31 '20 17:03 johalun

I'm gonna shoot for updating all the code to use current FreeBSD release and Rust version (as an undergraduate course project). Do you remember how long it took to get this project working originally?

coppock avatar Mar 31 '20 18:03 coppock

Hmm sorry I don't remember how long but it's definitely within the scope of one course, especially if you can build on this old repo. Good luck and have fun :)

johalun avatar Mar 31 '20 19:03 johalun