From 4659bc28fa6929147f16faf0f838a1c0d8cb69e7 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sun, 11 May 2025 09:00:50 +0100 Subject: [PATCH 1/3] ext/intl: fix clang build. actually, with recent icu releases, this problem arises ``` checking whether clang++ supports C++17 features with -std=c++17... no checking whether clang++ supports C++17 features with +std=c++17... no checking whether clang++ supports C++17 features with -h std=c++17... no checking whether clang++ supports C++17 features with -std=c++1z... no checking whether clang++ supports C++17 features with +std=c++1z... no checking whether clang++ supports C++17 features with -h std=c++1z... no configure: error: *** A compiler with support for C++17 language features is required. ``` thus, proposing to falls into LLVM libc++ instead. --- build/php.m4 | 9 ++++++++- build/php_cxx_compile_stdcxx.m4 | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/build/php.m4 b/build/php.m4 index 142ddf08fd98b..0c62a4bf57357 100644 --- a/build/php.m4 +++ b/build/php.m4 @@ -742,7 +742,14 @@ AC_DEFUN([PHP_REQUIRE_CXX],[ if test -z "$php_cxx_done"; then AC_PROG_CXX AC_PROG_CXXCPP - PHP_ADD_LIBRARY(stdc++) + case "$CXX" in + *clang++*) + PHP_ADD_LIBRARY(c++) + ;; + *) + PHP_ADD_LIBRARY(stdc++) + ;; + esac php_cxx_done=yes fi ]) diff --git a/build/php_cxx_compile_stdcxx.m4 b/build/php_cxx_compile_stdcxx.m4 index 8f723266b2c4f..89b1647b6095a 100644 --- a/build/php_cxx_compile_stdcxx.m4 +++ b/build/php_cxx_compile_stdcxx.m4 @@ -40,6 +40,11 @@ AC_DEFUN([PHP_CXX_COMPILE_STDCXX], [dnl dnl Cray's crayCC needs "-h std=c++11" for alternative in ${ax_cxx_compile_alternatives}; do for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do + case "$CXX" in + *clang++*) + switch="${switch} -stdlib=libc++" + ;; + esac cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, $cachevar, From 4f7c91f62f1900e1c7898476d4206d7525aa1caf Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sun, 11 May 2025 09:13:48 +0100 Subject: [PATCH 2/3] fix 64 bits attempt --- .github/actions/apt-x64/action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/apt-x64/action.yml b/.github/actions/apt-x64/action.yml index bc2aa00df20b1..08249336af7f0 100644 --- a/.github/actions/apt-x64/action.yml +++ b/.github/actions/apt-x64/action.yml @@ -61,6 +61,8 @@ runs: unixodbc-dev \ llvm \ clang \ + libc++-dev \ + libc++abi-dev \ libc-client-dev \ dovecot-core \ dovecot-pop3d \ From 9a75fa29902f5f8786c46c07ae7b6b31f7fe05f2 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sun, 11 May 2025 13:48:15 +0100 Subject: [PATCH 3/3] disable virtual table pointer checks for C++ --- build/php.m4 | 1 + configure.ac | 2 +- ext/intl/config.m4 | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/build/php.m4 b/build/php.m4 index 0c62a4bf57357..e087574d63a8d 100644 --- a/build/php.m4 +++ b/build/php.m4 @@ -745,6 +745,7 @@ AC_DEFUN([PHP_REQUIRE_CXX],[ case "$CXX" in *clang++*) PHP_ADD_LIBRARY(c++) + PHP_ADD_LIBRARY(c++abi) ;; *) PHP_ADD_LIBRARY(stdc++) diff --git a/configure.ac b/configure.ac index 278dbd110d248..39e70a82e1b86 100644 --- a/configure.ac +++ b/configure.ac @@ -1647,7 +1647,7 @@ int main(void) { CFLAGS="$OLD_CFLAGS" if test "$php_cv_ubsan_no_function" = yes; then CFLAGS="$CFLAGS -fno-sanitize=function" - CXXFLAGS="$CFLAGS -fno-sanitize=function" + CXXFLAGS="$CFLAGS -fno-sanitize=function,vptr" fi ], [AC_MSG_ERROR([UndefinedBehaviorSanitizer is not available])]) fi diff --git a/ext/intl/config.m4 b/ext/intl/config.m4 index 78396dc416926..a771df2fe111b 100644 --- a/ext/intl/config.m4 +++ b/ext/intl/config.m4 @@ -85,6 +85,9 @@ if test "$PHP_INTL" != "no"; then AS_IF([$PKG_CONFIG icu-uc --atleast-version=74],[ AC_MSG_RESULT([yes]) PHP_CXX_COMPILE_STDCXX(17, mandatory, PHP_INTL_STDCXX) + case $CXX in + *clang++*) ICU_CXXFLAGS="$ICU_CXXFLAGS -stdlib=libc++" PHP_ADD_LIBRARY(c++) PHP_ADD_LIBRARY(c++abi) + esac ],[ AC_MSG_RESULT([no]) PHP_CXX_COMPILE_STDCXX(11, mandatory, PHP_INTL_STDCXX) @@ -94,6 +97,7 @@ if test "$PHP_INTL" != "no"; then case $host_alias in *cygwin*) PHP_INTL_CXX_FLAGS="$PHP_INTL_CXX_FLAGS -D_POSIX_C_SOURCE=200809L" esac + if test "$ext_shared" = "no"; then PHP_ADD_SOURCES(PHP_EXT_DIR(intl), $PHP_INTL_CXX_SOURCES, $PHP_INTL_CXX_FLAGS) else