daniestevez / galileo-osnma

Galileo OSNMA (Open Service Navigation Message Authentication)
Apache License 2.0
50 stars 8 forks source link

Unable to build for 'osnma-longan-nano' #3

Closed K4KDR closed 2 years ago

K4KDR commented 2 years ago

Good day!

I have tried to follow the instructions exactly but unfortunately have been unable to build the crate for 'osnma-longan-nano'

Here is some output that I hope might both illustrate the error and hopefully provide enough detail to point out where I have gone wrong. Many thanks!!

k4kdr@3010i5:~/galileo-osnma/osnma-longan-nano$ cargo build --release
   Compiling subtle v2.4.1
   Compiling cfg-if v1.0.0
   Compiling base64ct v1.4.1
error[E0463]: can't find crate for `core`
  |
  = note: the `riscv32imac-unknown-none-elf` target may not be installed
  = help: consider downloading the target with `rustup target add riscv32imac-unknown-none-elf`

For more information about this error, try `rustc --explain E0463`.
error: could not compile `subtle` due to previous error
warning: build failed, waiting for other jobs to finish...
error: build failed

k4kdr@3010i5:~/galileo-osnma/osnma-longan-nano$ rustup target add riscv32imac-unknown-none-elf
info: component 'rust-std' for target 'riscv32imac-unknown-none-elf' is up to date

k4kdr@3010i5:~/galileo-osnma/osnma-longan-nano$ rustup component list --installed
cargo-x86_64-unknown-linux-gnu
clippy-x86_64-unknown-linux-gnu
rust-docs-x86_64-unknown-linux-gnu
rust-std-riscv32imac-unknown-none-elf
rust-std-x86_64-unknown-linux-gnu
rustc-x86_64-unknown-linux-gnu
rustfmt-x86_64-unknown-linux-gnu

k4kdr@3010i5:~/galileo-osnma/osnma-longan-nano$ rustup show
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/k4kdr/snap/rustup/common/rustup

installed targets for active toolchain
--------------------------------------

riscv32imac-unknown-none-elf
x86_64-unknown-linux-gnu

active toolchain
----------------

stable-x86_64-unknown-linux-gnu (default)
rustc 1.59.0 (9d1b2106e 2022-02-23)

k4kdr@3010i5:~/galileo-osnma/osnma-longan-nano$ rustup toolchain list
stable-x86_64-unknown-linux-gnu (default)
K4KDR commented 2 years ago

Ok, problem solved. I removed the version of rust that I had previously installed from the Ubuntu repository and reinstalled from https://www.rust-lang.org/tools/install

... now the build completes successfully.

osnma-longan-nano-build-complete

daniestevez commented 2 years ago

I think the problem here is that you had two copies of rustc. One installed system-wide by apt, and the other one installed to $HOME/.cargo/bin by rustup. Only the rustup one had support for rv32imac. However, depending on which order you have the folders in your $PATH, when you call rustc you may get one or the other. It looks like cargo was actually calling the system-wide rustc. You can see which one you get with which rustc. Probably you should have $HOME/.cargo/bin first in your $PATH to avoid weird problems like this one.

K4KDR commented 2 years ago

Yes, the repository version of rust/cargo worked for the command:

nc 86.82.68.237 10000 | RUST_LOG=info cargo run --release OSNMA_PublicKey_20210920133026.pem

... but obviously not for building the osnma-longan-nano package.

Thanks!

daniestevez commented 2 years ago

Good. I think this issue can be close now (you can close it yourself).

K4KDR commented 2 years ago

Will do!