Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Nov 30, 2011, 08:24 AM   #1
rich06
macrumors newbie
 
Join Date: Nov 2011
Location: Antibes, France
PHP wont build on Lion

Hope someone can help me here as I am really stuck and am getting desperate to resolve this problem!

I am running OS X 10.7.2 Lion on my MBP and I need to build my own version of PHP rather than use the pre-installed version from Apple which has several shortcomings for my purposes. I downloaded v5.3.8 of PHP and the 'make' keeps on failing with these (or very similar errors):-

Code:
Undefined symbols for architecture x86_64:
  "_libiconv_open", referenced from:
      _do_convert in gdkanji.o
      _convert in encodings.o
  "_libiconv", referenced from:
      _do_convert in gdkanji.o
      _convert in encodings.o
  "_libiconv_close", referenced from:
      _do_convert in gdkanji.o
      _convert in encodings.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [libs/libphp5.bundle] Error 1
Having googled there were some fixes described (editing iconv.c, editing the Makefile, adding extra CFLAGS) ... I tried them all and nothing worked I have raised a bug on the PHP bug reporting site but they are ignoring/unresponsive regarding my bug report -> see here for more info https://bugs.php.net/bug.php?id=60268

Here's hoping someone here can help!
TIA!
rich06 is offline   0 Reply With Quote
Old Nov 30, 2011, 08:26 AM   #2
wrldwzrd89
macrumors G4
 
wrldwzrd89's Avatar
 
Join Date: Jun 2003
Location: Solon, OH
I had a similar odd problem building something else - x86-64 build was repeatedly failing in the same spot. Forcing the build architecture as x86 fixed it. Maybe give that a try?
__________________
iMac Intel (Rev H, 27"), 1TB HDD, 16GB RAM, 10.8.4
wrldwzrd89 is offline   0 Reply With Quote
Old Nov 30, 2011, 08:30 AM   #3
robvas
macrumors 68000
 
Join Date: Mar 2009
Location: USA
Try this before building PHP:

export CC=/usr/bin/gcc-4.2

You have to do the that with Ruby because OS X Lion uses llvm for the compiler and not GCC. Not sure if that will help you but it's worth a shot.

Edit: Actually, looking at your error again I don't think that's your problem.
robvas is offline   0 Reply With Quote
Old Nov 30, 2011, 12:47 PM   #4
jazzbo
macrumors member
 
Join Date: Oct 2008
Location: Bangor, ME
Looking at your bug report it looks like when you configuring the compile you're giving the following argument:
Code:
--with-iconv-dir=/opt/local
The errors are with the iconv libraries, so the question is: did you compile iconv (for the x86_64 arch) in /opt/local?
jazzbo is offline   0 Reply With Quote
Old Nov 30, 2011, 02:41 PM   #5
rich06
Thread Starter
macrumors newbie
 
Join Date: Nov 2011
Location: Antibes, France
[RESOLVED] PHP wont build on Lion

Quote:
Originally Posted by jazzbo View Post
Looking at your bug report it looks like when you configuring the compile you're giving the following argument:
Code:
--with-iconv-dir=/opt/local
The errors are with the iconv libraries, so the question is: did you compile iconv (for the x86_64 arch) in /opt/local?
Yes it was:- see below

Code:
[rich@eaurouge] (/opt/local/lib)> lipo -info libiconv.a
input file libiconv.a is not a fat file
Non-fat file: libiconv.a is architecture: x86_64
[rich@eaurouge] (/opt/local/lib)> file libiconv.2.dylib
libiconv.2.dylib: Mach-O 64-bit dynamically linked shared library x86_64
[rich@eaurouge] (/opt/local/lib)>
However this afternoon I had another crack at getting it to work so I removed the PHP source code directory, re-installed the PHP 5.3.8 source ran configure and noticed this in the resultant Makefile:-

Code:
MH_BUNDLE_FLAGS = -bundle -bundle_loader /usr/local/apache2/bin/httpd -L/usr/lib -laprutil-1 -lldap -llber -llber -lexpat -liconv -L/usr/lib -lpq -lsqlite3 -lldap -llber -llber -L/usr/lib -lapr-1 -lpthread
So editing that line to:-

Code:
MH_BUNDLE_FLAGS = -bundle -bundle_loader /usr/local/apache2/bin/httpd -L/opt/local/lib -laprutil-1 -lldap -llber -llber -lexpat -liconv -L/usr/lib -lpq -lsqlite3 -lldap -llber -llber -L/usr/lib -lapr-1 -lpthread
Made it all work! Other solutions I had found out there in googleland just advised moving the complete MH_BUNDLE_FLAGS macro to the end of the compile directive - this didn't work because it was still going to look for libiconv in /usr/lib...

Anyway many thanks to all who responded - I'll update the PHP bug report in case this fix can help others pulling their hair out over this issue.
rich06 is offline   0 Reply With Quote
Old Dec 1, 2011, 05:17 PM   #6
Madd the Sane
macrumors 6502
 
Join Date: Nov 2010
Location: Utah
Wirelessly posted (Mozilla/5.0 (iPod; CPU iPhone OS 5_0_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A405 Safari/7534.48.3)

It's worth noting that Apple does supply a version of iconv. Like all of Apple's supplied libraries and frameworks, it is a 32-bit 64-bit universal library. I don't know how it compares to other implementations of iconv, but it's there.
__________________
Get out of my mind, idea! I already have an idea in here!
Madd the Sane is offline   0 Reply With Quote
Old Dec 2, 2011, 12:54 AM   #7
rich06
Thread Starter
macrumors newbie
 
Join Date: Nov 2011
Location: Antibes, France
Quote:
Originally Posted by Madd the Sane View Post
Wirelessly posted (Mozilla/5.0 (iPod; CPU iPhone OS 5_0_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A405 Safari/7534.48.3)

It's worth noting that Apple does supply a version of iconv. Like all of Apple's supplied libraries and frameworks, it is a 32-bit 64-bit universal library. I don't know how it compares to other implementations of iconv, but it's there.
I presume that the Apple version is the one in /usr/lib? Well for some reason it has missing symbols compared to the version I got from Macports for the X86_64 architecture...
rich06 is offline   0 Reply With Quote
Old Dec 2, 2011, 02:30 PM   #8
Madd the Sane
macrumors 6502
 
Join Date: Nov 2010
Location: Utah
Actually, I think the /opt/local build headers of iconv added the prefix lib to some functions, because /usr/lib/libiconv.dylib doesn't have libiconv_open, but it does have iconv_open
__________________
Get out of my mind, idea! I already have an idea in here!
Madd the Sane is offline   0 Reply With Quote
Old Dec 2, 2011, 03:03 PM   #9
chown33
macrumors 603
 
Join Date: Aug 2009
Quote:
Originally Posted by rich06 View Post
Well for some reason it has missing symbols compared to the version I got from Macports for the X86_64 architecture...
What symbols are missing?

If the problem is only the "lib" prefix, easy to fix:
Code:
#define libiconv_open iconv_open
#define libiconv iconv
#define libiconv_close iconv_close
I assume you know enough C to figure out where to put those.
chown33 is offline   0 Reply With Quote
Old Dec 3, 2011, 06:05 PM   #10
rich06
Thread Starter
macrumors newbie
 
Join Date: Nov 2011
Location: Antibes, France
Quote:
Originally Posted by chown33 View Post
What symbols are missing?

If the problem is only the "lib" prefix, easy to fix:
Code:
#define libiconv_open iconv_open
#define libiconv iconv
#define libiconv_close iconv_close
I assume you know enough C to figure out where to put those.
Yea - I edited iconv.c along those lines -- it still failed to make tho'
rich06 is offline   0 Reply With Quote
Old Dec 3, 2011, 07:17 PM   #11
chown33
macrumors 603
 
Join Date: Aug 2009
Quote:
Originally Posted by rich06 View Post
Yea - I edited iconv.c along those lines -- it still failed to make tho'
If you're going to post "It failed", it's best to post the error messages of the failure. So we don't have to keep asking "Post the actual error messages".
chown33 is offline   0 Reply With Quote
Old Dec 3, 2011, 08:06 PM   #12
rich06
Thread Starter
macrumors newbie
 
Join Date: Nov 2011
Location: Antibes, France
Quote:
Originally Posted by chown33 View Post
If you're going to post "It failed", it's best to post the error messages of the failure. So we don't have to keep asking "Post the actual error messages".
Er.. actually I did post the make failure messages in my original post ...

BTW if you hadn't noticed this issue is resolved anyway - see my other earlier post above so I guess it is 'move along folks nothing to see here anymore...'
rich06 is offline   0 Reply With Quote
Old Dec 3, 2011, 10:37 PM   #13
chown33
macrumors 603
 
Join Date: Aug 2009
It wasn't clear that you were talking about the original failure.
chown33 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
[php] - php problems os x mountain lion 10.8.2 cakas6933 OS X 10.8 Mountain Lion 4 Jun 10, 2014 08:08 AM
Trying to upgrade the native PHP installation on Mountain Lion s97fever Mac Programming 0 Jan 22, 2013 05:26 PM
Help with xcode (cpp file wont build) Hydrocity Mac Programming 1 Oct 5, 2012 04:37 AM
new lion 10.7.5 build 11G45 tywebb13 Mac OS X 10.7 Lion 10 Aug 29, 2012 04:39 AM
using OSX build in PHP? baddj Mac OS X Server, Xserve, and Networking 3 Jul 1, 2012 11:38 AM

Forum Jump

All times are GMT -5. The time now is 02:03 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC