Thursday, 6 November 2008

iconv will not link when compiling PHP on OSX

When trying to compile PHP on OSX Leopard, the ./configure command completed successfully but iconv would not link....

Undefined symbols:
"_iconv_close", referenced from:
_php_iconv_string in iconv.o
_php_iconv_string in iconv.o
__php_iconv_strlen in iconv.o
__php_iconv_strpos 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_substr in iconv.o
_zif_iconv_substr in iconv.o
_php_iconv_stream_filter_dtor in iconv.o
_zif_iconv_mime_encode in iconv.o
_zif_iconv_mime_encode in iconv.o
"_iconv_open", referenced from:
_php_iconv_string in iconv.o
__php_iconv_strlen in iconv.o
__php_iconv_strpos in iconv.o
__php_iconv_mime_decode in iconv.o
__php_iconv_mime_decode in iconv.o
_zif_iconv_substr in iconv.o
_zif_iconv_substr 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
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1

I believe this is a problem with the default /usr/include/iconv.h header file in Leopard.

I have a different version of iconv.h installed with Fink which puts all it's software in /sw
I added the following to the ./configure command's options, as suggested here.

--with-iconv=shared,/sw


This would not work unless 'shared' is specified. Perhaps this is because Fink compile iconv as a shared library.

No comments: