2

I'm trying to compile php 5.6 on OsX Mavericks but in the middle of linking process I am receiving this error and do not know what to do with it.

Undefined symbols for architecture x86_64:
"_libiconv", referenced from:
  _do_convert in gdkanji.o
  _zif_iconv_substr in iconv.o
  _zif_iconv_mime_encode in iconv.o
  _php_iconv_string in iconv.o
  __php_iconv_strlen in iconv.o
  __php_iconv_strpos in iconv.o
  _php_iconv_stream_filter_append_bucket in iconv.o
  ...
"_libiconv_close", referenced from:
  _do_convert in gdkanji.o
  _convert in encodings.o
"_libiconv_open", referenced from:
  _do_convert in gdkanji.o
  _convert in encodings.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libs/libphp5.bundle] Error 1

This is my configure options:

sudo ./configure --prefix=/opt/local \
--mandir=/usr/share/man \
--enable-maintainer-zts \
--infodir=/usr/share/info \
--sysconfdir=/private/etc \
--with-apxs2=/usr/sbin/apxs \
--enable-cli \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/Library/Server/Web/Config/php \
--with-libxml-dir=/usr \
--with-openssl=/usr \
--with-kerberos=/usr \
--with-zlib=/usr \
--enable-bcmath \
--with-bz2=/usr \
--enable-calendar \
--disable-cgi \
--with-curl=/usr \
--enable-dba \
--enable-exif \
--enable-fpm \
--enable-ftp \
--with-gd \
--with-freetype-dir=/BinaryCache/apache_mod_php/apache_mod_php-87.2~1/Root/usr/local \
--with-jpeg-dir=/BinaryCache/apache_mod_php/apache_mod_php-87.2~1/Root/usr/local \
--with-png-dir=/BinaryCache/apache_mod_php/apache_mod_php-87.2~1/Root/usr/local \
--enable-gd-native-ttf \
--with-icu-dir=/usr \
--with-ldap=/usr \
--with-ldap-sasl=/usr \
--with-libedit=/usr \
--enable-mbstring \
--enable-mbregex \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pear \
--with-pdo-mysql=mysqlnd \
--with-mysql-sock=/var/mysql/mysql.sock \
--with-readline=/usr \
--enable-shmop \
--with-snmp=/usr 
--enable-soap \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--with-tidy \
--enable-wddx\ 
--with-xmlrpc \
--with-iconv-dir=/usr \
--with-xsl=/usr \
--enable-zip \
--with-pcre-regex=/opt/local \
--with-vpx-dir=/usr/local/Cellar \
--with-xpm-dir=no

Any help determining the issue would be greatly appreciated. I have tried rebuilding libiconv with no success in fixing the issue. The backslashes on my configure options was put there to break up the really long line of options to make it more readable here so please dont correct me on that in the case that you think that might be the issue. Thanks in advance.

pogeybait
  • 3,065
  • 2
  • 21
  • 23
  • 1
    Why did you add all the `--with-…-dir options` to `./configure`? Usually it will determine the paths itself. Have you tried removing the `--with-iconv-dir` line? Or setting a different value? Have you run `make install` after compiling libiconv? – lxg Sep 07 '14 at 22:59
  • Thanks for responding. I had to add the --with-..-dir options because the compiler wasnt able to find them on its own. I will try the iconv dir option although it doesn't appear that it isn't having trouble finding iconv, but rather that the x86_64 symbols are missing. That's confusing to me because libiconv was compiled with the +universal option which included the 64 bit symbols. I did not run the make install because the make failed. – pogeybait Sep 07 '14 at 23:05
  • Ok, but if the `make` failed, then you did, in fact, *not* recompile libiconv, right? – lxg Sep 07 '14 at 23:11
  • Using macports, I uninstalled libiconv and reinstalled it just to make sure. macports was able to recompile and install everything just fine. However, the php5.6 build is failing. That is where Im getting the error I posted. Not with libiconv – pogeybait Sep 07 '14 at 23:22
  • Does this help: http://superuser.com/questions/394219/compiling-php-on-os-x-iconv-works-only-if-forced-to-64-bit – lxg Sep 07 '14 at 23:26
  • I found this because I'm experiencing a similar problem except that I'm building PHP 5.5.16 on Yosemite & my error relates to PCRE. To lxg's question about `--with-…-dir options` in `./configure` I have those because my starting point is the Apple build as discovered using `php -i`. My objective is to be as close as possible to the Apple build but with the options I need added & a fully supported version of PHP (Yosemite currently used the unsupported PHP 5.5.14), – Pedro Sep 08 '14 at 02:44
  • I am in the same boat as Pedro and did use the php -i command to get my config string as to keep the same libraries installed. lxg, I did try your suggestion but am still getting the same error message. It appears that I now have 3 different iconv libraries installed, one by apple in /usr/local/lib , one by macports installed in /opt/local/lib, and now my latest attempt with one installed by homebrew in /usr/local/Cellar. I backed up the other copies (libiconv.dylib) as suggested in the article posted by lxg but am still getting errors even though i have an x64 version only installed via brew – pogeybait Sep 08 '14 at 08:29
  • Update: I tried having it use the homebrew version and specified the --with-iconv-dir=/usr/local/Cellar and then backed up and removed the libraries in the /usr/local/lib folder. When I ran the php configure again it complained iconv was missing. So it seems that the only version it cares about is the one in the /usr/local/lib folder. This is strange. There are no soft links pointing to another folder. I tried soft linking the files in the /usr/local/lib to the homebrew version which is the 64bit only and it still fails. Im at my wits end on this one. Anyone? – pogeybait Sep 08 '14 at 11:33
  • @pogeybait At the risk of it being now irrelevant: you may need it to be `--with-iconv-dir=/usr/local/Cellar/somesubdir` and not merely `--with-iconv-dir=/usr/local/Cellar` – Andrea Feb 03 '15 at 00:59

0 Answers0