Incompatibility of iconv for PHP 5.2.13 under Mac OS X

I'm confused with this when I compiled 5.2.13 of PHP under Mac OS X Snow Leopard. I did update by downloading and compiling a new version of iconv at http://www.gnu.org/software/libiconv/ and compile it by running
./configure --prefix=/usr/local
When I compile PHP with the following "configure" params as
CFLAGS="-arch x86_64 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch x86_64 -g -Os -pipe" CXXFLAGS="-arch x86_64 -g -Os -pipe" LDFLAGS="-arch x86_64 -bind_at_load" ./configure  --prefix=/opt/local --mandir=/usr/share/man --infodir=/usr/share/info --with-config-file-path=/etc/ --enable-bcmath --enable-ctype --enable-dom --enable-fileinfo --enable-filter --enable-hash --enable-json --enable-libxml --enable-pdo --enable-phar --enable-session --enable-simplexml --enable-tokenizer --enable-xml --enable-xmlreader --enable-xmlwriter --with-bz2=/opt/local --with-mhash=/opt/local --with-pcre-regex=/opt/local --with-readline=/opt/local --with-libxml-dir=/opt/local --with-zlib=/opt/local --disable-cgi --with-ldap=/opt/local --with-apxs2=/usr/sbin/apxs --with-mysqli=/opt/local/lib/mysql/bin/mysql_config --with-openssl --with-mcrypt=/opt/local/ --with-mysql=/opt/local/lib/mysql/ --with-curl=/opt/local --enable-mbstring --with-gd --with-jpeg-dir=/opt/local --with-png-dir=/opt/local --with-freetype-dir=/opt/local --with-t1lib=/opt/local --enable-gd-native-ttf --with-ttf=/opt/local --with-pgsql=/usr/local/pgsql/ --with-iconv=/usr/local 
And when I run "make" I do got these errors,

Undefined symbols:
  "_libiconv_open", referenced from:
      _do_convert in gdkanji.o
      __php_iconv_strlen in iconv.o
      _php_iconv_string in iconv.o
      __php_iconv_strpos in iconv.o
      _zif_iconv_substr in iconv.o
      _zif_iconv_substr in iconv.o
      __php_iconv_mime_decode in iconv.o
      __php_iconv_mime_decode in iconv.o
      _zif_iconv_mime_encode in iconv.o
      _zif_iconv_mime_encode in iconv.o
      _php_iconv_stream_filter_factory_create in iconv.o
  "_libiconv", referenced from:
      _do_convert in gdkanji.o
      __php_iconv_strlen in iconv.o
      _php_iconv_string in iconv.o
      _php_iconv_string in iconv.o
      __php_iconv_strpos in iconv.o
      __php_iconv_appendl in iconv.o
      __php_iconv_appendl in iconv.o
      _zif_iconv_substr in iconv.o
      _zif_iconv_mime_encode in iconv.o
      _zif_iconv_mime_encode in iconv.o
      _zif_iconv_mime_encode in iconv.o
      _zif_iconv_mime_encode in iconv.o
      _zif_iconv_mime_encode in iconv.o
      _zif_iconv_mime_encode in iconv.o
      _php_iconv_stream_filter_append_bucket in iconv.o
      _php_iconv_stream_filter_append_bucket in iconv.o
     (maybe you meant: __libiconv_version)
  "_libiconv_close", referenced from:
      _do_convert in gdkanji.o
      __php_iconv_strlen in iconv.o
      _php_iconv_string in iconv.o
      _php_iconv_string in iconv.o
      __php_iconv_strpos in iconv.o
      _zif_iconv_substr in iconv.o
      _zif_iconv_substr in iconv.o
      _php_iconv_stream_filter_dtor in iconv.o
      __php_iconv_mime_decode in iconv.o
      __php_iconv_mime_decode in iconv.o
      __php_iconv_mime_decode in iconv.o
      _zif_iconv_mime_encode in iconv.o
      _zif_iconv_mime_encode in iconv.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [libs/libphp5.bundle] Error 1
 I guess this is a bug from PHP in which it only base for the libiconv library under /usr/lib directory, and my fix for this is by copying the libiconv I have recently compiled from /usr/local/lib/ with the current one, which is the /usr/lib/libiconv.* files.
So I did,

cd /usr/lib
mkdir iconv_backup
mv libiconv.* iconv_backup
cp -rf /usr/local/lib/libiconv.* .
cp -rf iconv_backup/* /usr/local/lib/
Now, running make compiles the source code of PHP successfully.

Caveat for this, my purpose of switching the libiconv files is because I have Adium and Adium isn't compliant with the libiconv in which I have recently compiled as x86_64 architecture or 64 bit, so having them under /usr/lib/iconv_backup, I run Adium thru terminal by /Applications/Adium.app/Contents/MacOS/Adium and it works good now.

Hope this helps!

Comments

Anonymous said…
an oldish article but very helpful. MY HERO!
Anonymous said…
This article kills my Mac. Thanx.

Popular posts from this blog

Using Oracle 11g thru VirtualBox appliance in Mac OS X Lion

Use Shell Editor for Eclipse for editing bash, ksh, csh in Unix/Linux system

LVM: How to remove a volume using pvremove