micromath icon indicating copy to clipboard operation
micromath copied to clipboard

rust-lld: error: undefined symbol: fmodf

Open gshep opened this issue 3 years ago • 4 comments

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!

gshep avatar Sep 17 '21 18:09 gshep

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?

tarcieri avatar Sep 17 '21 18:09 tarcieri

Ok, I post request in upstream.

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

gshep avatar Sep 20 '21 07:09 gshep

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

tarcieri avatar Sep 20 '21 13:09 tarcieri

Looks like it's all merged into compiler builtins

TDHolmes avatar Dec 17 '21 23:12 TDHolmes