c2rust icon indicating copy to clipboard operation
c2rust copied to clipboard

Missing `extern "C"` block in newlib

Open TheDan64 opened this issue 6 years ago • 0 comments

With the default configuration, newlib will be missing four math functions' extern C "declarations" in rust:

error[E0425]: cannot find function `fabsl` in this scope
  --> src/cephes_subrl.rs:39:24
   |
39 |     if f128::f128::new(fabsl(x)) <= f128::f128::new(0.5) {
   |                        ^^^^^ not found in this scope

error[E0425]: cannot find function `coshl` in this scope
  --> src/cephes_subrl.rs:40:30
   |
40 |         *c = f128::f128::new(coshl(x));
   |                              ^^^^^ not found in this scope

error[E0425]: cannot find function `sinhl` in this scope
  --> src/cephes_subrl.rs:41:30
   |
41 |         *s = f128::f128::new(sinhl(x))
   |                              ^^^^^ not found in this scope

error[E0425]: cannot find function `expl` in this scope
  --> src/cephes_subrl.rs:43:29
   |
43 |         e = f128::f128::new(expl(x));
   |                             ^^^^ not found in this scope

This can be worked around with the --disable-newlib-fno-builtin flag configuration. It seems to be due to including libc/include/math.h which overrides the std math.h (which does work fine)

TheDan64 avatar Jun 27 '19 18:06 TheDan64