ID: 49267 Comment by: scruffylion at gmail dot com Reported By: s dot rost at ewerk dot com Status: No Feedback Bug Type: Compile Failure Operating System: Mac OSX 10.6 Snow Leopard PHP Version: 5.3, 6 (2009-08-18) Assigned To: scottmac New Comment:
Hi, I finally got it to work in multiple versions of PHP after alot of headbanging. I'm running snow leopard that was an upgrade and not a fresh install. I did NOT apply the iconv patch to any of the versions I tried this on. Also, specific to the compile of PHP, I ran everything literally as root. Not all steps are necessary I'm sure, but here's what I did: 1) Forcibly removed and reinstalled macports (had multiple versions of iconv after the upgrade to snow leopard, one de-activated, but this may not have done anything with regard to actually solving the iconv issue). 2) Compile iconv as static with configuration as follows: ./configure prefix=/usr/local enable-static (I used my own compilations of things such as iconv, mcrypt, ligjpeg, etc... all in /usr/local) 3) Configured PHP with iconv directive, and extra LIBS: env LIBS="-lresolv -liconv" ./configure --prefix=/usr/local/php \ --with-config-file-path=/usr/local/etc \ --with-apxs2=/usr/local/apache2/bin/apxs \ --with-openssl=shared,/opt/local \ --enable-cli \ --enable-mbstring \ --enable-exif \ --enable-sockets \ --with-mcrypt \ --with-zlib \ --with-zlib-dir=/usr/local \ --with-jpeg-dir=/usr/local \ --with-png-dir=/usr/local \ --with-freetype-dir=/usr/local \ --with-mysql=/usr/local/mysql \ --with-mysql-sock=/var/mysql/mysql.sock \ --enable-zip \ --with-iconv=/usr/local \ --with-curl 4) Edited the Makefile prior to compilation and changed the location of $(MH_BUNDLE_FLAGS) when called by the compiler. Changed this line: $(CC) $(MH_BUNDLE_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(PHP_GLOBAL_OBJS:.lo=.o) $(PHP_SAPI_OBJS:.lo=.o) $(PHP_FRAMEWORKS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@ && cp $@ libs/libphp$(PHP_MAJOR_VERSION).so To: $(CC) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(PHP_GLOBAL_OBJS:.lo=.o) $(PHP_SAPI_OBJS:.lo=.o) $(PHP_FRAMEWORKS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) $(MH_BUNDLE_FLAGS) -o $@ && cp $@ libs/libphp$(PHP_MAJOR_VERSION).so 5) Ran make. Finally, I got this to work with PHP versions: php-5.2.12 php-5.3.1 php5.3-201002242130 Final note: for php-5.2.12 and php-5.3.1 I actually messed up my mysql.sock location and decided to recompile php, and it failed on the first attempt. I then ran a "make clean", and re-configured and compiled and it workd on the second attempt. Frankly, I don't know why. But if it works for you then great! Previous Comments: ------------------------------------------------------------------------ [2010-02-16 00:21:24] lperry65 at gmail dot com I just tried to install 5.3.1 on os x 10.6.2 and had the following error: Undefined symbols: "_libiconv", referenced from: etc etc. Is this issue going to fixed anytime soon ? ------------------------------------------------------------------------ [2010-02-11 10:14:06] sj at sjaensch dot org The problem seems to be related to MacPorts, which often installs its own version of libiconv as dependency for several other ports. In my case, I'm using the MacPorts libpng, jpeg and freetype ports to compile PHP. Even though I specified --with-iconv-dir=/usr, it seems that the version in /opt/local gets picked up at the linking stage. The reason is that the linker command includes -L/opt/local/lib and -Wl,- rpath,/opt/local/lib. ------------------------------------------------------------------------ [2010-01-28 23:24:00] yux87 at hotmail dot com Okay, here's the result how I made it work against my environment and php version after a few times of failure in compiling: ------ Steps ------ 1. The only thing I tried to make it work was to hack the iconv.c as the patch above. ie. manually remove the #ifdef HAVE_LIBICONV, etc. lines. 2. Do a re-configure, re-make. ----- Result ----- ./configure --with-iconv-dir=/usr [Pass] ./make [Pass] ./make test [Okay, didn't notice any fail with iconv, not sure it's been tested though] ------ Configuration ------ Snow Leopard, with XCode. I did a fresh install rather than upgrade from the old 10.5 version, so I guess it could be the reason I didn't suffer the multiple iconv lib problem as some descriptions above. PHP version: 5.3.1 - 19 Nov 2009 release from the download page So I think the problem here is just some need to change the iconv.c code a bit. Hope this works for you, too. I also tried compiling with my macport iconv library(coz this'd be the actual one I'm going to use), there's no problem working with it too. ------------------------------------------------------------------------ [2010-01-03 11:48:35] iongion at yahoo dot com My system is a SNOW LEOPARD 10.6.2 I think we have a final solution. All these problems are generated because the Makefile is confused by the existence of multiple iconv library installations, but not only this. Fixing iconv (please note that these are pretty subjective, but they are a good start) Needed elements: 1) gettext - http://ftp.gnu.org/pub/gnu/gettext/gettext-0.17.tar.gz 2) iconv - http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz Unpack both libraries, before running configure, prepare your environment as follows: (i assume you have latest xcode) export MACOSX_DEPLOYMENT_TARGET=10.6; export CFLAGS="-arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp"; export CCFLAGS="-arch i386 -arch x86_64 -g -Os -pipe"; export CXXFLAGS="-arch i386 -arch x86_64 -g -Os -pipe" LDFLAGS="-arch i386 -arch x86_64 -bind_at_load" and then run configure in gettext, leave prefix as it is, make & make install; NOW, building iconv will replace existing iconv from apple(it shouldn't break anything) ./configure --prefix=/usr --enable-shared --enable-static then: make sudo make install This did it, what i managed to achieve: 1) Replace php 5.3.0 that comes with Snow Leopard, with php 5.3.1 2) Replace php 5.3.0 that comes with Snow Leopard, with php 5.2.12 Managed to install pecl extensions, apc, xdebug, uploadprogress, ming I am now on php 5.2.12 as i do drupal development and there are some module issues with php 5.3, but you could easily replace Snow Leo's php 5.3.0 with 5.3.1 and have your own pecl extensions/features enables Bellow are build scripts that i use to compile php 5.3.1 and php 5.2.12 1) 5.2.12 -> http://dpaste.com/hold/140511/ 2) 5.3.1 -> http://dpaste.com/hold/140512/ Good luck and hopefully php will get some better less confused build scripts. This the link that made me think and search more http://blog.yimingliu.com/2009/02/24/missing-library-symbols-while-compiling-php-528/ I have a little more than 0 knowledge of unix build tools, make, conf, gcc ... i am a php developer, excuse the non-initiated terms. ------------------------------------------------------------------------ [2010-01-02 13:41:56] iongion at yahoo dot com This is the output of make at its last step before throwing the hell http://dpaste.com/hold/140147/ ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/49267 -- Edit this bug report at http://bugs.php.net/?id=49267&edit=1