php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64197 _Offsetof() macro used but not defined on ARM/Clang
Submitted: 2013-02-12 15:42 UTC Modified: 2013-02-13 12:54 UTC
From: mats at exmandato dot se Assigned: ardbiesheuvel (profile)
Status: Closed Package: Compile Failure
PHP Version: 5.4.11 OS: FreeBSD10 / ARM
Private report: No CVE-ID: None
 [2013-02-12 15:42 UTC] mats at exmandato dot se
Description:
------------
===>  Building for php5-5.4.11
/bin/sh /usr/ports/lang/php5/work/php-5.4.11/libtool --silent --preserve-dup-deps --mode=compile clang -Iext/date/lib -Iext/date/ -I/usr/ports/lang/php5/work/php-5.4.11/ext/date/ -DPHP_ATOM_INC -I/usr/ports/lang/php5/work/php-5.4.11/include -I/usr/ports/lang/php5/work/php-5.4.11/main -I/usr/ports/lang/php5/work/php-5.4.11 -I/usr/ports/lang/php5/work/php-5.4.11/ext/date/lib -I/usr/ports/lang/php5/work/php-5.4.11/ext/ereg/regex -I/usr/local/include/libxml2 -I/usr/local/include -I/usr/ports/lang/php5/work/php-5.4.11/TSRM -I/usr/ports/lang/php5/work/php-5.4.11/Zend    -O2 -mno-global-merge -mno-load-store-multiple -fno-strict-aliasing -pipe -march=armv6z -mtune=arm1176jzf-s -mfloat-abi=soft  -c /usr/ports/lang/php5/work/php-5.4.11/ext/date/php_date.c -o ext/date/php_date.lo
/usr/ports/lang/php5/work/php-5.4.11/ext/date/php_date.c:500:2: warning: implicit declaration of function '_Offsetof' is invalid in C99 [-Wimplicit-function-declaration]
        STD_PHP_INI_ENTRY("date.timezone", "", PHP_INI_ALL, OnUpdateString, default_timezone, zend_date_globals, date_globals)
        ^
/usr/ports/lang/php5/work/php-5.4.11/main/php_ini.h:67:28: note: expanded from macro 'STD_PHP_INI_ENTRY'
#define STD_PHP_INI_ENTRY               STD_ZEND_INI_ENTRY
                                        ^
/usr/ports/lang/php5/work/php-5.4.11/Zend/zend_ini.h:150:71: note: expanded from macro 'STD_ZEND_INI_ENTRY'
        ZEND_INI_ENTRY2(name, default_value, modifiable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr)
                                                                             ^
/usr/ports/lang/php5/work/php-5.4.11/Zend/zend_ini.h:55:36: note: expanded from macro 'XtOffsetOf'
# define XtOffsetOf(s_type, field) XtOffset(s_type*, field)
                                   ^
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/usr/ports/lang/php5/work/php-5.4.11/Zend/zend_ini.h:127:65: note: expanded from macro 'ZEND_INI_ENTRY2'
        ZEND_INI_ENTRY2_EX(name, default_value, modifiable, on_modify, arg1, arg2, NULL)
                                                                       ^
/usr/ports/lang/php5/work/php-5.4.11/Zend/zend_ini.h:124:65: note: expanded from macro 'ZEND_INI_ENTRY2_EX'
        ZEND_INI_ENTRY3_EX(name, default_value, modifiable, on_modify, arg1, arg2, NULL, displayer)
                                                                       ^
/usr/ports/lang/php5/work/php-5.4.11/Zend/zend_ini.h:118:50: note: expanded from macro 'ZEND_INI_ENTRY3_EX'
        { 0, modifiable, name, sizeof(name), on_modify, arg1, arg2, arg3, default_value, sizeof(default_value)-1, NULL, 0, 0, 0, displayer },
                                                        ^
/usr/ports/lang/php5/work/php-5.4.11/ext/date/php_date.c:500:88: error: unexpected type name 'zend_date_globals': expected expression
        STD_PHP_INI_ENTRY("date.timezone", "", PHP_INI_ALL, OnUpdateString, default_timezone, zend_date_globals, date_globals)
                                                                                              ^
/usr/ports/lang/php5/work/php-5.4.11/Zend/zend_ini.h:150:82: note: expanded from macro 'STD_ZEND_INI_ENTRY'
        ZEND_INI_ENTRY2(name, default_value, modifiable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr)
                                                                                        ^
/usr/ports/lang/php5/work/php-5.4.11/Zend/zend_ini.h:55:45: note: expanded from macro 'XtOffsetOf'
# define XtOffsetOf(s_type, field) XtOffset(s_type*, field)
                                            ^
/usr/ports/lang/php5/work/php-5.4.11/Zend/zend_ini.h:33:44: note: expanded from macro 'XtOffset'
# define XtOffset(p_type, field) _Offsetof(p_type, field)
                                           ^
/usr/ports/lang/php5/work/php-5.4.11/Zend/zend_ini.h:127:65: note: expanded from macro 'ZEND_INI_ENTRY2'
        ZEND_INI_ENTRY2_EX(name, default_value, modifiable, on_modify, arg1, arg2, NULL)
                                                                       ^
/usr/ports/lang/php5/work/php-5.4.11/Zend/zend_ini.h:124:65: note: expanded from macro 'ZEND_INI_ENTRY2_EX'
        ZEND_INI_ENTRY3_EX(name, default_value, modifiable, on_modify, arg1, arg2, NULL, displayer)
                                                                       ^
/usr/ports/lang/php5/work/php-5.4.11/Zend/zend_ini.h:118:50: note: expanded from macro 'ZEND_INI_ENTRY3_EX'
        { 0, modifiable, name, sizeof(name), on_modify, arg1, arg2, arg3, default_value, sizeof(default_value)-1, NULL, 0, 0, 0, displayer },
                                                        ^
/usr/ports/lang/php5/work/php-5.4.11/ext/date/php_date.c:500:2: error: expected expression
        STD_PHP_INI_ENTRY("date.timezone", "", PHP_INI_ALL, OnUpdateString, default_timezone, zend_date_globals, date_globals)
        ^
/usr/ports/lang/php5/work/php-5.4.11/main/php_ini.h:67:28: note: expanded from macro 'STD_PHP_INI_ENTRY'
#define STD_PHP_INI_ENTRY               STD_ZEND_INI_ENTRY
                                        ^
/usr/ports/lang/php5/work/php-5.4.11/Zend/zend_ini.h:150:71: note: expanded from macro 'STD_ZEND_INI_ENTRY'
        ZEND_INI_ENTRY2(name, default_value, modifiable, on_modify, (void *) XtOffsetOf(struct_type, property_name), (void *) &struct_ptr)
                                                                             ^
/usr/ports/lang/php5/work/php-5.4.11/Zend/zend_ini.h:55:36: note: expanded from macro 'XtOffsetOf'
# define XtOffsetOf(s_type, field) XtOffset(s_type*, field)
                                   ^
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
/usr/ports/lang/php5/work/php-5.4.11/Zend/zend_ini.h:127:65: note: expanded from macro 'ZEND_INI_ENTRY2'
        ZEND_INI_ENTRY2_EX(name, default_value, modifiable, on_modify, arg1, arg2, NULL)
                                                                       ^
/usr/ports/lang/php5/work/php-5.4.11/Zend/zend_ini.h:124:65: note: expanded from macro 'ZEND_INI_ENTRY2_EX'
        ZEND_INI_ENTRY3_EX(name, default_value, modifiable, on_modify, arg1, arg2, NULL, displayer)
                                                                       ^
/usr/ports/lang/php5/work/php-5.4.11/Zend/zend_ini.h:118:50: note: expanded from macro 'ZEND_INI_ENTRY3_EX'
        { 0, modifiable, name, sizeof(name), on_modify, arg1, arg2, arg3, default_value, sizeof(default_value)-1, NULL, 0, 0, 0, displayer },
                                                        ^
1 warning and 2 errors generated.
*** [ext/date/php_date.lo] Error code 1
1 error
*** [do-build] Error code 1

Stop in /usr/ports/lang/php5.



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-02-12 17:53 UTC] sixd@php.net
It could be interesting to try a snapshot of trunk from http://snaps.php.net/, 
since some ARM fixes have recently been merged there,
 [2013-02-12 19:35 UTC] ardbiesheuvel@php.net
This has nothing to do with ARM.

Looking at the log, it appears that LLVM/Clang does not understand _Offsetof, and 
treats it as an implicit function declaration and not a macro. Passing type names 
to functions is not supported in C so it complains that it expects an expression 
instead.
 [2013-02-13 07:29 UTC] ardbiesheuvel@php.net
It appears that this code is performing some tests to decide whether the CRAY or ARM proprietary compilers are being used, and this is giving bad results on FreeBSD/ARM.

Could you set the the following #define *before* the #ifndef XtOffsetOf in Zend/zend_ini,h:30

#define XtOffsetOf __builtin_offsetof

and try again?
 [2013-02-13 11:32 UTC] ardbiesheuvel@php.net
The preprocessor conditionals in Zend/zend_ini.h test for '__arm' to decide whether _Offsetof() is defined. The assumption is that this define is only set by ARMCC, the proprietary ARM compiler, and not by others (like GCC). However, as Clang does set this define as well (in addition to '__arm__'), the generated code ends up using a macro that is not defined, resulting in the output as reported.

Note that rooting out these kinds of bugs is typical for porting to a new architecture, so filing bugs against a stable version is not really appropriate.
 [2013-02-13 11:32 UTC] ardbiesheuvel@php.net
-Summary: The PHP5 module don't build +Summary: _Offsetof() macro used but not defined on ARM/Clang -Status: Open +Status: Verified
 [2013-02-13 12:18 UTC] mats at exmandato dot se
> Could you set the the following #define *before* the 
> #ifndef XtOffsetOf in Zend/zend_ini,h:30
> #define XtOffsetOf __builtin_offsetof

Adding #define XtOffsetOf __builtin_offsetof in the file Zend/zend_ini.h solved the problem.

> Note that rooting out these kinds of bugs is typical for porting to a new 
> architecture, so filing bugs against a stable version is not really
> appropriate.

I'm sorry, I didn't know that
 [2013-02-13 12:50 UTC] ardbiesheuvel@php.net
-Status: Verified +Status: Closed
 [2013-02-13 12:50 UTC] ardbiesheuvel@php.net
Automatic comment on behalf of ard.biesheuvel@linaro.org
Revision: http://git.php.net/?p=php-src.git;a=commit;h=050aae2860e1c202e2e9db715beaa97d0a4c9c33
Log: Fixed bug #64197 (_Offsetof() macro used but not defined on ARM/Clang)
 [2013-02-13 12:52 UTC] ardbiesheuvel@php.net
Automatic comment on behalf of ard.biesheuvel@linaro.org
Revision: http://git.php.net/?p=php-src.git;a=commit;h=050aae2860e1c202e2e9db715beaa97d0a4c9c33
Log: Fixed bug #64197 (_Offsetof() macro used but not defined on ARM/Clang)
 [2013-02-13 12:52 UTC] ardbiesheuvel@php.net
Automatic comment on behalf of ard.biesheuvel@linaro.org
Revision: http://git.php.net/?p=php-src.git;a=commit;h=050aae2860e1c202e2e9db715beaa97d0a4c9c33
Log: Fixed bug #64197 (_Offsetof() macro used but not defined on ARM/Clang)
 [2013-02-13 12:54 UTC] ardbiesheuvel@php.net
-Assigned To: +Assigned To: ardbiesheuvel
 [2013-02-13 12:54 UTC] ardbiesheuvel@php.net
Don't worry about it. Feel free to contact me directly if you have any ARM-related questions.
 [2014-10-07 23:20 UTC] stas@php.net
Automatic comment on behalf of ard.biesheuvel@linaro.org
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=050aae2860e1c202e2e9db715beaa97d0a4c9c33
Log: Fixed bug #64197 (_Offsetof() macro used but not defined on ARM/Clang)
 [2014-10-07 23:31 UTC] stas@php.net
Automatic comment on behalf of ard.biesheuvel@linaro.org
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=050aae2860e1c202e2e9db715beaa97d0a4c9c33
Log: Fixed bug #64197 (_Offsetof() macro used but not defined on ARM/Clang)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 22:01:28 2024 UTC