Skip to content

Commit

Permalink
update bookworm to llvm17
Browse files Browse the repository at this point in the history
  • Loading branch information
realFlowControl committed Nov 5, 2024
1 parent 11dd407 commit 8f5015d
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 8 deletions.
52 changes: 48 additions & 4 deletions dockerfiles/ci/bookworm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,7 @@ ENV PHPIZE_DEPS \
clang-17 \
cmake \
dpkg-dev \
g++ \
gcc \
file \
lcov \
libc-dev \
make \
pkg-config \
Expand Down Expand Up @@ -128,7 +125,54 @@ 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 lcov
RUN set -eux; \
LCOV_VERSION="1.15"; \
LCOV_SHA256="c1cda2fa33bec9aa2c2c73c87226cfe97de0831887176b45ee523c5e30f8053a"; \
cd /tmp && curl -OL https://github.com/linux-test-project/lcov/releases/download/v${LCOV_VERSION}/lcov-${LCOV_VERSION}.tar.gz; \
(echo "${LCOV_SHA256} lcov-${LCOV_VERSION}.tar.gz" | sha256sum -c -); \
mkdir lcov && cd lcov; \
tar -xf ../lcov-${LCOV_VERSION}.tar.gz --strip 1; \
make install; \
lcov --version; \
rm -rfv /tmp/*

# Install gdb
RUN set -eux; \
apt install -y libmpfr-dev libgmp-dev; \
GDB_VERSION="15.2"; \
GDB_SHA256="9d16bc2539a2a20dc3ef99b48b8414d51c51305c8577eb7a1da00996f6dea223";\
cd /tmp && curl -OL https://ftp.gnu.org/gnu/gdb/gdb-${GDB_VERSION}.tar.gz; \
(echo "${GDB_SHA256} gdb-${GDB_VERSION}.tar.gz" | sha256sum -c -); \
mkdir gdb && cd gdb; \
tar -xf ../gdb-${GDB_VERSION}.tar.gz --strip 1;\
./configure; \
make -j "$((`nproc`+1))"; \
make install

# Install valgrind
RUN set -eux; \
VALGRIND_VERSION="3.23.0"; \
VALGRIND_SHA1="ec410c75d3920d4f9249a5cfa2cac31e1bf6d586"; \
cd /tmp && curl -OL https://sourceware.org/pub/valgrind/valgrind-${VALGRIND_VERSION}.tar.bz2; \
(echo "${VALGRIND_SHA1}" valgrind-${VALGRIND_VERSION}.tar.bz2 | sha1sum -c -); \
mkdir valgrind && cd valgrind; \
tar -xjf ../valgrind-${VALGRIND_VERSION}.tar.bz2 --strip 1;\
./configure; \
make -j "$((`nproc`+1))"; \
make install

# Install SqlServer PHP Driver
# https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server
Expand Down
7 changes: 5 additions & 2 deletions dockerfiles/ci/bookworm/build-extensions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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}');

Expand Down
13 changes: 11 additions & 2 deletions dockerfiles/ci/bookworm/build-php.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,16 @@ 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

if [[ ${PHP_VERSION_ID} -le 73 ]]; then
if [[ -z "${CFLAGS:-}" ]]; then
export CFLAGS="-Wno-implicit-function-declaration -DHAVE_POSIX_READDIR_R=1 -DHAVE_OLD_READDIR_R=0"
else
export CFLAGS="${CFLAGS} -Wno-implicit-function-declaration -DHAVE_POSIX_READDIR_R=1 -DHAVE_OLD_READDIR_R=0"
fi
fi

mkdir -p /tmp/build-php && cd /tmp/build-php
Expand All @@ -23,7 +32,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 \
Expand Down

0 comments on commit 8f5015d

Please sign in to comment.