0

To cross-compile with Rust, the cross program exists. To use it Docker needs to run without root permissions (it does) and cross needs to be installed, with e.g. cargo install cross -f (it is). I did this without root rights.

But if I run in the same terminal cross, I always get an error: "cross: Command not found.", even after a restart. Despite every tutorial telling me cargo install cross... should be enough.

Edit: I saw that the problem is that "~/.cargo/bin/" wasn't added to the path variable.

Edit 2: I used the recommended way to install Rust with rustup, but cargo was put into /snap/bin/cargo (maybe thanks to Ubuntu?). While I think I can fix my problem with adding ~/.cargo/bin to my path variable, I would like to know what's the best way, so everything is put into the same place.

(I use Ubuntu 20.04.6 LTS on an AMD64 platform.)

3
  • 1
    Is your question "how to add to PATH"? Because there are a multitude of resources available to you with a simple search.
    – PitaJ
    May 16 at 16:54
  • 1
    "~/.cargo/bin/ wasn't added to the path variable" - how did you install cargo?
    – kmdreko
    May 16 at 16:55
  • I installed it via curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh, suggested from "rust-lang.org/tools/install". The difference is, that my cargo bin landed in "/snap/bin/cargo" (I think thanks to Ubuntu) and not in "~/.cargo/bin", which is the directory where it should land according to the official rustup website. May 16 at 17:30

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.