tarcieri / micromath

Embedded Rust arithmetic, 2D/3D vector, and statistics library
Apache License 2.0
401 stars 21 forks source link

rust-lld: error: undefined symbol: fmodf #95

Open gshep opened 3 years ago

gshep commented 3 years ago

Hello! Tried to build for UEFI and got the following error:

$ cargo +nightly build -Z build-std=std,panic_abort --target x86_64-unknown-uefi
// ...
error: linking with `rust-lld` failed: exit status: 1
  |
  = note: rust-lld: error: undefined symbol: fmodf
          >>> referenced by /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/micromath-2.0.0/src/float.rs:489
          >>>               libmicromath-70d91a162d5a686d.rlib(micromath-70d91a162d5a686d.micromath.3zoex4n7-cgu.12.rcgu.o):(_$LT$micromath..float..F32$u20$as$u20$core..ops..arith..Rem$GT$::rem::h2c54b78270aa0a20)

error: aborting due to previous error; 7 warnings emitted

error: could not compile `uefi-app1`

To learn more, run the command again with --verbose.

I hacked the sources, removed Rem/RemAssign and built my sample but would like to wonder if this ok in common. Thanks in advance!

tarcieri commented 3 years ago

This looks like a missing intrinsic for UEFI targets.

I'd suggest opening an issue about it upstream requesting for it to be added, similar to this one:

https://github.com/rust-lang/compiler-builtins/issues/354

Short-term we can gate Rem/RemAssign on #[cfg(not(...))] UEFI targets, however I'd need your help determining what the ... looks like and validating that it compiles correctly.

Can you tell me the "target triple" for UEFI that you're using? x86_64-unknown-uefi perhaps?

gshep commented 3 years ago

Ok, I post request in upstream.

Yes, you're correct - it is x86_64-unknown-uefi.

tarcieri commented 3 years ago

Where is the upstream issue? We can link it in some comments to eventually remove the gating for the intrinsic.

TDHolmes commented 2 years ago

Looks like it's all merged into compiler builtins