phper-framework/phper

Multiple missing `_Float64x` type errors in phper-sys

Closed this issue · 7 comments

I just tried compiling the hello example against PHP 8 and PHP 7.4 and got this 54 times when compiling php-sys. I noticed in the build.rs of php-sys _Float64x is declared as a blocked item but when not blocked, it translates to a u128 which isn't FFI safe.

error[E0412]: cannot find type `_Float64x` in this scope
    --> /home/ps/dev/phper/target/debug/build/phper-sys-89df922599ad3f64/out/php_bindings.rs:9716:60
     |
3039 | pub type _Float64 = f64;
     | ------------------------ similarly named type alias `_Float64` defined here
...
9716 |     pub fn f64fmaf64x(__x: _Float64x, __y: _Float64x, __z: _Float64x) -> _Float64;
     |                                                            ^^^^^^^^^ help: a type alias with a similar name exists: `_Float64`

I've tried this with phper 0.6.0 and 0.5.1.

jmjoy commented

Please try to add .blocklist_function("f64fmaf64x") in these lines.

.blocklist_function("__acosf64x")

Still getting the same issue. I think you'd have to add functions like these to the blocklist for this to work as you're expecting:

f64sqrtf64x
f32xsqrtf64x
f32xfmaf64x
fminimum_mag_numf64x
__fmaximum_mag_numf64x
__fminimum_mag_numf64x
__fminimum_magf64x
__fmaximum_magf64x

These are the functions associated with the _Float64x type.

jmjoy commented

Would you create a PR to block these functions?

It compiles but I question whether this is going to affect functionality available to the extension. Not super familiar with PHP FFI but blocklisting functionality and types doesn't really feel like a good answer to this problem.

jmjoy commented

It compiles but I question whether this is going to affect functionality available to the extension. Not super familiar with PHP FFI but blocklisting functionality and types doesn't really feel like a good answer to this problem.

In fact, it doesn't matter, because these functions are from libc, and phper doesn't need to use them.

jmjoy commented

With this PR #63 merged, is your issue solved?

jmjoy commented

Fixed by #63