Open diyism opened 6 years ago
I'm on vacation and will able to check this only on next week. I tested ext/ffi only as a shared extension (built separately from php with phpize; configure, make install).
do you use x86(_64) Linux?
@diyism may be you have different libffi versions installed in /usr and /usr/local (the size of your /usr/local/include/ffi.h is very different from mine).
in my ubuntu 14.04, the libffi-dev version is 3.1~rc1+r3.0.13-12ubuntu0.2, the make error is: ‘FFI_FASTCALL’ undeclared
so i tried building it again in my ubuntu 18.04:
$sudo apt-get install libffi6 libffi-dev
$apt-cache policy libffi-dev
libffi-dev:
Installed: 3.2.1-4
Candidate: 3.2.1-4
$ln -s /usr/include/x86_64-linux-gnu/ffi.h /usr/include/ffi.h
$ln -s /usr/include/x86_64-linux-gnu/ffitarget.h /usr/include/ffitarget.h
$git clone -b PHP-7.3 --depth 1 https://github.com/php/php-src.git
$cd php-src/
$git clone -b master --depth 1 https://github.com/dstogov/php-ffi.git ext/php_ffi
$./buildconf --force
$./configure --prefix=/usr/local/php7 --disable-all --enable-cli --disable-cgi --disable-fpm --disable-phpdbg --enable-bcmath --enable-hash --enable-json --enable-mbstring --enable-mbregex --enable-mbregex-backtrack --enable-sockets --enable-pdo --with-sodium --with-password-argon2 --with-sqlite3 --with-pdo-sqlite --with-pcre-regex --with-zlib --with-openssl-dir --enable-openssl --with-ffi
$time make -j cat /proc/cpuinfo | grep processor | wc -l
......
/bin/bash /root/php-src/libtool --silent --preserve-dup-deps --mode=compile cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -Imain/ -I/root/php-src/main/ -DPHP_ATOM_INC -I/root/php-src/include -I/root/php-src/main -I/root/php-src -I/root/php-src/ext/date/lib -I/root/php-src/ext/mbstring/oniguruma -I/root/php-src/ext/mbstring/libmbfl -I/root/php-src/ext/mbstring/libmbfl/mbfl -I/root/php-src/ext/sqlite3/libsqlite -I/root/php-src/TSRM -I/root/php-src/Zend -g -O2 -fvisibility=hidden -DZEND_SIGNALS -c main/internal_functions_cli.c -o main/internal_functions_cli.lo
main/internal_functions_cli.c:57:2: error: ‘phpext_ffi_ptr’ undeclared here (not in a function)
phpext_ffi_ptr,
^
Makefile:1130: recipe for target 'main/internal_functions_cli.lo' failed
make: *** [main/internal_functions_cli.lo] Error 1
@diyism You have different problems on different systems.
1) ‘FFI_FASTCALL’ undeclared error may be because of old libffi (libffi-3.1-16.fc28 works fine for me) or non x86 host.
2) You shouldn't embed ext/ffi into PHP binary, but build it separately (as shared extension), using phpize, configure, make and then load through extension directive in php.ini
Hi. I got similar issue. openSUSE Leap 15.1
, libffi-devel 3.2.1.git259-lp151.19.1 x86_64
ext/ffi has been merged into main PHP source tree since PHP-7.4. This repository is not supported any more.
This issue is already fixed there. See https://github.com/php/php-src/tree/master/ext/ffi
==========reproduce===========
@dstogov any hint?