/usr/bin/avr-ld: unrecognized option '--eh-frame-hdr'
Closed this issue · 1 comments
vringar commented
When running cargo build -Z build-std=core --target avr-atmega328p.json --release
with
avr-gcc (GCC) 10.2.0
and rustc 1.46.0-nightly (346aec9b0 2020-07-11)
i get the error:
= note: /usr/bin/avr-ld: unrecognized option '--eh-frame-hdr'
I unfortunately don't know how to debug this any further so I'm just filing this issue.
The full command output
Running `rustc --crate-name blink --edition=2018 src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C opt-level=3 -Cembed-bitcode=no -C metadata=342e6bfc99a63f66 -C extra-filename=-342e6bfc99a63f66 --out-dir /home/stefan/projects/rust/blink/target/avr-atmega328p/release/deps --target /home/stefan/projects/rust/blink/avr-atmega328p.json -L dependency=/home/stefan/projects/rust/blink/target/avr-atmega328p/release/deps -L dependency=/home/stefan/projects/rust/blink/target/release/deps --extern 'noprelude:compiler_builtins=/home/stefan/projects/rust/blink/target/avr-atmega328p/release/deps/libcompiler_builtins-e9a85b3245518f86.rlib' --extern 'noprelude:core=/home/stefan/projects/rust/blink/target/avr-atmega328p/release/deps/libcore-68e26358f39e7781.rlib' --extern ruduino=/home/stefan/projects/rust/blink/target/avr-atmega328p/release/deps/libruduino-9899aa9e928bb47e.rlib -Z unstable-options`
error: linking with `avr-gcc` failed: exit code: 1
|
= note: "avr-gcc" "-mmcu=atmega328p" "-Wl,--eh-frame-hdr" "-L" "/home/stefan/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/avr-atmega328p/lib" "/home/stefan/projects/rust/blink/target/avr-atmega328p/release/deps/blink-342e6bfc99a63f66.blink.2s4qwe14-cgu.0.rcgu.o" "/home/stefan/projects/rust/blink/target/avr-atmega328p/release/deps/blink-342e6bfc99a63f66.blink.2s4qwe14-cgu.1.rcgu.o" "-o" "/home/stefan/projects/rust/blink/target/avr-atmega328p/release/deps/blink-342e6bfc99a63f66.elf" "-Wl,--gc-sections" "-no-pie" "-Wl,-O1" "-nodefaultlibs" "-L" "/home/stefan/projects/rust/blink/target/avr-atmega328p/release/deps" "-L" "/home/stefan/projects/rust/blink/target/release/deps" "-L" "/home/stefan/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/avr-atmega328p/lib" "-Wl,--start-group" "-Wl,-Bstatic" "/home/stefan/projects/rust/blink/target/avr-atmega328p/release/deps/libruduino-9899aa9e928bb47e.rlib" "/home/stefan/projects/rust/blink/target/avr-atmega328p/release/deps/librustc_std_workspace_core-6f91c9807e743908.rlib" "/home/stefan/projects/rust/blink/target/avr-atmega328p/release/deps/libcore-68e26358f39e7781.rlib" "-Wl,--end-group" "/home/stefan/projects/rust/blink/target/avr-atmega328p/release/deps/libcompiler_builtins-e9a85b3245518f86.rlib" "-Wl,-Bdynamic" "-lgcc"
= note: /usr/bin/avr-ld: unrecognized option '--eh-frame-hdr'
/usr/bin/avr-ld: use the --help option for usage information
collect2: error: ld returned 1 exit status
error: aborting due to previous error
error: could not compile `blink`.
Caused by:
process didn't exit successfully: `rustc --crate-name blink --edition=2018 src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C opt-level=3 -Cembed-bitcode=no -C metadata=342e6bfc99a63f66 -C extra-filename=-342e6bfc99a63f66 --out-dir /home/stefan/projects/rust/blink/target/avr-atmega328p/release/deps --target /home/stefan/projects/rust/blink/avr-atmega328p.json -L dependency=/home/stefan/projects/rust/blink/target/avr-atmega328p/release/deps -L dependency=/home/stefan/projects/rust/blink/target/release/deps --extern 'noprelude:compiler_builtins=/home/stefan/projects/rust/blink/target/avr-atmega328p/release/deps/libcompiler_builtins-e9a85b3245518f86.rlib' --extern 'noprelude:core=/home/stefan/projects/rust/blink/target/avr-atmega328p/release/deps/libcore-68e26358f39e7781.rlib' --extern ruduino=/home/stefan/projects/rust/blink/target/avr-atmega328p/release/deps/libruduino-9899aa9e928bb47e.rlib -Z unstable-options` (exit code: 1)
Rahix commented
For anyone else encountering this: The solution is to add "eh-frame-header": false
to the target-json file.