tl8roy / ufmt_float

2 stars 2 forks source link

error: linking with `avr-gcc` failed #4

Open goiw111 opened 1 year ago

goiw111 commented 1 year ago

can you help me to find what is the issue

[CODE]

let val= (5.0 / 1023.0) * i as f32; let out = uFmt_f32::Zero(val); uwriteln!(&mut serial, "A0 = {}V", out)

[ERROR]

Compiling test v0.1.0 (/home/sohayl/Projects/arduino_rust/test) error: linking withavr-gccfailed: exit status: 1 | = note: LC_ALL="C" PATH="/home/sohayl/.rustup/toolchains/nightly-2023-08-08-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/sohayl/.cargo/bin:/home/sohayl/.nvm/versions/node/v18.18.0/bin:/home/sohayl/.local/bin:/home/sohayl/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin" VSLANG="1033" "avr-gcc" "-mmcu=atmega328p" "/tmp/rustcDlJMLD/symbols.o" "/home/sohayl/Projects/arduino_rust/test/target/avr-atmega328p/debug/deps/example_1-90b57356f9eb72e2.ufmt_float-cc9c3e6b4f384f9b.ufmt_float.a9692a864ac7e113-cgu.0.rcgu.o.rcgu.o" "-Wl,--as-needed" "-L" "/home/sohayl/Projects/arduino_rust/test/target/avr-atmega328p/debug/deps" "-L" "/home/sohayl/Projects/arduino_rust/test/target/debug/deps" "-L" "/home/sohayl/.rustup/toolchains/nightly-2023-08-08-x86_64-unknown-linux-gnu/lib/rustlib/avr-atmega328p/lib" "-Wl,-Bstatic" "/home/sohayl/Projects/arduino_rust/test/target/avr-atmega328p/debug/deps/libcompiler_builtins-f6499a221392faf1.rlib" "-Wl,-Bdynamic" "-lgcc" "-Wl,-z,noexecstack" "-L" "/home/sohayl/.rustup/toolchains/nightly-2023-08-08-x86_64-unknown-linux-gnu/lib/rustlib/avr-atmega328p/lib" "-o" "/home/sohayl/Projects/arduino_rust/test/target/avr-atmega328p/debug/deps/example_1-90b57356f9eb72e2.elf" "-Wl,--gc-sections" "-no-pie" = note: /usr/lib/gcc/avr/13.2.0/../../../../avr/bin/ld: /home/sohayl/Projects/arduino_rust/test/target/avr-atmega328p/debug/deps/libcompiler_builtins-f6499a221392faf1.rlib(compiler_builtins-f6499a221392faf1.compiler_builtins.4319175d524586f5-cgu.1.rcgu.o): in function_ZN17compiler_builtins5float4conv12int_to_float15u32_to_f32_bits17h3eb3f174af2218eeE': /home/sohayl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/compiler_builtins-0.1.98/src/float/conv.rs:15:(.text._ZN17compiler_builtins5float4conv12int_to_float15u32_to_f32_bits17h3eb3f174af2218eeE+0x1d8): undefined reference to _ZN4core9panicking5panic17h0faeb0977d538750E' /usr/lib/gcc/avr/13.2.0/../../../../avr/bin/ld: /home/sohayl/Projects/arduino_rust/test/target/avr-atmega328p/debug/deps/libcompiler_builtins-f6499a221392faf1.rlib(compiler_builtins-f6499a221392faf1.compiler_builtins.4319175d524586f5-cgu.1.rcgu.o): in function_ZN17compiler_builtins5float3mul3mul17h999fa9acfedbde58E': /home/sohayl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/compiler_builtins-0.1.98/src/float/mul.rs:(.text._ZN17compiler_builtins5float3mul8mulsf317h418f26ddc414d3e4E+0x5e8): undefined reference to _ZN4core9panicking5panic17h0faeb0977d538750E' /usr/lib/gcc/avr/13.2.0/../../../../avr/bin/ld: /home/sohayl/Projects/arduino_rust/test/target/avr-atmega328p/debug/deps/libcompiler_builtins-f6499a221392faf1.rlib(compiler_builtins-f6499a221392faf1.compiler_builtins.4319175d524586f5-cgu.1.rcgu.o): in functionZN55$LT$f32$u20$as$u20$compiler_builtins..float..Float$GT$9normalize17hf0353452146143eaE': /home/sohayl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/compiler_builtins-0.1.98/src/float/mod.rs:164:(.text.ZN55$LT$f32$u20$as$u20$compiler_builtins..float..Float$GT$9normalize17hf0353452146143eaE+0x15e): undefined reference to _ZN4core9panicking5panic17h0faeb0977d538750E' /usr/lib/gcc/avr/13.2.0/../../../../avr/bin/ld: /home/sohayl/Projects/arduino_rust/test/target/avr-atmega328p/debug/deps/libcompiler_builtins-f6499a221392faf1.rlib(compiler_builtins-f6499a221392faf1.compiler_builtins.4319175d524586f5-cgu.4.rcgu.o): in function_ZN17compiler_builtins5float4conv9__fixsfsi17h7493de2ccc691cbaE': /home/sohayl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/compiler_builtins-0.1.98/src/float/conv.rs:255:(.text._ZN17compiler_builtins5float4conv9fixsfsi17h7493de2ccc691cbaE+0xe4): undefined reference to `_ZN4core9panicking5panic17h0faeb0977d538750E' collect2: error: ld returned 1 exit status

= note: some extern functions couldn't be found; some native libraries may need to be installed or have their path specified = note: use the -l flag to specify native libraries to link = note: use the cargo:rustc-link-lib directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)

error: could not compile test (bin "example_1") due to previous error `

config

`cat .cargo/config.toml [build] target = "avr-specs/avr-atmega328p.json"

[target.'cfg(target_arch = "avr")'] runner = "ravedude uno -cb 57600"

[unstable] build-std = ["core"] `

abishekatp commented 10 months ago

Hi, This issue I have solved by adding following line in Cargo.toml.

[profile.dev.package.compiler_builtins]
overflow-checks = false

ref: https://github.com/Rahix/avr-hal/discussions/307