diff --git a/dockerfiles/ci/bookworm/Dockerfile b/dockerfiles/ci/bookworm/Dockerfile index eab606056f3..90a85bdb24b 100644 --- a/dockerfiles/ci/bookworm/Dockerfile +++ b/dockerfiles/ci/bookworm/Dockerfile @@ -68,8 +68,6 @@ ENV PHPIZE_DEPS \ clang-17 \ cmake \ dpkg-dev \ - g++ \ - gcc \ file \ lcov \ libc-dev \ @@ -128,7 +126,17 @@ RUN set -eux; \ echo 'Defaults env_keep += "DEBIAN_FRONTEND"' >> /etc/sudoers.d/env_keep; \ \ # Allow nginx to be run as non-root for tests - chown -R circleci:circleci /var/log/nginx/ /var/lib/nginx/; + chown -R circleci:circleci /var/log/nginx/ /var/lib/nginx/; \ + \ +# Make clang the default compiler + update-alternatives --install /usr/bin/cc cc /usr/bin/clang-17 100; \ + update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-17 100; \ + update-alternatives --install /usr/bin/clang clang /usr/bin/clang-17 100; \ + update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-17 100; \ + update-alternatives --install /usr/bin/ld ld /usr/bin/ld.lld-17 100; \ + echo "-L /usr/lib/llvm-17/lib/clang/17/lib/linux" > /usr/lib/llvm-17/bin/clang.cfg; \ +# Include libasan library path + echo /usr/lib/llvm-17/lib/clang/17/lib/linux > /etc/ld.so.conf.d/libasan.conf && ldconfig # Install SqlServer PHP Driver # https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server diff --git a/dockerfiles/ci/bookworm/build-extensions.sh b/dockerfiles/ci/bookworm/build-extensions.sh index 01328c10c5e..6a3f123ade3 100755 --- a/dockerfiles/ci/bookworm/build-extensions.sh +++ b/dockerfiles/ci/bookworm/build-extensions.sh @@ -6,6 +6,9 @@ SHARED_BUILD=$(if php -i | grep -q enable-pcntl=shared; then echo 1; else echo 0 PHP_VERSION_ID=$(php -r 'echo PHP_MAJOR_VERSION . PHP_MINOR_VERSION;') PHP_ZTS=$(php -r 'echo PHP_ZTS;') +# This make `pecl install` use all available cores +export MAKEFLAGS="-j $(nproc)" + XDEBUG_VERSIONS=(-3.1.2) if [[ $PHP_VERSION_ID -le 70 ]]; then XDEBUG_VERSIONS=(-2.7.2) @@ -56,8 +59,8 @@ fi HOST_ARCH=$(if [[ $(file $(readlink -f $(which php))) == *aarch64* ]]; then echo "aarch64"; else echo "x86_64"; fi) export PKG_CONFIG=/usr/bin/$HOST_ARCH-linux-gnu-pkg-config -export CC=$HOST_ARCH-linux-gnu-gcc -export CXX=$HOST_ARCH-linux-gnu-g++ +# export CC=$HOST_ARCH-linux-gnu-gcc +# export CXX=$HOST_ARCH-linux-gnu-g++ iniDir=$(php -i | awk -F"=> " '/Scan this dir for additional .ini files/ {print $2}'); diff --git a/dockerfiles/ci/bookworm/build-php.sh b/dockerfiles/ci/bookworm/build-php.sh index a15800e999b..909745c5471 100755 --- a/dockerfiles/ci/bookworm/build-php.sh +++ b/dockerfiles/ci/bookworm/build-php.sh @@ -13,7 +13,8 @@ INSTALL_DIR=$BASE_INSTALL_DIR/$INSTALL_VERSION if [[ ${INSTALL_VERSION} == *asan* ]]; then export CFLAGS='-fsanitize=address -DZEND_TRACK_ARENA_ALLOC' - export LDFLAGS='-fsanitize=address' + # GCC has `-shared-libasan` default, clang has '-static-libasan' default + export LDFLAGS='-fsanitize=address -shared-libasan' fi mkdir -p /tmp/build-php && cd /tmp/build-php @@ -23,7 +24,7 @@ mkdir -p ${INSTALL_DIR}/conf.d HOST_ARCH=$(if [[ $TARGETPLATFORM == "linux/arm64" ]]; then echo "aarch64"; else echo "x86_64"; fi) PKG_CONFIG=/usr/bin/$HOST_ARCH-linux-gnu-pkg-config \ -CC=$HOST_ARCH-linux-gnu-gcc \ +# CC=$HOST_ARCH-linux-gnu-gcc \ LIBS=-ldl \ ${PHP_SRC_DIR}/configure \ $(if [[ $SHARED_BUILD -ne 0 ]]; then echo \