Coder Social home page Coder Social logo

Can't run on Gentoo about avr-hal HOT 9 CLOSED

w1png avatar w1png commented on September 6, 2024
Can't run on Gentoo

from avr-hal.

Comments (9)

Rahix avatar Rahix commented on September 6, 2024

Hm, I am a bit lost here... The error message makes me believe your LLVM was not compiled with the AVR target enabled. But rustup is supposed to ship vendored LLVM instead of relying on something from the distro? Does this work differently on gentoo maybe?

from avr-hal.

w1png avatar w1png commented on September 6, 2024

The AVR target is enabled:

[ebuild   R    ] sys-devel/llvm-15.0.6-r1:15::gentoo  USE="binutils-plugin libffi ncurses xml -debug -doc -exegesis -libedit -test -verify-sig -xar -z3 -zstd" ABI_X86="32 (64) (-x32)" LLVM_TARGETS="(AArch64) (AMDGPU) (ARM) (AVR) (BPF) (Hexagon) (Lanai) (MSP430) (Mips) (NVPTX) (PowerPC) (RISCV) (Sparc) (SystemZ) (VE) (WebAssembly) (X86) (XCore) (-ARC) (-CSKY) (-DirectX) (-LoongArch) (-M68k) (-SPIRV)" 0 KiB

from avr-hal.

w1png avatar w1png commented on September 6, 2024

Ok I recompiled rust with llvm target use flags and this error dissapeared.

/etc/portage/package.use

---
>=dev-lang/rust-1.66.0:stable/1.66::gentoo llvm_targets_AVR llvm_targets_ARM

from avr-hal.

w1png avatar w1png commented on September 6, 2024

But now there is a different problem:

error[E0463]: can't find crate for `core`
  |
  = note: the `avr-atmega328p` target may not be installed
  = help: consider downloading the target with `rustup target add avr-atmega328p`

error[E0463]: can't find crate for `compiler_builtins`

error: cannot find attribute `derive` in this scope
  --> /home/w1png/.cargo/registry/src/github.com-1ecc6299db9ec823/bare-metal-1.0.0/src/lib.rs:50:3
   |
50 | #[derive(Debug)]
   |   ^^^^^^

error[E0463]: can't find crate for `core`
   --> /home/w1png/.cargo/registry/src/github.com-1ecc6299db9ec823/nb-1.0.0/src/lib.rs:189:5
    |
189 | use core::fmt;
    |     ^^^^ can't find crate
    |
    = note: the `avr-atmega328p` target may not be installed
    = help: consider downloading the target with `rustup target add avr-atmega328p`

error: cannot find attribute `derive` in this scope
  --> /home/w1png/.cargo/registry/src/github.com-1ecc6299db9ec823/bare-metal-1.0.0/src/lib.rs:15:3
   |
15 | #[derive(Clone, Copy, Debug)]
   |   ^^^^^^

error: cannot find attribute `derive` in this scope
   --> /home/w1png/.cargo/registry/src/github.com-1ecc6299db9ec823/nb-1.0.0/src/lib.rs:198:3
    |
198 | #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
    |   ^^^^^^

error[E0463]: can't find crate for `core`
   --> /home/w1png/.cargo/registry/src/github.com-1ecc6299db9ec823/nb-1.0.0/src/lib.rs:192:27
    |
192 | pub type Result<T, E> = ::core::result::Result<T, Error<E>>;
    |                           ^^^^ can't find crate
    |
    = note: the `avr-atmega328p` target may not be installed
    = help: consider downloading the target with `rustup target add avr-atmega328p`

error[E0405]: cannot find trait `Copy` in this scope
  --> /home/w1png/.cargo/registry/src/github.com-1ecc6299db9ec823/vcell-0.1.3/src/lib.rs:31:18
   |
31 |         where T: Copy
   |                  ^^^^ not found in this scope

error[E0405]: cannot find trait `Copy` in this scope
  --> /home/w1png/.cargo/registry/src/github.com-1ecc6299db9ec823/vcell-0.1.3/src/lib.rs:39:18
   |
39 |         where T: Copy
   |                  ^^^^ not found in this scope

error[E0405]: cannot find trait `Sync` in this scope
  --> /home/w1png/.cargo/registry/src/github.com-1ecc6299db9ec823/bare-metal-1.0.0/src/lib.rs:87:16
   |
87 | unsafe impl<T> Sync for Mutex<T> where T: Send {}
   |                ^^^^ not found in this scope

error[E0405]: cannot find trait `Send` in this scope
  --> /home/w1png/.cargo/registry/src/github.com-1ecc6299db9ec823/bare-metal-1.0.0/src/lib.rs:87:43
   |
87 | unsafe impl<T> Sync for Mutex<T> where T: Send {}
   |                                           ^^^^ not found in this scope

error[E0463]: can't find crate for `core`
  --> /home/w1png/.cargo/registry/src/github.com-1ecc6299db9ec823/ufmt-write-0.1.0/src/lib.rs:14:5
   |
14 |     core::mem::uninitialized()
   |     ^^^^ can't find crate
   |
   = note: the `avr-atmega328p` target may not be installed
   = help: consider downloading the target with `rustup target add avr-atmega328p`

error[E0463]: can't find crate for `core`
  --> /home/w1png/.cargo/registry/src/github.com-1ecc6299db9ec823/void-1.0.2/src/lib.rs:16:5
   |
16 |     extern crate core;
   |     ^^^^^^^^^^^^^^^^^^ can't find crate
   |
   = note: the `avr-atmega328p` target may not be installed
   = help: consider downloading the target with `rustup target add avr-atmega328p`

error[E0405]: cannot find trait `FnOnce` in this scope
   --> /home/w1png/.cargo/registry/src/github.com-1ecc6299db9ec823/nb-1.0.0/src/lib.rs:223:12
    |
223 |         F: FnOnce(E) -> T,
    |            ^^^^^^ not found in this scope

error[E0405]: cannot find trait `From` in this scope
   --> /home/w1png/.cargo/registry/src/github.com-1ecc6299db9ec823/nb-1.0.0/src/lib.rs:232:9
    |
232 | impl<E> From<E> for Error<E> {
    |         ^^^^ not found in this scope

error: cannot find attribute `derive` in this scope
  --> /home/w1png/.cargo/registry/src/github.com-1ecc6299db9ec823/void-1.0.2/src/lib.rs:28:3
   |
28 | #[derive(Copy)]
   |   ^^^^^^

error[E0412]: cannot find type `Result` in this scope
  --> /home/w1png/.cargo/registry/src/github.com-1ecc6299db9ec823/ufmt-write-0.1.0/src/lib.rs:27:41
   |
27 |     fn write_str(&mut self, s: &str) -> Result<(), Self::Error>;
   |                                         ^^^^^^ not found in this scope

error[E0412]: cannot find type `Result` in this scope
  --> /home/w1png/.cargo/registry/src/github.com-1ecc6299db9ec823/ufmt-write-0.1.0/src/lib.rs:34:42
   |
34 |     fn write_char(&mut self, c: char) -> Result<(), Self::Error> {
   |                                          ^^^^^^ not found in this scope

error[E0405]: cannot find trait `Clone` in this scope
  --> /home/w1png/.cargo/registry/src/github.com-1ecc6299db9ec823/void-1.0.2/src/lib.rs:31:6
   |
31 | impl Clone for Void {
   |      ^^^^^ not found in this scope

error[E0412]: cannot find type `Option` in this scope
  --> /home/w1png/.cargo/registry/src/github.com-1ecc6299db9ec823/void-1.0.2/src/lib.rs:56:37
   |
56 |     fn partial_cmp(&self, _: &T) -> Option<cmp::Ordering> {
   |                                     ^^^^^^ not found in this scope

error[E0405]: cannot find trait `Sized` in this scope
  --> /home/w1png/.cargo/registry/src/github.com-1ecc6299db9ec823/void-1.0.2/src/lib.rs:85:29
   |
85 | pub trait ResultVoidExt<T>: Sized {
   |                             ^^^^^ not found in this scope

error[E0412]: cannot find type `Result` in this scope
  --> /home/w1png/.cargo/registry/src/github.com-1ecc6299db9ec823/void-1.0.2/src/lib.rs:90:30
   |
90 | impl<T> ResultVoidExt<T> for Result<T, Void> {
   |                              ^^^^^^ not found in this scope

error[E0531]: cannot find tuple struct or tuple variant `Ok` in this scope
  --> /home/w1png/.cargo/registry/src/github.com-1ecc6299db9ec823/void-1.0.2/src/lib.rs:97:13
   |
97 |             Ok(val) => val,
   |             ^^ not found in this scope

error[E0531]: cannot find tuple struct or tuple variant `Err` in this scope
  --> /home/w1png/.cargo/registry/src/github.com-1ecc6299db9ec823/void-1.0.2/src/lib.rs:98:13
   |
98 |             Err(e) => unreachable(e)
   |             ^^^ not found in this scope

error[E0405]: cannot find trait `Sized` in this scope
   --> /home/w1png/.cargo/registry/src/github.com-1ecc6299db9ec823/void-1.0.2/src/lib.rs:104:32
    |
104 | pub trait ResultVoidErrExt<E>: Sized {
    |                                ^^^^^ not found in this scope

error[E0412]: cannot find type `Result` in this scope
   --> /home/w1png/.cargo/registry/src/github.com-1ecc6299db9ec823/void-1.0.2/src/lib.rs:109:33
    |
109 | impl<E> ResultVoidErrExt<E> for Result<Void, E> {
    |                                 ^^^^^^ not found in this scope

error[E0531]: cannot find tuple struct or tuple variant `Ok` in this scope
   --> /home/w1png/.cargo/registry/src/github.com-1ecc6299db9ec823/void-1.0.2/src/lib.rs:116:13
    |
116 |             Ok(v) => unreachable(v),
    |             ^^ not found in this scope

error[E0531]: cannot find tuple struct or tuple variant `Err` in this scope
   --> /home/w1png/.cargo/registry/src/github.com-1ecc6299db9ec823/void-1.0.2/src/lib.rs:117:13
    |
117 |             Err(e) => e
    |             ^^^ not found in this scope

For more information about this error, try `rustc --explain E0463`.
Some errors have detailed explanations: E0405, E0463.
For more information about an error, try `rustc --explain E0405`.
error: could not compile `bare-metal` due to 6 previous errors
warning: build failed, waiting for other jobs to finish...
error: could not compile `cfg-if` due to 2 previous errors
Some errors have detailed explanations: E0405, E0412, E0463, E0531.
error: requires `receiver` lang_item

Some errors have detailed explanations: E0412, E0463.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `void` due to 14 previous errors
error: could not compile `vcell` due to 4 previous errors
error: could not compile `ufmt-write` due to 6 previous errors
error: could not compile `nb` due to 7 previous errors
error: requires `sized` lang_item

error: could not compile `cfg-if` due to 2 previous errors
error: could not compile `panic-halt` due to 3 previous errors

I tried running rustup target add avr-atmega328p but it "does not contain component"

from avr-hal.

Rahix avatar Rahix commented on September 6, 2024

What project are you building and where from? You need to use build-std to build libcore and friends alongside your code. This is usually achieved by some settings in .cargo/config.toml:

[build]
target = "../../avr-specs/avr-atmega328p.json"
[target.'cfg(target_arch = "avr")']
runner = "ravedude uno -cb 57600"
[unstable]
build-std = ["core"]

from avr-hal.

w1png avatar w1png commented on September 6, 2024

I am trying to run cargo run --bin uno-blink -- -P /dev/ttyUSB0 in arduino uno examples.
I also tried running the template repo.

from avr-hal.

Rahix avatar Rahix commented on September 6, 2024

Hm, and it is not picking up the cargo config? Can you try running this please:

cargo build -Zbuild-std=core --bin uno-blink

from avr-hal.

w1png avatar w1png commented on September 6, 2024

cargo build -Zbuild-std=core --bin uno-blink output that I need to be running nightly version


After I tried every method to use nightly build using rustup nothing worked.
Then I checked the use flags again and it turned out that I needed to enable:

>=dev-lang/rust-1.66.0:stable/1.66::gentoo llvm_targets_AVR rust-src nightly

Everything works now. Thanks for your help :)

from avr-hal.

w1png avatar w1png commented on September 6, 2024

Also a quick recap for everyone who found this issue:

  • Emerge rust with the following use flags:
llvm_targets_AVR llvm_targets_ARM rust-src nightly
  • Init rustup:
rustup-init-gentoo -s
  • Install the avr/arduino toolchain (wiki link)

from avr-hal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.