I'm trying to compile PHP and I kept getting this error during make:
Undefined symbols for architecture x86_64:
"_iconv_open", referenced from:
__php_iconv_mime_decode in iconv.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_mime_encode in iconv.o
_php_iconv_stream_filter_factory_create in iconv.o
...
"_iconv_close", referenced from:
__php_iconv_mime_decode in iconv.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_mime_encode in iconv.o
_php_iconv_stream_filter_dtor in iconv.o
...
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
The ./configure command of PHP has the iconv folder pointing to /opt/local, so the macport iconv library is used (which is installed using the the +universal flag). Doing file I get:
/opt/local/lib/libiconv.dylib: Mach-O universal binary with 2 architectures
/opt/local/lib/libiconv.dylib (for architecture i386): Mach-O dynamically linked shared library i386
/opt/local/lib/libiconv.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
I tried then install the iconv library manually, forcing only the 64-bit architecture (I installed it in /usr/local) and it works. The output of file is:
/usr/local/lib/libiconv.dylib: Mach-O 64-bit dynamically linked shared library x86_64
Why is this happening? I manage to build and make PHP work with the manual installation, but I don't understand.
