Bug #53188 [Com]: php_date.c fails to compile (code line 499)

From: Date: Wed, 25 Apr 2012 11:20:11 +0000
Subject: Bug #53188 [Com]: php_date.c fails to compile (code line 499)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-169933@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=53188&edit=1

 ID:                 53188
 Comment by:         pancake at nopcode dot org
 Reported by:        jeremy dot iglehart at gmail dot com
 Summary:            php_date.c fails to compile (code line 499)
 Status:             Feedback
 Type:               Bug
 Package:            Compile Failure
 Operating System:   Darwin (iPod OS4)
 PHP Version:        5.3.3
 Block user comment: N
 Private report:     N

 New Comment:

I have been checking this bug as I'm the maintainer of cydia.radare.org.. and someone on
twitter asked me to build an updated package of php...

After an hour messing around the different nested macros I end up finding the problem. As i'm
quite lazy, i'm not going to send a patch, but rather explain how to fix it.

The problem is in the Zend/zend_ini.h:32 , in this line there's the definition of XtOffsetOf
macro.. which is wrong and this causes gcc to fail in that way.

My fix was removing all definitions of XtOffsetOf and replace it with a single and portable one:

#define XtOffsetOf(type, member) ((unsigned long) &((type*)0)->member)

feel free to submit patch on the main repo. I'm using this XtOffsetOf macro in some projects of
mine in multiple compilers/archs/OS without any issue. So maybe you can simplify the code instead of
just handling that case.

Anyway... the build i'm doing (php-5.4.0) will be available in binary form in the
cydia.radare.org repo.


Previous Comments:
------------------------------------------------------------------------
[2012-01-25 15:26:16] bobwei9 at hotmail dot com

Now the error is on line 500… with php 5.4 on ios5.0.1

Could you pelase fix this?

------------------------------------------------------------------------
[2010-10-29 12:17:23] aharvey@php.net

Where did you source your toolchain from?

PHP does run on jailbroken iOS devices (the Telesphoreo repository has 5.2.8 available), but
I'd be surprised if that wasn't being cross-compiled off OS X via XCode.

------------------------------------------------------------------------
[2010-10-28 03:14:58] jeremy dot iglehart at gmail dot com

Description:
------------
I'm not sure why this is happening - and I can't find help from google or the IRC chatroom
#php so I figured I would post it here.

For some reason I can't compile - when I try to run the compile I get this:

to get a full paste of it you can go here: http://pastebin.com/zTtsQiMX

Any idea?

Test script:
---------------
Here is a paste URL of the entire problem.
http://pastebin.com/zTtsQiMX

./configure code...

+--------------------------------------------------------------------+
| License:                                                           |
| This software is subject to the PHP License, available in this     |
| distribution in the file LICENSE.  By continuing this installation |
| process, you are bound by the terms of this license agreement.     |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.                            |
+--------------------------------------------------------------------+

Thank you for using PHP.

iPod-Touch:~/php-5.3.3 root# make
/bin/sh /var/root/php-5.3.3/libtool --silent --preserve-dup-deps --mode=compile gcc -Iext/date/lib
-Iext/date/ -I/var/root/php-5.3.3/ext/date/ -DPHP_ATOM_INC -I/var/root/php-5.3.3/include
-I/var/root/php-5.3.3/main -I/var/root/php-5.3.3 -I/var/root/php-5.3.3/ext/date/lib
-I/var/root/php-5.3.3/ext/ereg/regex -I/usr/include/libxml2 -I/usr/local/include
-I/var/root/php-5.3.3/ext/sqlite3/libsqlite -I/var/root/php-5.3.3/TSRM -I/var/root/php-5.3.3/Zend 
-no-cpp-precomp  -I/usr/include -g -O2  -c /var/root/php-5.3.3/ext/date/php_date.c -o
ext/date/php_date.lo 
/var/root/php-5.3.3/ext/date/php_date.c:499: error: expected expression before
'zend_date_globals'
/var/root/php-5.3.3/ext/date/php_date.c:499: error: initializer element is not constant
/var/root/php-5.3.3/ext/date/php_date.c:499: error: (near initialization for
'ini_entries[0].mh_arg1')
make: *** [ext/date/php_date.lo] Error 1
iPod-Touch:~/php-5.3.3 root# 


Expected result:
----------------
to compile normal :)

Actual result:
--------------
fails to compile :(


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=53188&edit=1


Thread (8 messages)

« previous php.bugs (#169933) next »