Как скомпилировать pcntl для PHP 7.4 и выше?

Я пытаюсь скомпилировать расширение pcntl для PHP 7.4 и PHP 8 с помощью следующих команд (из Mac):

wget "https://www.php.net/distributions/php-7.4.0.tar.gz"
tar xvf "php-7.4.0.tar.gz"
cd "php-7.4.0/ext/pcntl/"
phpize
./configure
make

Однако команда make выдает следующую ошибку для каждой версии PHP ›7.3:

      [-Werror,-Wimplicit-function-declaration]
                z_rusage = zend_try_array_init(z_rusage);
                           ^
/Users/jrquick/development/encounting/php-extension-library/php-7.4.10/ext/pcntl/pcntl.c:721:12: warning: incompatible integer to pointer conversion assigning to 'zval *'
      (aka 'struct _zval_struct *') from 'int' [-Wint-conversion]
                z_rusage = zend_try_array_init(z_rusage);
                         ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/jrquick/development/encounting/php-extension-library/php-7.4.10/ext/pcntl/pcntl.c:745:2: error: implicit declaration of function 'ZEND_TRY_ASSIGN_REF_LONG' is invalid in C99
      [-Werror,-Wimplicit-function-declaration]
        ZEND_TRY_ASSIGN_REF_LONG(z_status, status);
        ^
/Users/jrquick/development/encounting/php-extension-library/php-7.4.10/ext/pcntl/pcntl.c:770:14: error: implicit declaration of function 'zend_try_array_init' is invalid in C99
      [-Werror,-Wimplicit-function-declaration]
                z_rusage = zend_try_array_init(z_rusage);
                           ^
/Users/jrquick/development/encounting/php-extension-library/php-7.4.10/ext/pcntl/pcntl.c:770:12: warning: incompatible integer to pointer conversion assigning to 'zval *'
      (aka 'struct _zval_struct *') from 'int' [-Wint-conversion]
                z_rusage = zend_try_array_init(z_rusage);
                         ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/jrquick/development/encounting/php-extension-library/php-7.4.10/ext/pcntl/pcntl.c:795:2: error: implicit declaration of function 'ZEND_TRY_ASSIGN_REF_LONG' is invalid in C99
      [-Werror,-Wimplicit-function-declaration]
        ZEND_TRY_ASSIGN_REF_LONG(z_status, status);
        ^
/Users/jrquick/development/encounting/php-extension-library/php-7.4.10/ext/pcntl/pcntl.c:979:9: error: implicit declaration of function 'try_convert_to_string' is invalid in C99
      [-Werror,-Wimplicit-function-declaration]
                        if (!try_convert_to_string(element)) {
                             ^
/Users/jrquick/development/encounting/php-extension-library/php-7.4.10/ext/pcntl/pcntl.c:979:9: note: did you mean '_convert_to_string'?
/usr/local/Cellar/php/7.3.11/include/php/Zend/zend_operators.h:249:29: note: '_convert_to_string' declared here
ZEND_API void ZEND_FASTCALL _convert_to_string(zval *op);
                            ^
/Users/jrquick/development/encounting/php-extension-library/php-7.4.10/ext/pcntl/pcntl.c:1010:9: error: implicit declaration of function 'try_convert_to_string' is invalid in C99
      [-Werror,-Wimplicit-function-declaration]
                        if (!try_convert_to_string(element)) {
                             ^
/Users/jrquick/development/encounting/php-extension-library/php-7.4.10/ext/pcntl/pcntl.c:1197:17: error: implicit declaration of function 'zend_try_array_init' is invalid in C99
      [-Werror,-Wimplicit-function-declaration]
                user_oldset = zend_try_array_init(user_oldset);
                              ^
/Users/jrquick/development/encounting/php-extension-library/php-7.4.10/ext/pcntl/pcntl.c:1197:15: warning: incompatible integer to pointer conversion assigning to 'zval *'
      (aka 'struct _zval_struct *') from 'int' [-Wint-conversion]
                user_oldset = zend_try_array_init(user_oldset);
                            ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/jrquick/development/encounting/php-extension-library/php-7.4.10/ext/pcntl/pcntl.c:1295:18: error: implicit declaration of function 'zend_try_array_init' is invalid in C99
      [-Werror,-Wimplicit-function-declaration]
                user_siginfo = zend_try_array_init(user_siginfo);
                               ^
/Users/jrquick/development/encounting/php-extension-library/php-7.4.10/ext/pcntl/pcntl.c:1295:16: warning: incompatible integer to pointer conversion assigning to 'zval *'
      (aka 'struct _zval_struct *') from 'int' [-Wint-conversion]
                user_siginfo = zend_try_array_init(user_siginfo);

Как обойти эту ошибку или получить скомпилированную версию pcntl.so?

Этот же процесс работает для PHP 4 до PHP 7.3.


person Jeremy    schedule 08.03.2021    source источник
comment
Почему вы пометили это PHP-8? Почему это даже помечено как PHP, когда речь идет о компиляции кода C? В чем вообще твой вопрос? Разве вы не хотите сделать отчет об ошибке (думаю, на bugs.php.net будет правильное место)?   -  person Ulrich Eckhardt    schedule 09.03.2021
comment
Он помечен как PHP 7.4 и 8, потому что встречается и в 7.4, и в 8. Он помечен как PHP, потому что это проблема, с которой я столкнулся при компиляции PHP. Я проверю bugs.php.net для подобных проблем.   -  person Jeremy    schedule 09.03.2021


Ответы (1)


Загрузите последнюю версию MAMP (включая PHP 7.4.10 и PHP 8).

Затем изменил ./configure:

  • PHP 7.4.*: ./configure --with-php-config=/Applications/MAMP/bin/php/php7.4.12/bin/php-config
  • PHP 8.*: --with-php-config=/Applications/MAMP/bin/php/php8.0.0/bin/php-config

После этого моя команда make успешно запустилась и сгенерировала ожидаемый файл pcntl.so.

Полная команда:

wget "https://www.php.net/distributions/php-7.4.0.tar.gz"
tar xvf "php-7.4.0.tar.gz"
cd "php-7.4.0/ext/pcntl/"
phpize
./configure --with-php-config=/Applications/MAMP/bin/php/php7.4.12/bin/php-config
make
person Jeremy    schedule 10.03.2021