docker-php-extension-installer icon indicating copy to clipboard operation
docker-php-extension-installer copied to clipboard

saxonc alpine arm64

Open benbrummer opened this issue 2 months ago • 5 comments

Version of install-php-extensions

2.9.13

Error description

Error when loading saconc on arm64

https://github.com/invoiceninja/dockerfiles/actions/runs/18868360018/job/53840620561#step:6:3993

 > [linux/arm64 phpbuild  6/12] RUN install-php-extensions     bcmath     exif     gd     gmp     intl     mysqli     opcache     pdo_mysql     saxon     zip     @composer     && rm /usr/local/bin/install-php-extensions:
1566.3    - add LIBDIR to the `LD_RUN_PATH' environment variable
1566.3      during linking
1566.3    - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
1566.3 
1566.3 See any operating system documentation about shared libraries for
1566.3 more information, such as the ld(1) and ld.so(8) manual pages.
1566.3 ----------------------------------------------------------------------
1566.6 Installing shared extensions:     /usr/local/lib/php/extensions/no-debug-non-zts-20220829/
Error loading the "saxon" extension:
1567.7 PHP Warning:  PHP Startup: Unable to load dynamic library 'saxon.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20220829/saxon.so (Error loading shared library ld-linux-aarch64.so.1: No such file or directory (needed by /usr/lib/libsaxonc-core-ee.so.12)), /usr/local/lib/php/extensions/no-debug-non-zts-20220829/saxon.so.so (Error loading shared library /usr/local/lib/php/extensions/no-debug-non-zts-20220829/saxon.so.so: No such file or directory)) in Unknown on line 0

amd64 build works fine

Docker image

php:8.2-fpm-alpine3.20

Minimal Dockerfile

FROM php:8.2-fpm-alpine3.20

COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/

RUN install-php-extensions saxon

https://github.com/benbrummer/dockertest/actions/runs/18871226440

benbrummer avatar Oct 28 '25 09:10 benbrummer

It is the same for php:8.4-alpine3.22. So arm64 + alpine seam to be broken in general. php:8.4-trixie works perfect for both platforms.

benbrummer avatar Oct 28 '25 10:10 benbrummer

Can you check if running

apk add gcompat

fixes the issue?

mlocati avatar Oct 28 '25 11:10 mlocati

With gcompat: Segmentation fault (core dumped)

#11 13.28 Installing shared extensions:     /usr/local/lib/php/extensions/no-debug-non-zts-20240924/
#11 13.31 Removing symbols from /usr/local/lib/php/extensions/no-debug-non-zts-20240924/saxon.so... done (100312 bytes saved).
#11 13.32 Check if the saxon module can be loaded... Error loading the "saxon" extension:
#11 14.44 Segmentation fault (core dumped)
#11 ERROR: process "/bin/sh -c install-php-extensions saxon" did not complete successfully: exit code: 1
------
 > [stage-0 4/4] RUN install-php-extensions saxon:
13.26    - add LIBDIR to the `LD_RUN_PATH' environment variable
13.26      during linking
13.26    - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
13.26 
13.26 See any operating system documentation about shared libraries for
13.26 more information, such as the ld(1) and ld.so(8) manual pages.
13.26 ----------------------------------------------------------------------
13.28 Installing shared extensions:     /usr/local/lib/php/extensions/no-debug-non-zts-20240924/
Error loading the "saxon" extension:
14.44 Segmentation fault (core dumped)
------
WARNING: No output specified with docker-container driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load
Dockerfile:7
--------------------
   5 |     COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
   6 |     
   7 | >>> RUN install-php-extensions saxon
   8 |     
   9 |     
--------------------
ERROR: failed to build: failed to solve: process "/bin/sh -c install-php-extensions saxon" did not complete successfully: exit code: 1
Reference
Check build summary support
Error: buildx failed with: ERROR: failed to build: failed to solve: process "/bin/sh -c install-php-extensions saxon" did not complete successfully: exit code: 1

benbrummer avatar Oct 28 '25 11:10 benbrummer

I opened an issue at Saxonica https://saxonica.plan.io/issues/6933

benbrummer avatar Oct 28 '25 16:10 benbrummer

Hi, just to say that there's a bug in the upstream that only seems to affect Alpine on ARM. We will ship a fix in our next maintenance release.

Installing gcompat is required, but I don't think that just installing it will be enough for a PHP module. In my testing, I needed to set the LD_PRELOAD environment var for the entire PHP process to get it to successfully load (which I have managed with a patched upstream). I'm not sure that's part of this script's responsibilities, but it does make verifying the install is set up correctly trickier.

fidothe avatar Nov 03 '25 16:11 fidothe