Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am setting up PHP on my local web server with iconv, which should be there by default, but I am getting the following error:

Undefined symbols for architecture x86_64:
  "_iconv", referenced from:
      __php_iconv_strlen in iconv.o
      _php_iconv_string in iconv.o
      __php_iconv_strpos in iconv.o
      __php_iconv_appendl in iconv.o
      _zif_iconv_substr in iconv.o
      _zif_iconv_mime_encode in iconv.o
      _php_iconv_stream_filter_append_bucket in iconv.o
     (maybe you meant: _zif_iconv_strlen, _zif_iconv_strpos , _zif_iconv_mime_decode , _php_iconv_string , _zif_iconv_set_encoding , _zif_iconv_get_encoding , _zif_iconv_mime_decode_headers , _iconv_functions , _zif_iconv_mime_encode , _zif_iconv_strrpos , _iconv_module_entry , _iconv_globals , _zif_iconv_substr , _php_if_iconv , _zif_ob_iconv_handler )
ld: symbol(s) not found for architecture x86_64

Now, presumably this means that my iconv is not 64 bit. I tried to download libiconv and manually reinstall it with 64 bit, as such:

CFLAGS='-arch i386 -arch ppc -arch ppc64 -arch x86_64' CCFLAGS='-arch i386 -arch ppc -arch ppc64 -arch x86_64' CXXFLAGS='-arch i386 -arch ppc -arch ppc64 -arch x86_64' ./configure

But I get the following error:

configure: error: in `/Users/jason/Downloads/libiconv-1.13.1':
configure: error: C compiler cannot create executables
See `config.log' for more details.

In my config.lob file, it says at the bottom:

configure: exit 77

Any suggestions?

share|improve this question
Actually libiconv should be 64 bit if you are using the system one. You can check with file /usr/lib/libiconv.dylib –  dog Apr 8 '11 at 22:07
Thanks - the output is: /usr/lib/libiconv.dylib: Mach-O universal binary with 3 architectures /usr/lib/libiconv.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/libiconv.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/libiconv.dylib (for architecture ppc7400): Mach-O dynamically linked shared library ppc –  Jason Apr 8 '11 at 22:28
This looks like I actually do have 64-bit iconv –  Jason Apr 8 '11 at 22:29
However, I'm still getting this error... –  Jason Apr 8 '11 at 22:38
looks like your library is compiled as a fat binary (i386 and x86_64) there is a way you can tell it to be only - look at com.apple.versioner and if possible configure it only for the arch you need. –  silviud Apr 9 '11 at 0:36
add comment

closed as off-topic by devicenull, Ward, warren, RolandoMySQLDBA, Katherine Villyard Apr 6 at 15:26

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must be relevant to professional system administration. Server Fault is dedicated to professional system and network administrators. End user and enthusiast questions are off-topic (contact your system administrator or hire a professional to help you out). Please see the Help Center for more information." – devicenull, Ward, warren, RolandoMySQLDBA, Katherine Villyard
If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

I've had exactly the same problem on OS X 10.7, i.e. couldn't compile PHP due to the libiconv x86_64 errors, but have solved it as follows:

Build an x86_64-only version of libiconv:

CFLAGS='-arch x86_64' CCFLAGS='-arch x86_64' CXXFLAGS='-arch x86_64' ./configure
sudo make install

This will put the compiled files in /usr/local/lib

Then run ./configure in the PHP source directory, then 'make'

When you get the error with iconv, copy the last gcc command (the one that failed), change the start to:

gcc -bundle -bundle_loader /usr/sbin/httpd -L/usr/local/lib

so it's pointing to the 64-bit-only version. Then paste the new command and run 'make' again and it works (at least did for me).

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.