Skip to content

Installing required third party tools from source #17

New issue

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

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

Already on GitHub? # to your account

Closed
jonahbron opened this issue Jul 26, 2020 · 3 comments
Closed

Installing required third party tools from source #17

jonahbron opened this issue Jul 26, 2020 · 3 comments

Comments

@jonahbron
Copy link
Contributor

This section in the book works great in most cases, but I'm on Clear Linux and have neither of those package managers available.

https://book.avr-rust.com/002.1-installing-required-third-party-tools.html#21-installing-required-third-party-tools

Instructions on how to install manually would be nice. I downloaded the official AVR toolchain from Microchip:

https://www.microchip.com/mplab/avr-support/avr-and-arm-toolchains-c-compilers

But when I run cargo build, it seems that it's trying to use a flag not supported by the version of ld provided in the official AVR toolchain.

error: linking with `avr-gcc` failed: exit code: 1
  |
  = note: "avr-gcc" "-Os" "-mmcu=atmega328p" "-Wl,--eh-frame-hdr" "-L" "/home/jonah/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/avr-atmega328p/lib" "/run/media/jonah/data/Projects/smart-plug/target/avr-atmega328p/release/deps/smart_plug-12f5bd55c8f99728.smart_plug.davrc7f1-cgu.0.rcgu.o" "-o" "/run/media/jonah/data/Projects/smart-plug/target/avr-atmega328p/release/deps/smart_plug-12f5bd55c8f99728.elf" "-Wl,--gc-sections" "-L" "/run/media/jonah/data/Projects/smart-plug/target/avr-atmega328p/release/deps" "-L" "/run/media/jonah/data/Projects/smart-plug/target/release/deps" "-L" "/home/jonah/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/avr-atmega328p/lib" "-Wl,--start-group" "-Wl,--end-group" "-Wl,-Bstatic" "/run/media/jonah/data/Projects/smart-plug/target/avr-atmega328p/release/deps/libcompiler_builtins-3056cbb15200d16d.rlib" "-Wl,-Bdynamic" "-Wl,--gc-sections"
  = note: /home/jonah/Downloads/avr8-gnu-toolchain-3.6.2.1759-linux.any.x86_64/avr8-gnu-toolchain-linux_x86_64/bin/../lib/gcc/avr/5.4.0/../../../../avr/bin/ld: unrecognized option '--eh-frame-hdr'
          /home/jonah/Downloads/avr8-gnu-toolchain-3.6.2.1759-linux.any.x86_64/avr8-gnu-toolchain-linux_x86_64/bin/../lib/gcc/avr/5.4.0/../../../../avr/bin/ld: use the --help option for usage information
          collect2: error: ld returned 1 exit status

Are there some additional instructions we could add, like how to remove that flag?

@dylanmckay
Copy link
Member

In https://github.com/rust-lang/rust/pull/74631/files Rust got support for disabling --eh-frame-hdr flag via the "eh-frame-header": false target specification JSON option.

The blink example has this so that --eh-frame-hdr is not passed to the linker. My avr-gcc linker (Arch Linux) doesn't support the --eh-frame-hdr flag either (even though it is a very recent version of binutils).
Here is the example in blink.

Good suggestion on adding distro-independent avr-gcc installation instructions. Raised #18.

This should be fixed by #10 when instructions for getting/creating a target specification JSON file are written.

@jonahbron
Copy link
Contributor Author

Thanks @dylanmckay . Yeah updating yesterday evening fixed it, and it turned out my json file was also setting that flag. Fixing that fixed the problem. I'll open a PR for manual installation instructions.

@jonahbron
Copy link
Contributor Author

Closing since you opened another ticket for the task.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants