I’ve made a buildEnv using the packages: rustc, cargo, gcc, pkgsCross.aarch64-multiplatform.gcc
I get the following error:
cargo build --target x86_64-unknown-linux-gnu
Compiling hello-rust v0.1.0
error[E0463]: can't find crate for `std`
|
= note: the `x86_64-unknown-linux-gnu` target may not be installed
= help: consider downloading the target with `rustup target add x86_64-unknown-linux-gnu`
Do I need to add the target as a package?
Also, “x86_64-unknown-linux-gnu-gcc” is missing from /bin. How can I install it?
I’ve tried to search for it on NixOS Search
and it shows up under “libgcc” package, and supposedly provides it, but it’s still missing.
So I’m confused as to how to install these in a idiomatic nixpkgs way.
I tried using runCommand to copy from “pkgsCross.aarch64-multiplatform.gcc”, which also contains gcc. Should I copy them and add “x86_64-unknown-linux-gnu-” prefixes, or what’s the correct way? It seems quite hacky.
The Nix wiki links to an example, but it uses rustup, and I want to use a nix package.
I’m guessing there is no package currently?
Can you post the whole thing? Typically you want to use a correctly configured cross pkgs + callPackage on your pkg accepting any dependencies you need (i.e. stdenv, rustPlatform, etc).
I have never tried to have a cross-ready development-shell, but as a datapoint, crate2nix generates files which are cross-ready. For example, I can get a cross compiled nix-du as follows: