Coder Social home page Coder Social logo

Comments (9)

calebarapp avatar calebarapp commented on September 6, 2024 2

I had this issue as well. I resolved it by updating the rust-toolchain.toml file to target v1.79.0-nightly like so:

[toolchain]
channel = "nightly-2024-04-11"
components = [ "rust-src" ]
profile = "minimal"

from avr-hal.

HaroPo avatar HaroPo commented on September 6, 2024 1

Adding the suggested 'help' lines:

#![feature(proc_macro_byte_character)]
#![feature(proc_macro_c_str_literals)]

to /home/hp/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.80/src/lib.rs, allowed to progress a little bit more, But still ended with errors:

~/Rust/projects/rust-arduino-uno-blink$  cargo build  -Z  build-std=core
   Compiling proc-macro2 v1.0.80
   Compiling quote v1.0.36
   Compiling syn v1.0.109
   Compiling avr-device-macros v0.5.4
   Compiling ufmt-macros v0.3.0
   Compiling avr-device v0.5.4
   Compiling ufmt v0.2.0
   Compiling avr-hal-generic v0.1.0 (https://github.com/rahix/avr-hal?rev=21342dcace7184f01fdc4e9703b01197bd4b4b4f#21342dca)
   Compiling atmega-hal v0.1.0 (https://github.com/rahix/avr-hal?rev=21342dcace7184f01fdc4e9703b01197bd4b4b4f#21342dca)
   Compiling arduino-hal v0.1.0 (https://github.com/rahix/avr-hal?rev=21342dcace7184f01fdc4e9703b01197bd4b4b4f#21342dca)
   Compiling rust-arduino-uno-blink v0.1.0 (/home/hp/Rust/projects/rust-arduino-uno-blink)
error[E0635]: unknown feature `proc_macro_byte_character`
 --> src/main.rs:4:12
  |
4 | #![feature(proc_macro_byte_character)]
  |            ^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0635]: unknown feature `proc_macro_c_str_literals`
 --> src/main.rs:5:12
  |
5 | #![feature(proc_macro_c_str_literals)]
  |            ^^^^^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0635`.
error: could not compile `rust-arduino-uno-blink` (bin "rust-arduino-uno-blink") due to 2 previous errors

~/Rust/projects/rust-arduino-uno-blink$  
~/Rust/projects/rust-arduino-uno-blink$  rustc --explain E0635

The #![feature] attribute specified an unknown feature.

Erroneous code example:

#![feature(nonexistent_rust_feature)] // error: unknown feature
(END)

~/Rust/projects/rust-arduino-uno-blink$  cargo build  -Z  build-std=core
   Compiling rust-arduino-uno-blink v0.1.0 (/home/hp/Rust/projects/rust-arduino-uno-blink)
WARN rustc_codegen_ssa::back::link Linker does not support -no-pie command line option. Retrying without.
error: linking with `avr-gcc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/home/hp/.rustup/toolchains/nightly-2024-03-22-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/hp/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin" VSLANG="1033" "avr-gcc" "-mmcu=atmega328p" "/tmp/rustcncTwfu/symbols.o" "/home/hp/Rust/projects/rust-arduino-uno-blink/target/avr-atmega328p/debug/deps/rust_arduino_uno_blink-a3946fdbd2fef60f.arduino_hal-1813dc6a7e8d8849.arduino_hal.e3a5162abf07a993-cgu.0.rcgu.o.rcgu.o" "-Wl,--as-needed" "-L" "/home/hp/Rust/projects/rust-arduino-uno-blink/target/avr-atmega328p/debug/deps" "-L" "/home/hp/Rust/projects/rust-arduino-uno-blink/target/debug/deps" "-L" "/home/hp/.rustup/toolchains/nightly-2024-03-22-x86_64-unknown-linux-gnu/lib/rustlib/avr-atmega328p/lib" "-Wl,-Bstatic" "/home/hp/Rust/projects/rust-arduino-uno-blink/target/avr-atmega328p/debug/deps/libcompiler_builtins-6d9348a04ce51620.rlib" "-Wl,-Bdynamic" "-lgcc" "-Wl,-z,noexecstack" "-L" "/home/hp/.rustup/toolchains/nightly-2024-03-22-x86_64-unknown-linux-gnu/lib/rustlib/avr-atmega328p/lib" "-o" "/home/hp/Rust/projects/rust-arduino-uno-blink/target/avr-atmega328p/debug/deps/rust_arduino_uno_blink-a3946fdbd2fef60f.elf" "-Wl,--gc-sections"
  = note: /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: cannot find crtatmega328p.o: No such file or directory
          /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: cannot find -lm
          /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: cannot find -lc
          /usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: cannot find -latmega328p
          collect2: error: ld returned 1 exit status
          

error: could not compile `rust-arduino-uno-blink` (bin "rust-arduino-uno-blink") due to 1 previous error

~/Rust/projects/rust-arduino-uno-blink$  

from avr-hal.

HaroPo avatar HaroPo commented on September 6, 2024 1

#535 (comment)

I had this issue as well. I resolved it by updating the rust-toolchain.toml file to target v1.79.0-nightly like so:

[toolchain]
channel = "nightly-2024-04-11"
components = [ "rust-src" ]
profile = "minimal"

Thanks @calebarapp for the tip. ๐Ÿ‘

This seems to risk to be cancelled out if you run rustup update, isn't it ?

Maybe preferable to do rustup override set nightly-yyyy-mm-dd from the project / package directory like in the following example:

~/path/to/actual/project$  rustup toolchain list  ; # To later compare for changes...
~/path/to/actual/project$  rustup override set nightly-yyyy-mm-dd
~/path/to/actual/project$  rustup toolchain list

    stable-x86_64-unknown-linux-gnu (default)
    nightly-2021-01-07-x86_64-unknown-linux-gnu
    nightly-2024-03-22-x86_64-unknown-linux-gnu (override)
    nightly-x86_64-unknown-linux-gnu

~/path/to/actual/project$

where you replace yyyy-mm-dd by 2024-04-11 or whatever date you need.

Best regards,
HP_

from avr-hal.

Rahix avatar Rahix commented on September 6, 2024 1

There is a lot of chaotic information in this issue, not even sure where to start...

@HaroPo, it seems to me you have quite a few misunderstanding on how the entire thing is supposed to fit together. We can clear these things up, but first let me focus on the issue at hand.

At the core stands a regression caused by proc-macro2 which you unfortunately were one of the first to run into. There are two possible solutions:

  1. Upgrade to a later toolchain which we should probably try doing as soon as possible anyway.
  2. Pin proc-macro2 to an older version as to not have people's projects randomly breaking.

from avr-hal.

Rahix avatar Rahix commented on September 6, 2024 1

I've created a new issue #537 to track work on a solution. This will keep things a bit cleaner than trying to do it here.

@HaroPo: For your information, here are a few pointers to get you back on the right track:

~/Rust/projects$  cargo new
~/Rust/projects$  cd ./rust-arduino-blink/

Don't do this, use the avr-hal-template instead.

~/Rust/projects/rust-arduino-blink$  rustup override set nightly-2021-01-07

That compiler version is entirely too old. Stick to the one from the avr-hal-template which it defines here:

https://github.com/Rahix/avr-hal-template/blob/bb141bd00f6b9687e986db8aeb66a3f3f50cca12/rust-toolchain.toml#L2

You also should not set an override using rustup when a rust-toolchain.toml file is present. rustup will automatically use the version from that file instead of the current default toolchain.

~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.80/src/wrapper.rs

Don't ever edit files in .cargo/registry, this is never the right way forward. You will make things much worse this way.

I just re-ran RustUp Update

rustup update has no effect when you have pinned a specific nightly using either rust-toolchain.toml or a rustup override.

The latest compilation error seems to be solved after I installed another missing software piece: 'avr-libc'

Yes, you need avr-libc. Please check for all the other required dependencies in our README: https://github.com/Rahix/avr-hal?tab=readme-ov-file#quickstart

Now, having to figure out about the 'cargo embed' "Error No supported probe was found" issue.

No, no, no, why are you trying to use cargo embed? For Rust on AVR, you should use ravedude our runner tool for AVR boards. Again, this comes pre-configured in the avr-hal-template so all you need to do is cargo run and ravedude does the rest.

This seems to risk to be cancelled out if you run rustup update, isn't it ?

No. rustup update has no effect on this.

Maybe preferable to do rustup override set nightly-yyyy-mm-dd

Avoid rustup override. Instead, use a rust-toolchain.toml file which specifies what toolchain a project needs.

from avr-hal.

Rahix avatar Rahix commented on September 6, 2024 1

You can use the "discussions" in this project to ask user questions: https://github.com/Rahix/avr-hal/discussions

For general rust questions you can find help in the rust-lang forum: https://users.rust-lang.org/

And finally, there is an avr-rust matrix channel: https://matrix.to/#/#avr-rust_Lobby:gitter.im

from avr-hal.

HaroPo avatar HaroPo commented on September 6, 2024

I just re-ran RustUp Update, what didn't get listed in what I have done and nothing has changed since a 1~2 hours ago:

~/Rust/projects/rust-arduino-uno-blink$  rustup update

info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: checking for self-update

   stable-x86_64-unknown-linux-gnu unchanged - rustc 1.77.2 (25ef9e3d8 2024-04-09)
  nightly-x86_64-unknown-linux-gnu unchanged - rustc 1.79.0-nightly (0d8b3346a 2024-04-14)

info: cleaning up downloads & tmp directories

from avr-hal.

HaroPo avatar HaroPo commented on September 6, 2024

Hi,
The latest compilation error seems to be solved after I installed another missing software piece: 'avr-libc'

~/Rust/projects/rust-arduino-uno-blink$  sudo apt install -y  avr-libc
~/Rust/projects/rust-arduino-uno-blink$ 
~/Rust/projects/rust-arduino-uno-blink$  cargo build  -Z  build-std=core
   Compiling rust-arduino-uno-blink v0.1.0 (/home/hp/Rust/projects/rust-arduino-uno-blink)
WARN rustc_codegen_ssa::back::link Linker does not support -no-pie command line option. Retrying without.
    Finished `dev` profile [optimized + debuginfo] target(s) in 1.53s

~/Rust/projects/rust-arduino-uno-blink$

Now, having to figure out about the 'cargo embed' "Error No supported probe was found" issue.

I am wondering if what I just done... :

~/Rust/projects/rust-arduino-uno-blink$  cargo clean
     Removed 328 files, 192.7MiB total

~/Rust/projects/rust-arduino-uno-blink$  cargo embed
   Compiling compiler_builtins v0.1.108
   Compiling core v0.0.0 (/home/hp/.rustup/toolchains/nightly-2024-03-22-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
   Compiling proc-macro2 v1.0.80
   Compiling unicode-ident v1.0.12
   Compiling syn v1.0.109
   Compiling rustversion v1.0.15
   Compiling embedded-hal-bus v0.1.0
   Compiling paste v1.0.14
   Compiling avr-hal-generic v0.1.0 (https://github.com/rahix/avr-hal?rev=21342dcace7184f01fdc4e9703b01197bd4b4b4f#21342dca)
   Compiling quote v1.0.36
   Compiling ufmt-macros v0.3.0
   Compiling avr-device-macros v0.5.4
   Compiling rustc-std-workspace-core v1.99.0 (/home/hp/.rustup/toolchains/nightly-2024-03-22-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
   Compiling nb v1.1.0
   Compiling void v1.0.2
   Compiling ufmt-write v0.1.0
   Compiling embedded-hal v1.0.0
   Compiling cfg-if v1.0.0
   Compiling critical-section v1.1.2
   Compiling bare-metal v1.0.0
   Compiling vcell v0.1.3
   Compiling embedded-storage v0.2.0
   Compiling unwrap-infallible v0.1.5
   Compiling cfg-if v0.1.10
   Compiling panic-halt v0.2.0
   Compiling nb v0.1.3
   Compiling ufmt v0.2.0
   Compiling avr-device v0.5.4
   Compiling embedded-hal v0.2.7
   Compiling atmega-hal v0.1.0 (https://github.com/rahix/avr-hal?rev=21342dcace7184f01fdc4e9703b01197bd4b4b4f#21342dca)
   Compiling arduino-hal v0.1.0 (https://github.com/rahix/avr-hal?rev=21342dcace7184f01fdc4e9703b01197bd4b4b4f#21342dca)
   Compiling rust-arduino-uno-blink v0.1.0 (/home/hp/Rust/projects/rust-arduino-uno-blink)
WARN rustc_codegen_ssa::back::link Linker does not support -no-pie command line option. Retrying without.
    Finished `dev` profile [optimized + debuginfo] target(s) in 1m 43s
      Config default
      Target /home/hp/Rust/projects/rust-arduino-uno-blink/target/avr-atmega328p/debug/rust-arduino-uno-blink.elf
       Error No supported probe was found

~/Rust/projects/rust-arduino-uno-blink$

is enough (?) to ensure that everything else attempted before "Flashing" the device is in good order from now on, Or if I have to try to set up everything from scratch in a VM and compare the results... ? ๐Ÿค”

Thanks for reading thus far ! ๐Ÿ˜ƒ

Best regards,
HP_

from avr-hal.

HaroPo avatar HaroPo commented on September 6, 2024

@Rahix
Thank you very much for your detailed replies ! ๐Ÿ˜ƒ

My apologies for the late reply (I've got private issues keeping me very busy until now) and I also apologies for the mess here, as all I have done (wrongly) before, comes from starting with whatever "HowTos" from Google Search results until I eventually end on your project.

I would like to make a better (or up to date) "How To" for other beginners as soon as I can free enough disk space on my PC to run a VM and redo all the Rust Language setup from scratch for the purpose, because I just successfully followed the provided instructions from the QuickStart section of your README file:

~/Rust/projects$ cargo install cargo-generate
~/Rust/projects$ cargo generate --git https://github.com/Rahix/avr-hal-template.git
~/Rust/projects$ cd  ./my-new-project-name/
~/Rust/projects/my-new-project-name$ cargo run

And it works fine straight away ! ๐Ÿ˜ƒ

@HaroPo
Takeaway = To check the README file(s) even if code seems like an "include" / "import" !

@Rahix
Thanks a lot, keep doing such the good job with this project ! ๐Ÿ˜ƒ ๐Ÿ‘ ๐Ÿ‘ ๐Ÿ‘

Best regards,
HP_

P.S.
Is there a project forum or another way for peers support / learning, in case of future need ?
I don't want to mess up things here again with my "newbies" questions...



@HaroPo and all other beginners like I am at the writing time of this:

Full details as a "snapshot" sample of what happens in the terminal window when things are OK:

~/Rust/projects$ cargo install cargo-generate
~/Rust/projects$ cargo generate --git https://github.com/Rahix/avr-hal-template.git
๐Ÿคท   Project Name: arduino-uno-blink-2024-05-02
๐Ÿ”ง   Destination: /home/hp/Rust/projects/arduino-uno-blink-2024-05-02 ...
๐Ÿ”ง   project-name: arduino-uno-blink-2024-05-02 ...
๐Ÿ”ง   Generating template ...
โœ” ๐Ÿคท   Which board do you use? ยท Arduino Uno
๐Ÿ”ง   Moving generated files into: `/home/hp/Rust/projects/arduino-uno-blink-2024-05-02`...
๐Ÿ”ง   Initializing a fresh Git repository
โœจ   Done! New project created /home/hp/Rust/projects/arduino-uno-blink-2024-05-02
~/Rust/projects$ 
~/Rust/projects$ cd /home/hp/Rust/projects/arduino-uno-blink-2024-05-02
~/Rust/projects/arduino-uno-blink-2024-05-02$ cargo run
    Updating git repository `https://github.com/rahix/avr-hal`
    Updating crates.io index
   Compiling compiler_builtins v0.1.108
   Compiling core v0.0.0 (/home/hp/.rustup/toolchains/nightly-2024-03-22-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
   Compiling proc-macro2 v1.0.79
   Compiling unicode-ident v1.0.12
   Compiling syn v1.0.109
   Compiling rustversion v1.0.15
   Compiling paste v1.0.14
   Compiling embedded-hal-bus v0.1.0
   Compiling avr-hal-generic v0.1.0 (https://github.com/rahix/avr-hal?rev=3e362624547462928a219c40f9ea8e3a64f21e5f#3e362624)
   Compiling quote v1.0.36
   Compiling ufmt-macros v0.3.0
   Compiling avr-device-macros v0.5.4
   Compiling rustc-std-workspace-core v1.99.0 (/home/hp/.rustup/toolchains/nightly-2024-03-22-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
   Compiling nb v1.1.0
   Compiling ufmt-write v0.1.0
   Compiling void v1.0.2
   Compiling critical-section v1.1.2
   Compiling vcell v0.1.3
   Compiling embedded-hal v1.0.0
   Compiling bare-metal v1.0.0
   Compiling cfg-if v1.0.0
   Compiling cfg-if v0.1.10
   Compiling unwrap-infallible v0.1.5
   Compiling embedded-storage v0.2.0
   Compiling panic-halt v0.2.0
   Compiling ufmt v0.2.0
   Compiling avr-device v0.5.4
   Compiling nb v0.1.3
   Compiling embedded-hal v0.2.7
   Compiling atmega-hal v0.1.0 (https://github.com/rahix/avr-hal?rev=3e362624547462928a219c40f9ea8e3a64f21e5f#3e362624)
   Compiling arduino-hal v0.1.0 (https://github.com/rahix/avr-hal?rev=3e362624547462928a219c40f9ea8e3a64f21e5f#3e362624)
   Compiling arduino-uno-blink-2024-05-02 v0.1.0 (/home/hp/Rust/projects/arduino-uno-blink-2024-05-02)
WARN rustc_codegen_ssa::back::link Linker does not support -no-pie command line option. Retrying without.
    Finished `dev` profile [optimized + debuginfo] target(s) in 26.78s
     Running `ravedude uno -cb 57600 target/avr-atmega328p/debug/arduino-uno-blink-2024-05-02.elf`
       Board Arduino Uno
 Programming target/avr-atmega328p/debug/arduino-uno-blink-2024-05-02.elf => /dev/ttyACM0

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: erasing chip
avrdude: reading input file "target/avr-atmega328p/debug/arduino-uno-blink-2024-05-02.elf"
avrdude: writing flash (262 bytes):

Writing | ################################################## | 100% 0.06s

avrdude: 262 bytes of flash written
avrdude: verifying flash memory against target/avr-atmega328p/debug/arduino-uno-blink-2024-05-02.elf:
avrdude: load data flash data from input file target/avr-atmega328p/debug/arduino-uno-blink-2024-05-02.elf:
avrdude: input file target/avr-atmega328p/debug/arduino-uno-blink-2024-05-02.elf contains 262 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.05s

avrdude: verifying ...
avrdude: 262 bytes of flash verified

avrdude: safemode: Fuses OK (E:00, H:00, L:00)

avrdude done.  Thank you.

  Programmed target/avr-atmega328p/debug/arduino-uno-blink-2024-05-02.elf
     Console /dev/ttyACM0 at 57600 baud
             CTRL+C to exit.

^C
Exiting.
~/Rust/projects$

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.