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
linking with avr-gcc
failed
#580
Comments
It looks like you're trying to link your project with a Rust library using |
hm... I'm following the template from Rahix/avr-hal and it works when importing other |
I think it could be unimplemented in the |
It compiles fine if I remove the |
Oh that's really surprising. The feature should only affect which functions are available, not how linking is performed. Could you try to compile both cases with verbose flag and compare what's different? |
made a mistake, the reason it was linking without here's the verbose output: Fresh core v0.0.0 (/.rustup/toolchains/nightly-2022-07-10-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
Fresh unicode-ident v1.0.6
Fresh cc v1.0.41
Fresh rustc-std-workspace-core v1.99.0 (/.rustup/toolchains/nightly-2022-07-10-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
Fresh compiler_builtins v0.1.73
Fresh proc-macro2 v1.0.51
Fresh alloc v0.0.0 (/.rustup/toolchains/nightly-2022-07-10-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc)
Fresh quote v1.0.23
Fresh rustversion v1.0.11
Fresh proc-macro-hack v0.5.20+deprecated
Fresh paste v1.0.11
Fresh syn v1.0.107
Fresh nb v1.0.0
Fresh void v1.0.2
Fresh ufmt-write v0.1.0
Fresh vcell v0.1.3
Fresh cfg-if v1.0.0
Fresh bare-metal v1.0.0
Fresh cfg-if v0.1.10
Fresh embedded-storage v0.2.0
Fresh secp256k1-sys v0.8.0
Fresh panic-halt v0.2.0
Fresh ufmt-macros v0.2.0
Fresh nb v0.1.3
Fresh avr-device-macros v0.5.0
Fresh secp256k1 v0.26.0
Fresh embedded-hal v0.2.7
Fresh ufmt v0.1.2
Fresh avr-device v0.5.0
Fresh avr-hal-generic v0.1.0 (https://github.com/rahix/avr-hal?rev=4c9c44c314eb061ee20556ef10d45dea36e75ee4#4c9c44c3)
Fresh atmega-hal v0.1.0 (https://github.com/rahix/avr-hal?rev=4c9c44c314eb061ee20556ef10d45dea36e75ee4#4c9c44c3)
Fresh arduino-hal v0.1.0 (https://github.com/rahix/avr-hal?rev=4c9c44c314eb061ee20556ef10d45dea36e75ee4#4c9c44c3)
Compiling arduino-lib v0.1.0 (/arduino-lib-rs)
Running `rustc --crate-name arduino_lib --edition=2021 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C opt-level=s -C panic=abort -C lto -C debuginfo=2 -C debug-assertions=on -C metadata=4fc5e0f08d0e8413 -C extra-filename=-4fc5e0f08d0e8413 --out-dir /arduino-lib-rs/target/avr-atmega328p/debug/deps --target /arduino-lib-rs/avr-atmega328p.json -C incremental=/arduino-lib-rs/target/avr-atmega328p/debug/incremental -L dependency=/arduino-lib-rs/target/avr-atmega328p/debug/deps -L dependency=/arduino-lib-rs/target/debug/deps --extern 'noprelude:alloc=/arduino-lib-rs/target/avr-atmega328p/debug/deps/liballoc-6657415c07dc6074.rlib' --extern arduino_hal=/arduino-lib-rs/target/avr-atmega328p/debug/deps/libarduino_hal-ab70d292f4898b57.rlib --extern 'noprelude:compiler_builtins=/arduino-lib-rs/target/avr-atmega328p/debug/deps/libcompiler_builtins-7aa2be695e3a21ba.rlib' --extern 'noprelude:core=/arduino-lib-rs/target/avr-atmega328p/debug/deps/libcore-5992387ffdde5367.rlib' --extern panic_halt=/arduino-lib-rs/target/avr-atmega328p/debug/deps/libpanic_halt-c807d160b6ac4a90.rlib --extern secp256k1=/arduino-lib-rs/target/avr-atmega328p/debug/deps/libsecp256k1-3da03d9a855cade0.rlib -Z unstable-options -L native=/arduino-lib-rs/target/avr-atmega328p/debug/build/secp256k1-sys-71731f20ca02ee1b/out`
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: "avr-gcc" "-mmcu=atmega328p" "-Wl,--as-needed" "/arduino-lib-rs/target/avr-atmega328p/debug/deps/arduino_lib-4fc5e0f08d0e8413.secp256k1-3da03d9a855cade0.secp256k1.96b2e4ee-cgu.0.rcgu.o.rcgu.o" "-Wl,--as-needed" "-L" "/arduino-lib-rs/target/avr-atmega328p/debug/deps" "-L" "/arduino-lib-rs/target/debug/deps" "-L" "/arduino-lib-rs/target/avr-atmega328p/debug/build/secp256k1-sys-71731f20ca02ee1b/out" "-L" "/.rustup/toolchains/nightly-2022-07-10-x86_64-unknown-linux-gnu/lib/rustlib/avr-atmega328p/lib" "-Wl,-Bstatic" "/tmp/rustcDNjnWV/libsecp256k1_sys-78f272f5c76a5ef9.rlib" "/arduino-lib-rs/target/avr-atmega328p/debug/deps/libcompiler_builtins-7aa2be695e3a21ba.rlib" "-Wl,-Bdynamic" "-lgcc" "-Wl,-znoexecstack" "-L" "/.rustup/toolchains/nightly-2022-07-10-x86_64-unknown-linux-gnu/lib/rustlib/avr-atmega328p/lib" "-o" "/arduino-lib-rs/target/avr-atmega328p/debug/deps/arduino_lib-4fc5e0f08d0e8413.elf" "-Wl,--gc-sections"
= note: /tmp/rustcDNjnWV/libsecp256k1_sys-78f272f5c76a5ef9.rlib: error adding symbols: File format not recognized
collect2: error: ld returned 1 exit status
error: could not compile `arduino-lib` due to previous error
Caused by:
process didn't exit successfully: `rustc --crate-name arduino_lib --edition=2021 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C opt-level=s -C panic=abort -C lto -C debuginfo=2 -C debug-assertions=on -C metadata=4fc5e0f08d0e8413 -C extra-filename=-4fc5e0f08d0e8413 --out-dir /arduino-lib-rs/target/avr-atmega328p/debug/deps --target /arduino-lib-rs/avr-atmega328p.json -C incremental=/arduino-lib-rs/target/avr-atmega328p/debug/incremental -L dependency=/arduino-lib-rs/target/avr-atmega328p/debug/deps -L dependency=/arduino-lib-rs/target/debug/deps --extern 'noprelude:alloc=/arduino-lib-rs/target/avr-atmega328p/debug/deps/liballoc-6657415c07dc6074.rlib' --extern arduino_hal=/arduino-lib-rs/target/avr-atmega328p/debug/deps/libarduino_hal-ab70d292f4898b57.rlib --extern 'noprelude:compiler_builtins=/arduino-lib-rs/target/avr-atmega328p/debug/deps/libcompiler_builtins-7aa2be695e3a21ba.rlib' --extern 'noprelude:core=/arduino-lib-rs/target/avr-atmega328p/debug/deps/libcore-5992387ffdde5367.rlib' --extern panic_halt=/arduino-lib-rs/target/avr-atmega328p/debug/deps/libpanic_halt-c807d160b6ac4a90.rlib --extern secp256k1=/arduino-lib-rs/target/avr-atmega328p/debug/deps/libsecp256k1-3da03d9a855cade0.rlib -Z unstable-options -L native=/arduino-lib-rs/target/avr-atmega328p/debug/build/secp256k1-sys-71731f20ca02ee1b/out` (exit status: 1) |
So it looks like I'm correct in guessing AVR is not supported by |
I don't see |
I mean the crate. |
if by crate you mean I want to know if it supports avr and if not why, what needs to be changed? |
By crate he means the I'm happy to leave this open because I think libsecp-on-AVR is pretty cool...but I think the fix is going to have to happen in the |
ah, I think I get it now. my
correct? this file has to be changed for |
Yep, exactly. And I don't know how/if we can change that file to support AVR; the If it worked for you, I'd be willing to accept an ad-hoc change that did something like |
sounds fair, will check if I can get it to work once I find some time. |
If you can, I think your time would be better spent on making a PR to the |
trying to compile this crate for
avr
target and after addingalloc
and implementing a dummy allocator, I'm getting:I tried
RUSTFLAGS="--cfg=rust_secp_no_symbol_renaming"
too, doesn't work.anyone knows why I'm getting this error? is it even possible to link this for
avr
without extra work/config?The text was updated successfully, but these errors were encountered: