rust-embedded/riscv-rt

Building this crate tries to use nonexistent std crate

aaazalea opened this issue · 2 comments

When I try to build this crate, I get errors seemingly as a result of trying to find crate std, which confuses me because there is a line telling the compiler not to do that.
https://github.com/riscv-rust/riscv-rt/blob/9e7d5bcb51326e81c0a102237d08e94eb267c9dd/src/lib.rs#L159

My output:

jakobw@ubuntu:~/riscv/riscv-rt$ xargo build --verbose
+ "rustc" "--print" "sysroot"
+ RUSTFLAGS="--sysroot /home/jakobw/riscv/riscv-rust-toolchain/build/xargo/HOST"
+ "cargo" "build" "--verbose"
       Fresh bare-metal v0.1.1
   Compiling riscv-rt v0.1.3 (file:///home/jakobw/riscv/riscv-rt)
       Fresh r0 v0.2.2
       Fresh riscv v0.1.4 (file:///home/jakobw/riscv/riscv)
     Running `rustc --crate-name build_script_build build.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=7bea7d42aad28252 -C extra-filename=-7bea7d42aad28252 --out-dir /home/jakobw/riscv/riscv-rt/target/debug/build/riscv-rt-7bea7d42aad28252 -C incremental=/home/jakobw/riscv/riscv-rt/target/debug/incremental -L dependency=/home/jakobw/riscv/riscv-rt/target/debug/deps --sysroot /home/jakobw/riscv/riscv-rust-toolchain/build/xargo/HOST`
error[E0463]: can't find crate for `std`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: Could not compile `riscv-rt`.

Caused by:
  process didn't exit successfully: `rustc --crate-name build_script_build build.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=7bea7d42aad28252 -C extra-filename=-7bea7d42aad28252 --out-dir /home/jakobw/riscv/riscv-rt/target/debug/build/riscv-rt-7bea7d42aad28252 -C incremental=/home/jakobw/riscv/riscv-rt/target/debug/incremental -L dependency=/home/jakobw/riscv/riscv-rt/target/debug/deps --sysroot /home/jakobw/riscv/riscv-rust-toolchain/build/xargo/HOST` (exit code: 101)

Any thoughts?

I had this happen as well. Rust is trying to compile the build.rs file, which does need std. I ended up fixing this by running:

./x.py dist --target x86_64-apple-darwin,riscv32iam-unknown-none

in the rust-lang repo to make sure that compiling rust from source also generated a compiler for my local machine capable of compiling the build.rs file.

Nice catch @bradjc. I guess this issue can be closed since we don't use xargo anymore.