[go: up one dir, main page]

Skip to content
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

Closed
barracuda156 opened this issue Feb 5, 2024 · 10 comments

Comments

@barracuda156
Copy link
barracuda156 commented Feb 5, 2024

Description

Trying to install php 8.3 on older macOS with the default system compiler fails:

/bin/sh /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_php/php83/work/php-8.3.2/libtool --silent --preserve-dup-deps --tag CC --mode=compile /usr/bin/gcc-4.2 -std=gnu99 -Iext/date/ -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_php/php83/work/php-8.3.2/ext/date/ -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_php/php83/work/php-8.3.2/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_php/php83/work/php-8.3.2/main -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_php/php83/work/php-8.3.2 -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_php/php83/work/php-8.3.2/ext/date/lib -I/opt/local/include/libxml2 -I/opt/local/include -I/opt/local/include/editline -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_php/php83/work/php-8.3.2/TSRM -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_php/php83/work/php-8.3.2/Zend  -I/opt/local/include -D_GNU_SOURCE  -fno-common -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -pipe -Os -arch ppc -fvisibility=hidden -DZEND_SIGNALS   -Wno-implicit-fallthrough -Iext/date/lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DHAVE_TIMELIB_CONFIG_H=1 -c /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_php/php83/work/php-8.3.2/ext/date/lib/parse_tz.c -o ext/date/lib/parse_tz.lo  -MMD -MF ext/date/lib/parse_tz.dep -MT ext/date/lib/parse_tz.lo
/bin/sh /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_php/php83/work/php-8.3.2/libtool --silent --preserve-dup-deps --tag CC --mode=compile /usr/bin/gcc-4.2 -std=gnu99 -Iext/date/ -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_php/php83/work/php-8.3.2/ext/date/ -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_php/php83/work/php-8.3.2/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_php/php83/work/php-8.3.2/main -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_php/php83/work/php-8.3.2 -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_php/php83/work/php-8.3.2/ext/date/lib -I/opt/local/include/libxml2 -I/opt/local/include -I/opt/local/include/editline -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_php/php83/work/php-8.3.2/TSRM -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_php/php83/work/php-8.3.2/Zend  -I/opt/local/include -D_GNU_SOURCE  -fno-common -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -pipe -Os -arch ppc -fvisibility=hidden -DZEND_SIGNALS   -Wno-implicit-fallthrough -Iext/date/lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DHAVE_TIMELIB_CONFIG_H=1 -c /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_php/php83/work/php-8.3.2/ext/date/lib/parse_posix.c -o ext/date/lib/parse_posix.lo  -MMD -MF ext/date/lib/parse_posix.dep -MT ext/date/lib/parse_posix.lo
cc1: error: unrecognized command line option "-Wno-implicit-fallthrough"
make: *** [ext/date/php_date.lo] Error 1
make: *** Waiting for unfinished jobs....
cc1: error: unrecognized command line option "-Wno-implicit-fallthrough"
make: *** [ext/date/lib/parse_date.lo] Error 1
cc1: error: unrecognized command line option "-Wno-implicit-fallthrough"
make: *** [ext/date/lib/parse_posix.lo] Error 1
cc1: error: unrecognized command line option "-Wno-implicit-fallthrough"
make: *** [ext/date/lib/parse_tz.lo] Error 1
cc1: error: unrecognized command line option "-Wno-implicit-fallthrough"
make: *** [ext/date/lib/dow.lo] Error 1
cc1: error: unrecognized command line option "-Wno-implicit-fallthrough"
make: *** [ext/date/lib/astro.lo] Error 1

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

@devnexen
Copy link
Member
devnexen commented Feb 5, 2024

So far the date, hash. pcre, opcache extensions use this flag. And Zend uses its opposite.
Those had been introduced, for gcc, in the 7.x releases serie.
Is there a possibility to patch macports removing these ?

@barracuda156
Copy link
Author
barracuda156 commented Feb 5, 2024

@devnexen We can fix it locally, of course, if fixing it here is too bothersome.
So just removing this flag should presumably work, and C11 is not required, right?

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.

@devnexen
Copy link
Member
devnexen commented Feb 5, 2024

@devnexen We can fix it locally, of course, if fixing it here is too bothersome. So just removing this flag should presumably work, and C11 is not required, right?

c99, I believe, is the minimum.

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.

@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.

@petk
Copy link
Member
petk commented Feb 5, 2024

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, [ ])

@barracuda156
Copy link
Author
barracuda156 commented Feb 5, 2024

@devnexen Thank you, C99 should work for gcc-4.2.

@petk I will try your patch now, many thanks.

@barracuda156
Copy link
Author

@petk Perhaps something else also sets it? While I see this during configure:

