php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53188 php_date.c fails to compile (code line 499)
Submitted: 2010-10-28 03:14 UTC Modified: 2013-02-18 00:34 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: jeremy dot iglehart at gmail dot com Assigned:
Status: No Feedback Package: Compile Failure
PHP Version: 5.3.3 OS: Darwin (iPod OS4)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jeremy dot iglehart at gmail dot com
New email:
PHP Version: OS:

 

 [2010-10-28 03:14 UTC] 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 :(

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-10-29 12:17 UTC] aharvey@php.net
-Status: Open +Status: Feedback
 [2010-10-29 12:17 UTC] 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.
 [2012-01-25 15:26 UTC] 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?
 [2012-04-25 11:20 UTC] pancake at nopcode dot org
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.
 [2012-04-25 12:15 UTC] pancake at nopcode dot org
After fixing this issue, everything compiles fine, but the linking fails.

To fix the libresolv issue, exit ext/standard/dns.c and write this  at line 78

#define res_9_init res_init
#define res_9_search res_search
#define res_9_expand res_expand
#define res_9_dn_skipname __dn_skipname
#define res_9_dn_expand dn_expand
 [2012-04-25 12:38 UTC] pajoye@php.net
hi!

I would suggest to provide a patch against master, with the correct #ifdef to 
modify the sources only if iOS is used.
 [2012-04-25 12:52 UTC] pancake at nopcode dot org
There's also a problem linking against libiconv. because the symbol name is libiconv() and not iconv(). Doing a #define on iconv.c is enought to bypass this issue.

Anyway. none of the hacks I did shuold be in mainstream, they are just hacks :)

I don't have time to write proper patch, but with those hints any php dev can write the proper patch and commit it.

If you have any question or you need to test just ping me.
 [2013-02-18 00:34 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 28 03:01:28 2024 UTC