-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
php 8.3 build error with gcc-4.2: cc1: error: unrecognized command line option "-Wno-implicit-fallthrough"
#13330
Comments
So far the date, hash. pcre, opcache extensions use this flag. And Zend uses its opposite. |
@devnexen We can fix it locally, of course, if fixing it here is too bothersome. Or maybe it is possible to have a configure check for this flag? And then it will be fixed for everyone and not just Macports users. |
c99, I believe, is the minimum.
@petk might help shed a light on this topic, however though we can t maintain backward compatibility forever it makes everything more and more complex overtime. |
Yes, all these flags should be appended conditionally by checking if they are available. They probably weren't checked yet because they seem so common on GCC and Clang. We can add these checks something like this: diff --git a/ext/date/config0.m4 b/ext/date/config0.m4
index 6b803bf33e..7f29eda278 100644
--- a/ext/date/config0.m4
+++ b/ext/date/config0.m4
@@ -4,7 +4,9 @@ AC_CHECK_HEADERS([io.h])
dnl Check for strtoll, atoll
AC_CHECK_FUNCS(strtoll atoll)
-PHP_DATE_CFLAGS="-Wno-implicit-fallthrough -I@ext_builddir@/lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DHAVE_TIMELIB_CONFIG_H=1"
+AX_CHECK_COMPILE_FLAG([-Wno-implicit-fallthrough], PHP_DATE_CFLAGS="$PHP_DATE_CFLAGS -Wno-implicit-fallthrough",,[-Werror])
+
+PHP_DATE_CFLAGS="$PHP_DATE_CFLAGS -I@ext_builddir@/lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DHAVE_TIMELIB_CONFIG_H=1"
timelib_sources="lib/astro.c lib/dow.c lib/parse_date.c lib/parse_tz.c lib/parse_posix.c
lib/timelib.c lib/tm2unixtime.c lib/unixtime2tm.c lib/parse_iso_intervals.c lib/interval.c"
diff --git a/ext/hash/config.m4 b/ext/hash/config.m4
index f87d00bf86..8a3a406b63 100644
--- a/ext/hash/config.m4
+++ b/ext/hash/config.m4
@@ -26,7 +26,8 @@ else
])
EXT_HASH_SHA3_SOURCES="$SHA3_OPT_SRC $SHA3_DIR/KeccakHash.c $SHA3_DIR/KeccakSponge.c hash_sha3.c"
dnl Add -Wno-implicit-fallthrough flag as it happens on 32 bit builds
- PHP_HASH_CFLAGS="-Wno-implicit-fallthrough -I@ext_srcdir@/$SHA3_DIR -DKeccakP200_excluded -DKeccakP400_excluded -DKeccakP800_excluded -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
+ AX_CHECK_COMPILE_FLAG([-Wno-implicit-fallthrough], PHP_HASH_CFLAGS="-Wno-implicit-fallthrough",,[-Werror])
+ PHP_HASH_CFLAGS="$PHP_HASH_CFLAGS -I@ext_srcdir@/$SHA3_DIR -DKeccakP200_excluded -DKeccakP400_excluded -DKeccakP800_excluded -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
PHP_ADD_BUILD_DIR(ext/hash/$SHA3_DIR, 1)
fi
diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4
index 4bab4f21bc..b75ea3ee03 100644
--- a/ext/opcache/config.m4
+++ b/ext/opcache/config.m4
@@ -306,6 +306,8 @@ int main(void) {
PHP_CHECK_LIBRARY(rt, shm_unlink, [PHP_ADD_LIBRARY(rt,1,OPCACHE_SHARED_LIBADD)])
fi
+ AX_CHECK_COMPILE_FLAG([-Wno-implicit-fallthrough], PHP_OPCACHE_CFLAGS="$PHP_OPCACHE_CFLAGS -Wno-implicit-fallthrough",,[-Werror])
+
PHP_NEW_EXTENSION(opcache,
ZendAccelerator.c \
zend_accelerator_blacklist.c \
@@ -321,7 +323,7 @@ int main(void) {
shared_alloc_mmap.c \
shared_alloc_posix.c \
$ZEND_JIT_SRC,
- shared,,"-Wno-implicit-fallthrough -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 ${JIT_CFLAGS}",,yes)
+ shared,,"${PHP_OPCACHE_CFLAGS} -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 ${JIT_CFLAGS}",,yes)
PHP_ADD_EXTENSION_DEP(opcache, pcre)
diff --git a/ext/pcre/config0.m4 b/ext/pcre/config0.m4
index 5f74b5df6b..61a10cad1f 100644
--- a/ext/pcre/config0.m4
+++ b/ext/pcre/config0.m4
@@ -66,7 +66,8 @@ else
pcre2lib/pcre2_string_utils.c pcre2lib/pcre2_study.c pcre2lib/pcre2_substitute.c pcre2lib/pcre2_substring.c \
pcre2lib/pcre2_tables.c pcre2lib/pcre2_ucd.c pcre2lib/pcre2_valid_utf.c pcre2lib/pcre2_xclass.c \
pcre2lib/pcre2_find_bracket.c pcre2lib/pcre2_convert.c pcre2lib/pcre2_extuni.c pcre2lib/pcre2_script_run.c"
- PHP_PCRE_CFLAGS="-Wno-implicit-fallthrough -DHAVE_CONFIG_H -I@ext_srcdir@/pcre2lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
+ AX_CHECK_COMPILE_FLAG([-Wno-implicit-fallthrough], PHP_PCRE_CFLAGS="$PHP_PCRE_CFLAGS -Wno-implicit-fallthrough",,[-Werror])
+ PHP_PCRE_CFLAGS="$PHP_PCRE_CFLAGS -DHAVE_CONFIG_H -I@ext_srcdir@/pcre2lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
AC_DEFINE(HAVE_BUNDLED_PCRE, 1, [ ])
AC_DEFINE(PCRE2_CODE_UNIT_WIDTH, 8, [ ]) |
@petk Perhaps something else also sets it? While I see this during configure:
The flag is nevertheless passed:
I had to modify the patch a bit for PHP 8.3.2:
Or did I just miss something? |
Is it a fresh build (or at least is |
No, nothing should set it automagically from somewhere else. Try recreating the configure script, yes. Or, you can also simply test this by removing all the Otherwise, what might happen here is also that there will be further obstacles later on in the configuration phase. Let's see if these flags are the only issues. |
Yes, I verified now, it still passes the flag and fails in result. |
Ah, I guess Macports just does not use autotools here, so we indeed need to patch configure. |
Older GCC versions (> 7.0) don't support the -Wno-implicit-fallthrough compiler flag. This adds the flag conditionally in case some other compiler will run into same issue. Fixes php#13330
Older GCC versions (< 7.0) don't support the -Wno-implicit-fallthrough compiler flag. This adds the flag conditionally in case some other compiler will run into same issue. Fixes php#13330
Older GCC versions (< 7.0) don't support the -Wno-implicit-fallthrough compiler flag. This adds the flag conditionally in case some other compiler will run into same issue. Fixes phpGH-13330
Description
Trying to install
php
8.3 on older macOS with the default system compiler fails:It does build fine with
gcc
13.2.0, however. (So no issue with older macOS as such.)Can this be fixed for
gcc
4.2 or should we just switch to using a newer compiler for those systems in Macports?PHP Version
PHP 8.3
Operating System
macOS 10.6
See also: https://trac.macports.org/ticket/69114
The text was updated successfully, but these errors were encountered: