You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
error: unknown field ‘arData’ specified in initializer #11063
Since PHP 8.2 with old compilers we have the following error:
/usr/local/src/php-8.2.4/Zend/zend.c: In function ‘zend_vspprintf’:
/usr/local/src/php-8.2.4/Zend/zend.c:211:2: warning: missing initializer
/usr/local/src/php-8.2.4/Zend/zend.c:211:2: warning: (near initialization for ‘buf.len’)
/usr/local/src/php-8.2.4/Zend/zend.c: In function ‘zend_vstrpprintf’:
/usr/local/src/php-8.2.4/Zend/zend.c:263:2: warning: missing initializer
/usr/local/src/php-8.2.4/Zend/zend.c:263:2: warning: (near initialization for ‘buf.a’)
/usr/local/src/php-8.2.4/Zend/zend.c: In function ‘zend_print_flat_zval_r’:
/usr/local/src/php-8.2.4/Zend/zend.c:462:2: warning: missing initializer
/usr/local/src/php-8.2.4/Zend/zend.c:462:2: warning: (near initialization for ‘buf.a’)
/usr/local/src/php-8.2.4/Zend/zend.c: In function ‘zend_print_zval_r_to_str’:
/usr/local/src/php-8.2.4/Zend/zend.c:542:2: warning: missing initializer
/usr/local/src/php-8.2.4/Zend/zend.c:542:2: warning: (near initialization for ‘buf.a’)
/usr/local/src/php-8.2.4/Zend/zend.c: In function ‘zend_error_zstr_at’:
/usr/local/src/php-8.2.4/Zend/zend.c:1321:20: warning: ‘saved_class_entry’ may be used uninitialized in this function
/usr/local/src/php-8.2.4/Zend/zend_hash.c:240:2: warning: missing initializer
/usr/local/src/php-8.2.4/Zend/zend_hash.c:240:2: warning: (near initialization for ‘zend_empty_array.gc.u’)
/usr/local/src/php-8.2.4/Zend/zend_hash.c:243:2: error: unknown field ‘arData’ specified in initializer
/usr/local/src/php-8.2.4/Zend/zend_hash.c:243:2: warning: missing braces around initializer
/usr/local/src/php-8.2.4/Zend/zend_hash.c:243:2: warning: (near initialization for ‘zend_empty_array.’)
/usr/local/src/php-8.2.4/Zend/zend_hash.c:243:2: warning: initialization from incompatible pointer type
That is indeed a very old version. Is there a particular reason why you can't upgrade? Would it be possible to try with a new version to confirm this is actually the issue? What ./configure flags are you using?
@iluuu1994 Thanks for your reply. The migration is already being planned. So in the next time we will use a newer version. It works with perfectly with version 8.3. or newer. It would be great if there is a solution for the older version. My configure:
I think -std=gnu99 comes from b51a99a. This has been removed in master. bf5fdbd
Can you remove it locally to confirm it works without it? I'm really not proficient enough with the build system to know if backporting is a good idea. @Girgias maybe?
Edit: It looks like the macro is still added for autoconf <2.70 so backporting this should be safe.
When I remove AC_PROG_CC_C99 the flag is still added. autoconf is > 2.70. bf5fdbd works not for me. When I remove the flag manually the build is not possible. PHP 8.1 can I build with -std=gnu99. @iluuu1994 many thany for your support!
Looks like an old GCC shortcoming with anonymous unions in structs: https://godbolt.org/z/v5frzzo8v (last version of GCC on Godbolt that breaks is 4.5.3, first working version is 4.6.4).
EL-5 have GCC 4.1.2 and is EOL for ~6 years (after 10 years of support, so this version is 16 years old)
EL-6 have GCC 4.4.7 and is EOL for ~3 years
EL-7 have GCC 4.8.5 and will be EOL in ~1 year (but also have GCC 10, 11 or 12)
IMHO, it makes sense to stop supporting such old things and encouraging people to use dead cows.
(building recent PHP versions on EL-7 is already a nightmare, so many libraries being outdated)
Activity
iluuu1994 commentedon Apr 12, 2023
Hi @Jan1205. Can you specify what compiler you're using? Have you tried a full rebuild? (
make distclean,./buildconf,./configure,make)?Jan1205 commentedon Apr 12, 2023
That was my frist try. The error still appears. Unfortunately it is a very old system and version: gcc 4.1.2
iluuu1994 commentedon Apr 12, 2023
That is indeed a very old version. Is there a particular reason why you can't upgrade? Would it be possible to try with a new version to confirm this is actually the issue? What
./configureflags are you using?Jan1205 commentedon Apr 12, 2023
@iluuu1994 Thanks for your reply. The migration is already being planned. So in the next time we will use a newer version. It works with perfectly with version 8.3. or newer. It would be great if there is a solution for the older version. My configure:
./configure --with-config-file-path=/etc --with-pear --with-mysqli=mysqlnd --with-zlib --enable-ftp --with-gettext --with-openssl --enable-mbstring --enable-calendar --with-curl --with-pdo-mysql --without-sqlite3 --without-pdo-sqlite --enable-gd --with-jpeg --with-freetype --with-zip --enable-sockets --enable-soap --enable-exif --enable-pcntl --enable-opcache --enable-fpmThe issue only effects on PHP 8.2.
Thank you very much for your support.
Jan1205 commentedon Apr 12, 2023
This line produces the error:
/bin/sh /usr/local/src/php-8.2.4/libtool --silent --preserve-dup-deps --tag CC --mode=compile cc -std=gnu99 -IZend/ -I/usr/local/src/php-8.2.4/Zend/ -I/usr/local/src/php-8.2.4/include -I/usr/local/src/php-8.2.4/main -I/usr/local/src/php-8.2.4 -I/usr/local/src/php-8.2.4/ext/date/lib -I/usr/local/include/libxml2 -I/usr/local/include -I/usr/local/include/libpng12 -I/usr/local/include/freetype2 -I/usr/local/src/php-8.2.4/ext/mbstring/libmbfl -I/usr/local/src/php-8.2.4/ext/mbstring/libmbfl/mbfl -I/usr/local/lib/libzip/include -I/usr/local/src/php-8.2.4/TSRM -I/usr/local/src/php-8.2.4/Zend -D_GNU_SOURCE -fno-common -Wstrict-prototypes -Wlogical-op -Wno-clobbered -Wall -Wextra -Wno-strict-aliasing -Wno-unused-parameter -Wno-sign-compare -lrt -fvisibility=hidden -DZEND_SIGNALS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/local/src/php-8.2.4/Zend/zend_hash.c -o Zend/zend_hash.lo -MMD -MF Zend/zend_hash.dep -MT Zend/zend_hash.loWhen i remove "-std=gnu99" it works. Is there any configure options?
iluuu1994 commentedon Apr 13, 2023
I think
-std=gnu99comes from b51a99a. This has been removed inmaster. bf5fdbdCan you remove it locally to confirm it works without it? I'm really not proficient enough with the build system to know if backporting is a good idea. @Girgias maybe?
Edit: It looks like the macro is still added for autoconf <2.70 so backporting this should be safe.
Jan1205 commentedon Apr 13, 2023
When I remove
AC_PROG_CC_C99the flag is still added. autoconf is > 2.70. bf5fdbd works not for me. When I remove the flag manually the build is not possible. PHP 8.1 can I build with-std=gnu99. @iluuu1994 many thany for your support!iluuu1994 commentedon Apr 13, 2023
Hmm, then I don't know 😞
ndossche commentedon May 3, 2023
Looks like an old GCC shortcoming with anonymous unions in structs: https://godbolt.org/z/v5frzzo8v (last version of GCC on Godbolt that breaks is 4.5.3, first working version is 4.6.4).
ingamedeo commentedon May 9, 2023
I have encountered the same error when trying to compile with:
gcc version 4.4.7 20120313 (Red Hat 4.4.7-23.0.1) (GCC)
I was able to compile PHP successfully. Edit Zend/zend_hash.c:
.arData = (Bucket*)&uninitialized_bucket[2],replace with
{.arData = (Bucket*)&uninitialized_bucket[2]},Fix compilation error on old GCC versions
Fix compilation for PHP 8.1
remicollet commentedon May 11, 2023
Notice: the fix have been reverted, see 8f66b67
GCC 4.1.2 may be from EL-5...
For memory
IMHO, it makes sense to stop supporting such old things and encouraging people to use dead cows.
(building recent PHP versions on EL-7 is already a nightmare, so many libraries being outdated)
ndossche commentedon May 11, 2023
Only reverted for 8.1 afaict, because only 8.2+ needed the fix.
iluuu1994 commentedon May 11, 2023
Yes, @nielsdos is right. I merged this for 8.1, not realizing the array structure was different then.
I agree we shouldn't make large changes to support old versions. This change was small and seemed harmless.