Configuring Zend
checking whether syscall to create shadow stack exists... no
checking for fiber switching context... combined_sysv_macho_gas
checking cpuid.h usability... no
checking cpuid.h presence... no
checking for cpuid.h... no
checking for getpid... yes
checking for kill... yes
checking for sigsetjmp... yes
checking for pthread_getattr_np... no
checking for pthread_attr_get_np... no
checking for pthread_get_stackaddr_np... yes
checking for pthread_attr_getstack... yes
checking for pthread_stackseg_np... no
checking for gettid... no
checking whether the stack grows downwards... yes
checking for usable _FPU_SETCW... no
checking for usable fpsetprec... no
checking for usable _controlfp... no
checking for usable _controlfp_s... no
checking whether FPU control word can be manipulated by inline assembler... no
checking for dlfcn.h... (cached) yes
checking whether dlsym() requires a leading underscore in symbol names... no
checking whether to enable thread-safety... no
checking whether to enable Zend debugging... no
checking whether C compiler accepts -Wno-clobbered... no
checking whether C compiler accepts -Wimplicit-fallthrough=1... no
checking whether C compiler accepts -Wduplicated-cond... no
checking whether C compiler accepts -Wlogical-op... no
checking whether C compiler accepts -Wformat-truncation... no
checking whether C compiler accepts -Wstrict-prototypes... no
checking whether C compiler accepts -fno-common... yes
checking for inline... inline
checking target system is Darwin... yes
checking for MM alignment and log values... done
checking for mremap... no
checking for sigaction... yes
checking whether to enable zend signal handling... yes
checking for timer_create... no
checking for __timer_create... no
checking for timer_create in -lrt... no
checking for __timer_create in -lrt... no
checking whether to enable zend max execution timers... no

The flag is nevertheless passed:

--->  Building php83
Executing:  cd "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2" && /usr/bin/make -j6 -w all 
make: Entering directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2'
/bin/sh /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/libtool --silent --preserve-dup-deps --tag CC --mode=compile /usr/bin/gcc-4.2 -std=gnu99 -Iext/date/ -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/ext/date/ -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/include -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/main -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2 -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/ext/date/lib -I/opt/local/include/libxml2 -I/opt/local/include -I/opt/local/include/editline -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/TSRM -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/Zend  -I/opt/local/include -D_GNU_SOURCE  -fno-common -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -pipe -Os -arch ppc -fvisibility=hidden -DZEND_SIGNALS   -Wno-implicit-fallthrough -Iext/date/lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DHAVE_TIMELIB_CONFIG_H=1 -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/ext/date/php_date.c -o ext/date/php_date.lo  -MMD -MF ext/date/php_date.dep -MT ext/date/php_date.lo
/bin/sh /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/libtool --silent --preserve-dup-deps --tag CC --mode=compile /usr/bin/gcc-4.2 -std=gnu99 -Iext/date/ -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/ext/date/ -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/include -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/main -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2 -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/ext/date/lib -I/opt/local/include/libxml2 -I/opt/local/include -I/opt/local/include/editline -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/TSRM -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/Zend  -I/opt/local/include -D_GNU_SOURCE  -fno-common -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -pipe -Os -arch ppc -fvisibility=hidden -DZEND_SIGNALS   -Wno-implicit-fallthrough -Iext/date/lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DHAVE_TIMELIB_CONFIG_H=1 -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/ext/date/lib/astro.c -o ext/date/lib/astro.lo  -MMD -MF ext/date/lib/astro.dep -MT ext/date/lib/astro.lo
/bin/sh /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/libtool --silent --preserve-dup-deps --tag CC --mode=compile /usr/bin/gcc-4.2 -std=gnu99 -Iext/date/ -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/ext/date/ -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/include -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/main -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2 -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/ext/date/lib -I/opt/local/include/libxml2 -I/opt/local/include -I/opt/local/include/editline -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/TSRM -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/Zend  -I/opt/local/include -D_GNU_SOURCE  -fno-common -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -pipe -Os -arch ppc -fvisibility=hidden -DZEND_SIGNALS   -Wno-implicit-fallthrough -Iext/date/lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DHAVE_TIMELIB_CONFIG_H=1 -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/ext/date/lib/dow.c -o ext/date/lib/dow.lo  -MMD -MF ext/date/lib/dow.dep -MT ext/date/lib/dow.lo
/bin/sh /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/libtool --silent --preserve-dup-deps --tag CC --mode=compile /usr/bin/gcc-4.2 -std=gnu99 -Iext/date/ -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/ext/date/ -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/include -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/main -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2 -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/ext/date/lib -I/opt/local/include/libxml2 -I/opt/local/include -I/opt/local/include/editline -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/TSRM -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/Zend  -I/opt/local/include -D_GNU_SOURCE  -fno-common -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -pipe -Os -arch ppc -fvisibility=hidden -DZEND_SIGNALS   -Wno-implicit-fallthrough -Iext/date/lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DHAVE_TIMELIB_CONFIG_H=1 -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/ext/date/lib/parse_date.c -o ext/date/lib/parse_date.lo  -MMD -MF ext/date/lib/parse_date.dep -MT ext/date/lib/parse_date.lo
/bin/sh /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/libtool --silent --preserve-dup-deps --tag CC --mode=compile /usr/bin/gcc-4.2 -std=gnu99 -Iext/date/ -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/ext/date/ -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/include -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/main -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2 -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/ext/date/lib -I/opt/local/include/libxml2 -I/opt/local/include -I/opt/local/include/editline -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/TSRM -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/Zend  -I/opt/local/include -D_GNU_SOURCE  -fno-common -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -pipe -Os -arch ppc -fvisibility=hidden -DZEND_SIGNALS   -Wno-implicit-fallthrough -Iext/date/lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DHAVE_TIMELIB_CONFIG_H=1 -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/ext/date/lib/parse_tz.c -o ext/date/lib/parse_tz.lo  -MMD -MF ext/date/lib/parse_tz.dep -MT ext/date/lib/parse_tz.lo
/bin/sh /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/libtool --silent --preserve-dup-deps --tag CC --mode=compile /usr/bin/gcc-4.2 -std=gnu99 -Iext/date/ -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/ext/date/ -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/include -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/main -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2 -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/ext/date/lib -I/opt/local/include/libxml2 -I/opt/local/include -I/opt/local/include/editline -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/TSRM -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/Zend  -I/opt/local/include -D_GNU_SOURCE  -fno-common -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -pipe -Os -arch ppc -fvisibility=hidden -DZEND_SIGNALS   -Wno-implicit-fallthrough -Iext/date/lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DHAVE_TIMELIB_CONFIG_H=1 -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_php/php83/work/php-8.3.2/ext/date/lib/parse_posix.c -o ext/date/lib/parse_posix.lo  -MMD -MF ext/date/lib/parse_posix.dep -MT ext/date/lib/parse_posix.lo
cc1: error: unrecognized command line option "-Wno-implicit-fallthrough"
make: *** [ext/date/php_date.lo] Error 1
make: *** Waiting for unfinished jobs....
cc1: error: unrecognized command line option "-Wno-implicit-fallthrough"
cc1: error: unrecognized command line option "-Wno-implicit-fallthrough"
make: *** [ext/date/lib/parse_date.lo] Error 1
make: *** [ext/date/lib/dow.lo] Error 1
cc1: error: unrecognized command line option "-Wno-implicit-fallthrough"
cc1: error: unrecognized command line option "-Wno-implicit-fallthrough"
make: *** [ext/date/lib/astro.lo] Error 1
make: *** [ext/date/lib/parse_posix.lo] Error 1
cc1: error: unrecognized command line option "-Wno-implicit-fallthrough"
make: *** [ext/date/lib/parse_tz.lo] Error 1

I had to modify the patch a bit for PHP 8.3.2:

--- a/ext/date/config0.m4	2024-01-16 21:46:41.000000000 +0800
+++ b/ext/date/config0.m4	2024-02-06 02:45:45.000000000 +0800
@@ -4,7 +4,9 @@
 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"
 

--- a/ext/hash/config.m4	2024-01-16 21:46:41.000000000 +0800
+++ b/ext/hash/config.m4	2024-02-06 02:47:47.000000000 +0800
@@ -25,7 +25,8 @@
   ])
   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

--- a/ext/opcache/config.m4	2024-01-16 21:46:41.000000000 +0800
+++ b/ext/opcache/config.m4	2024-02-06 02:47:06.000000000 +0800
@@ -296,6 +296,8 @@
   fi
   AC_MSG_RESULT([$have_shm_mmap_posix])
 
+  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 \
@@ -311,7 +313,7 @@
 	shared_alloc_mmap.c \
 	shared_alloc_posix.c \
 	$ZEND_JIT_SRC,
-	shared,,"-Wno-implicit-fallthrough -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1",,yes)
+	shared,,"${PHP_OPCACHE_CFLAGS} -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1",,yes)
 
   PHP_ADD_EXTENSION_DEP(opcache, pcre)
 
--- a/ext/pcre/config0.m4	2024-01-16 21:46:41.000000000 +0800
+++ b/ext/pcre/config0.m4	2024-02-06 02:44:20.000000000 +0800
@@ -66,7 +66,8 @@
   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, [ ])
 

Or did I just miss something?

@devnexen
Copy link
Member
devnexen commented Feb 5, 2024

Is it a fresh build (or at least is buildconf -f is involved) with your last try ?

@petk
Copy link
Member
petk commented Feb 5, 2024

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 -Wno-implicit-fallthrough occurrences in the php-src code instead of adding this patch.

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.

@barracuda156
Copy link
Author

Is it a fresh build (or at least is buildconf -f is involved) with your last try ?

Yes, I verified now, it still passes the flag and fails in result.

@barracuda156
Copy link
Author

Try recreating the configure script, yes.

Ah, I guess Macports just does not use autotools here, so we indeed need to patch configure.

petk added a commit to petk/php-src that referenced this issue Feb 5, 2024
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
petk added a commit to petk/php-src that referenced this issue Feb 5, 2024
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
petk added a commit to petk/php-src that referenced this issue Jul 22, 2024
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
@petk petk closed this as completed in d20d113 Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants