mlocati / docker-php-extension-installer

Easily install PHP extensions in Docker containers
MIT License
4.24k stars 384 forks source link

Unable to install grpc extension #937

Closed alexjeen closed 2 months ago

alexjeen commented 3 months ago

Version of install-php-extensions

v.2.2.17

Error description

I am trying to install the grpc module on version PHP 7.1.33 within Gitlab CI (AMD64 runner). However it is failing Strangely enough on X86 builds and ARM builds, it works fine.

You can try it with a Gitlab runner that is free, for instance saas-linux-small-amd64.

And it is able to install properly as well judging from this log, but when it tries to verify if the installation has been done correctly it fails (my g++ skills are a bit rusty so I can not read this, but maybe a pro can ;)):

#22 1292.2 Build process completed successfully
#22 1292.2 Installing '/usr/local/lib/php/extensions/no-debug-non-zts-20160303/grpc.so'
#22 1292.2 install ok: channel://pecl.php.net/grpc-1.65.0
#22 1292.2 configuration option "php_ini" is not set to php.ini location
#22 1292.2 You should add "extension=grpc.so" to php.ini
#22 1292.2 Removing symbols from /usr/local/lib/php/extensions/no-debug-non-zts-20160303/grpc.so... done (364032744 bytes saved).
#22 1292.2 Check if the grpc module can be loaded... 
#22 ERROR: process "/bin/sh -c install-php-extensions grpc" did not complete successfully: exit code: 1
------
 > [stage-0 10/33] RUN install-php-extensions grpc:
1292.2 Check if the grpc module can be loaded... 
1292.2 Check if the grpc module can be loaded... 
931.3  g++ -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -DGRPC_ARES=0 -DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK=1 -DGRPC_XDS_USER_AGENT_NAME_SUFFIX=\"PHP\" -DGRPC_XDS_USER_AGENT_VERSION_SUFFIX=\"1.65.0\" -I. -I/tmp/pear/temp/grpc -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuserKc9Tuu/grpc-1.65.0/include -I/tmp/pear/temp/pear-build-defaultuserKc9Tuu/grpc-1.65.0/main -I/tmp/pear/temp/grpc -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/tmp/pear/temp/grpc/include -I/tmp/pear/temp/grpc/src/core/ext/upb-gen -I/tmp/pear/temp/grpc/src/core/ext/upbdefs-gen -I/tmp/pear/temp/grpc/src/php/ext/grpc -I/tmp/pear/temp/grpc/third_party/abseil-cpp -I/tmp/pear/temp/grpc/third_party/address_sorting/include -I/tmp/pear/temp/grpc/third_party/boringssl-with-bazel/src/include -I/tmp/pear/temp/grpc/third_party/re2 -I/tmp/pear/temp/grpc/third_
931.3 party/upb -I/tmp/pear/temp/grpc/third_party/utf8_range -I/tmp/pear/temp/grpc/third_party/xxhash -DHAVE_CONFIG_H -std=c++14 -fno-exceptions -fno-rtti -g -O2 -c /tmp/pear/temp/grpc/src/core/tsi/alts/frame_protector/alts_frame_protector.cc  -fPIC -DPIC -o src/core/tsi/alts/frame_protector/.libs/alts_frame_protector.o
931.8 /bin/bash /tmp/pear/temp/pear-build-defaultuserKc9Tuu/grpc-1.65.0/libtool --mode=compile g++ -fvisibility=hidden     -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN     -D_HAS_EXCEPTIONS=0 -DNOMINMAX -DGRPC_ARES=0     -DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK=1     -DGRPC_XDS_USER_AGENT_NAME_SUFFIX='"PHP"'     -DGRPC_XDS_USER_AGENT_VERSION_SUFFIX='"1.65.0"' -I. -I/tmp/pear/temp/grpc -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuserKc9Tuu/grpc-1.65.0/include -I/tmp/pear/temp/pear-build-defaultuserKc9Tuu/grpc-1.65.0/main -I/tmp/pear/temp/grpc -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/tmp/pear/temp/grpc/include -I/tmp/pear/temp/grpc/src/core/ext/upb-gen -I/tmp/pear/temp/grpc/src/core/ext/upbdefs-gen -I/tmp/pear/temp/grpc/src/php/ext/grpc -I/tmp/pear/temp/grpc/third_party/abseil-cpp -I/tmp/pear/temp/grpc/third_party/address_sorting/include -I/tmp/pear/temp/grpc/thi
931.8 rd_party/boringssl-with-bazel/src/include -I/tmp/pear/temp/grpc/third_party/re2 -I/tmp/pear/temp/grpc/third_party/upb -I/tmp/pear/temp/grpc/third_party/utf8_range -I/tmp/pear/temp/grpc/third_party/xxhash  -DHAVE_CONFIG_H  -std=c++14 -fno-exceptions -fno-rtti -g -O2   -c /tmp/pear/temp/grpc/src/core/tsi/alts/frame_protector/alts_record_protocol_crypter_common.cc -o src/core/tsi/alts/frame_protector/alts_record_protocol_crypter_common.lo
932.0  g++ -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -DGRPC_ARES=0 -DGRPC_POS
932.0 [output clipped, log limit 2MiB reached]
1292.1 Error loading the "grpc" extension:
1292.1 WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
1292.1 I0000 00:00:1720532687.160027  236978 config.cc:230] gRPC experiments enabled: call_status_override_on_cancellation, event_engine_dns, event_engine_listener, http2_stats_fix, monitoring_experiment, pick_first_new, trace_record_callops, work_serializer_clears_time_cache, work_serializer_dispatch
------
Dockerfile:26
--------------------
  24 |     
  25 |     # two layers for grpc as well
  26 | >>> RUN install-php-extensions grpc
  27 |     RUN install-php-extensions gd mysqli pdo_mysql zip memcache opcache sockets bcmath xdebug pcntl
  28 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c install-php-extensions grpc" did not complete successfully: exit code: 1

Docker image

php:7.1.33-apache

Minimal Dockerfile

FROM php:7.1.33-apache
RUN install-php-extensions grpc
mlocati commented 3 months ago

See https://github.com/grpc/grpc/issues/37178

For the time being, you can install an older version of grpc (for example: install-php-extensions grpc-1.64.1)

alexjeen commented 3 months ago

Thanks, works indeed.

mlocati commented 2 months ago

I'll keep this issue open until they solve https://github.com/grpc/grpc/issues/37178

mlocati commented 2 months ago

For the time being, you can install an older version of grpc (for example: install-php-extensions grpc-1.64.1)

PS: since version 2.2.19 by default the script installs version 1.64.1, so you don't need to specify it yourself.

Once https://github.com/grpc/grpc/issues/37178 will be closed, I'll update the script to remove that setting.