Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

building for Embedded RISC-V does not work #207

Open
wuyoli opened this issue Jan 27, 2025 · 5 comments
Open

building for Embedded RISC-V does not work #207

wuyoli opened this issue Jan 27, 2025 · 5 comments
Labels
question Further information is requested

Comments

@wuyoli
Copy link

wuyoli commented Jan 27, 2025

I'm trying to make a flake for Embedded Development on CH32V307 microcontrollers. I did get Cargo build working successfully, but nix build doesn't work. When trying to do so it fails with the following error:

> Running phase: buildPhase
       > error: no matching package named `compiler_builtins` found
       > location searched: directory source `/build/cargo-vendor-dir` (which is replacing registry `crates-io`)
       > required by package `std v0.0.0 (/nix/store/a9flgvs64klvknn49qrsw3xlqsznyc2g-rust-default-1.85.0-nightly-2025-01-01/lib/rustlib/src/rust/library/std)`
       >     ... which satisfies path dependency `std` (locked to 0.0.0) of package `sysroot v0.0.0 (/nix/store/a9flgvs64klvknn49qrsw3xlqsznyc2g-rust-default-1.85.0-nightly-2025-01-01/lib/rustlib/src/rust/library/sysroot)`
@wuyoli
Copy link
Author

wuyoli commented Feb 5, 2025

Am I doing something wrong or is this out of scope?

@oxalica oxalica added the question Further information is requested label Feb 8, 2025
@oxalica
Copy link
Owner

oxalica commented Feb 8, 2025

Am I doing something wrong or is this out of scope?

Please provide the nix file you use, the command your run and the Rust project you are building, in order to find out what the issue is.

@wuyoli
Copy link
Author

wuyoli commented Feb 9, 2025

the following repo contains the code + flake:
https://tildegit.org/purelyserious/ch32v307-blink-rust

@wuyoli
Copy link
Author

wuyoli commented Feb 12, 2025

do you have any ideas how to build this with nix?

@tsheinen
Copy link

tsheinen commented Mar 2, 2025

I just ran into a similar problem -- the issue is unrelated to rust-overlay. It's a problem with the combination of vendoring and -Zbuild-std because std requires out-of-tree crates. Naersk will take an extra Cargo.lock as an argument since #328 and that's probably the easiest route forward? Alternatively if you add all the std deps to your dependency graph somewhere (dev-dependencies works) then the regular nixpkgs vendor will work.

naersk.buildPackage {
  src = ./.;
  additionalCargoLock = "${rust-toolchain}/lib/rustlib/src/rust/library/Cargo.lock";
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants