Skip to content

docker-php-ext-install with buildx fails #1424

@trickert76

Description

@trickert76

I've a strange problem with the combination of docker-php-ext-install and buildx. When I run

docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx create --driver docker-container --use
docker buildx inspect --bootstrap
docker buildx ls
docker buildx build \
  --platform linux/amd64,linux/arm64 \
  --pull \
  --no-cache \
  --push \
  ./

with a Dockerfile for PHP 7.4 or PHP 8.2 (I think, the version is not important), like

FROM php:8.2-apache
....
RUN apt-get update --allow-releaseinfo-change && apt-get dist-upgrade -y && \
    apt-get install -y \
      catdoc \
      cron \
      curl \
      exiv2 \
      git \
      imagemagick \
      jq \
      libcap2-bin \
      libcurl4 \
      libcurl4-openssl-dev \
      libfreetype6-dev \
      libicu-dev \
      libjpeg62-turbo-dev \
      libldap2-dev \
      libmcrypt-dev \
      libmemcached-dev \
      libpng-dev \
      libssl-dev \
      libxml2-dev \
      libzip-dev \
      mariadb-client \
      msmtp \
      msmtp-mta \
      pngquant \
      poppler-utils \
      ssl-cert \
      tar \
      tesseract-ocr \
      tesseract-ocr-eng \
      tnef \
      unzip \
      zip \
      zlib1g-dev \
      zlib1g
RUN docker-php-ext-configure gd --with-freetype --with-jpeg && \
    docker-php-ext-configure ldap

RUN docker-php-ext-install soap pdo pdo_mysql calendar gd sysvshm sysvsem sysvmsg ldap opcache intl pcntl zip bcmath 
...

I'm getting always a compile error on the "other architecture". When I run buildx on an Intel system, I'm getting an error on build for ARM and when I run it on a M1, I'm getting an error for AMD64. When I run a normal docker build (without x), it always works. Also, sometimes it works on both architectures at the same time. But it feels a little bit like "don't touch a running system" then, because the next run (clearing all caches) breakes again.

The error itself differs from time to time. This time it's

#0 374.3 
#0 374.4 + strip --strip-all modules/sysvshm.so
#0 374.8 Installing shared extensions:     /usr/local/lib/php/extensions/no-debug-non-zts-20190902/
#0 375.6 find . -name \*.gcno -o -name \*.gcda | xargs rm -f
#0 375.7 find . -name \*.lo -o -name \*.o | xargs rm -f
#0 375.8 find . -name \*.la -o -name \*.a | xargs rm -f
#0 375.8 find . -name \*.so | xargs rm -f
#0 375.9 find . -name .libs -a -type d|xargs rm -rf
#0 376.0 rm -f libphp.la      modules/* libs/*
#0 376.4 Configuring for:
#0 376.4 PHP Api Version:         20190902
#0 376.4 Zend Module Api No:      20190902
#0 376.4 Zend Extension Api No:   320190902
#0 381.9 checking for grep that handles long lines and -e... /bin/grep
#0 381.9 checking for egrep... /bin/grep -E
#0 381.9 checking for a sed that does not truncate output... /bin/sed
#0 382.4 checking for pkg-config... /usr/bin/pkg-config
#0 382.4 checking pkg-config is at least version 0.9.0... yes
#0 382.4 checking for cc... cc
#0 382.7 checking whether the C compiler works... yes
#0 383.2 checking for C compiler default output file name... a.out
#0 383.2 checking for suffix of executables... 
#0 383.7 checking whether we are cross compiling... configure: error: in `/usr/src/php/ext/sysvsem':
#0 384.2 configure: error: cannot run C compiled programs.
#0 384.2 If you meant to cross compile, use `--host'.
#0 384.2 See `config.log' for more details

or

#0 24.23 
#0 24.23 creating libtool
#0 24.47 appending configuration tag "CXX" to libtool
#0 25.23 configure: patching config.h.in
#0 25.28 configure: creating ./config.status
#0 26.10 config.status: creating config.h
#0 26.55 /bin/bash /usr/src/php/ext/soap/libtool --mode=compile cc -I. -I/usr/src/php/ext/soap -I/usr/src/php/ext/soap/include -I/usr/src/php/ext/soap/main -I/usr/src/php/ext/soap -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/usr/include/libxml2  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE   -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DZEND_COMPILE_DL_EXT=1 -c /usr/src/php/ext/soap/soap.c -o soap.lo  -MMD -MF soap.dep -MT soap.lo
#0 28.14 mkdir .libs
#0 28.18  cc -I. -I/usr/src/php/ext/soap -I/usr/src/php/ext/soap/include -I/usr/src/php/ext/soap/main -I/usr/src/php/ext/soap -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/usr/include/libxml2 -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DZEND_COMPILE_DL_EXT=1 -c /usr/src/php/ext/soap/soap.c -MMD -MF soap.dep -MT soap.lo  -fPIC -DPIC -o .libs/soap.o
#0 39.04 /bin/bash /usr/src/php/ext/soap/libtool --mode=compile cc -I. -I/usr/src/php/ext/soap -I/usr/src/php/ext/soap/include -I/usr/src/php/ext/soap/main -I/usr/src/php/ext/soap -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/usr/include/libxml2  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE   -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DZEND_COMPILE_DL_EXT=1 -c /usr/src/php/ext/soap/php_encoding.c -o php_encoding.lo  -MMD -MF php_encoding.dep -MT php_encoding.lo
#0 40.59  cc -I. -I/usr/src/php/ext/soap -I/usr/src/php/ext/soap/include -I/usr/src/php/ext/soap/main -I/usr/src/php/ext/soap -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/usr/include/libxml2 -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DZEND_COMPILE_DL_EXT=1 -c /usr/src/php/ext/soap/php_encoding.c -MMD -MF php_encoding.dep -MT php_encoding.lo  -fPIC -DPIC -o .libs/php_encoding.o
#0 46.28 /usr/src/php/ext/soap/php_encoding.c: In function 'to_xml_array':
#0 46.28 /usr/src/php/ext/soap/php_encoding.c:2389:37: warning: 'strcmp' reading 1 or more bytes from a region of size 0 [-Wstringop-overread]
#0 46.28  2389 |                                 if (strcmp(ZSTR_VAL(array_type.s),"xsd:anyType") == 0) {
#0 46.28       |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#0 48.38 /bin/bash /usr/src/php/ext/soap/libtool --mode=compile cc -I. -I/usr/src/php/ext/soap -I/usr/src/php/ext/soap/include -I/usr/src/php/ext/soap/main -I/usr/src/php/ext/soap -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/usr/include/libxml2  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE   -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DZEND_COMPILE_DL_EXT=1 -c /usr/src/php/ext/soap/php_http.c -o php_http.lo  -MMD -MF php_http.dep -MT php_http.lo
#0 49.94  cc -I. -I/usr/src/php/ext/soap -I/usr/src/php/ext/soap/include -I/usr/src/php/ext/soap/main -I/usr/src/php/ext/soap -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/usr/include/libxml2 -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DZEND_COMPILE_DL_EXT=1 -c /usr/src/php/ext/soap/php_http.c -MMD -MF php_http.dep -MT php_http.lo  -fPIC -DPIC -o .libs/php_http.o
#0 49.95 /usr/src/php/ext/soap/libtool: line 1330:  4339 Segmentation fault      cc -I. -I/usr/src/php/ext/soap -I/usr/src/php/ext/soap/include -I/usr/src/php/ext/soap/main -I/usr/src/php/ext/soap -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/usr/include/libxml2 -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DZEND_COMPILE_DL_EXT=1 -c /usr/src/php/ext/soap/php_http.c -MMD -MF php_http.dep -MT php_http.lo -fPIC -DPIC -o .libs/php_http.o
#0 49.95 make: *** [Makefile:216: php_http.lo] Error 1

Thats completely strange to me. I don't have an idea, what to do. I'm using different docker version, this one, I tried 23.0.5 and/or 24.0.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions