libvips/php-vips

Fatal error: Uncaught FFI\Exception: Failed resolving C function 'printf' on Windows

effectzer0 opened this issue · 3 comments

Hello! I'm using Windows 10 21H1 (19043.1889), PHP 8.1 and vips 8.14.1 and unfortunately I can't use your library because of the following error:

Fatal error: Uncaught FFI\Exception: Failed resolving C function 'printf' in C:\Users\admin\test_vips_win\vendor\jcupitt\vips\src\FFI.php:208
Stack trace:
#0 C:\Users\admin\test_vips_win\vendor\jcupitt\vips\src\FFI.php(208): FFI::cdef('    int printf(...')
#1 C:\Users\admin\test_vips_win\vendor\jcupitt\vips\src\FFI.php(116): Jcupitt\Vips\FFI::init()
#2 C:\Users\admin\test_vips_win\vendor\jcupitt\vips\src\VipsOperation.php(80): Jcupitt\Vips\FFI::vips()
#3 C:\Users\admin\test_vips_win\vendor\jcupitt\vips\src\VipsOperation.php(225): Jcupitt\Vips\VipsOperation::newFromName('thumbnail')
#4 C:\Users\admin\test_vips_win\vendor\jcupitt\vips\src\Image.php(1290): Jcupitt\Vips\VipsOperation::callBase('thumbnail', NULL, Array)
#5 C:\Users\admin\test_vips_win\test.php(5): Jcupitt\Vips\Image::__callStatic('thumbnail', Array)
#6 {main}
  thrown in C:\Users\admin\test_vips_win\vendor\jcupitt\vips\src\FFI.php on line 208

The binary itself is located at C:\vips\bin and this directory is specified in PATH and PHP has access to the vips binaries:

PS C:\Users\admin\test_vips_win> php -r "passthru('vips -v');"
vips-8.14.1

FFI is also enabled:

PS C:\Users\admin\test_vips_win> php -r "echo (int) ini_get('ffi.enable');"
1

I have already seen a previous issue on this topic and I even received an email when you closed it as fixed however in my case unfortunately nothing has changed. Am I doing something wrong? Please help me

Hello @swaro32, I guess you are using an older version of php-vips, the printf test was removed a while ago.

That's the first thing I thought of. The version is 2.1.1, the newest according to packagist. Maybe it has an older version than the master github branch?