PHP Bugs  
php.net | support | documentation | report a bug | advanced search | search howto | statistics | login

go to bug id or search bugs for  

Bug #43189 Fails to link iconv
Submitted:4 Nov 2007 11:33pm UTC Modified: 1 Jun 2009 9:20am UTC
From:meh at mailinator dot com Assigned to:
Status:Bogus Category:ICONV related
Version:5.*, 6CVS (2009-06-01) OS:Mac OS X 10.5
Votes:39 Avg. Score:4.3 ± 0.8 Reproduced:37 of 37 (100.0%)
Same Version:12 (32.4%) Same OS:37 (100.0%)
View/Vote Developer Edit Submission

[4 Nov 2007 11:33pm UTC] meh at mailinator dot com
Description:
------------
ld: warning, duplicate dylib /sw/lib/libssl.0.9.7.dylib
ld: warning, duplicate dylib /sw/lib/libcrypto.0.9.7.dylib
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

Reproduce code:
---------------
./configure --with-apxs2 --with-xsl --with-mysql=/sw --with-pdo
--with-pdo-mysql=/sw --with-zlib --without-pear --with-iconv=/sw

I've tried --with-iconv and --with-iconv=/usr as well. Configure
succeedes with any of these, but linker fails every time.

I have Fink installed:
/sw/lib/libiconv.2.4.0.dylib
/sw/lib/libiconv.2.dylib
/sw/lib/libiconv.dylib
/sw/lib/libiconv.la

Expected result:
----------------
Either configure should fail or linker should succeed.

Actual result:
--------------
Missing symbols...
[11 Nov 2007 6:53pm UTC] jani@php.net
How many iconv.h files do you have in your system? (search for *iconv*.h
:)
[18 Nov 2007 9:56pm UTC] scott at mydogateit dot com
This is an issue with Leopards iconv.h file (/usr/include/iconv.h).

Try this...

$ sudo mv /usr/include/iconv.h /usr/include/iconv.h.leo_orig
$ sudo ln -s /sw/include/iconv.h /usr/include/iconv.h

and try make again. (I did this using iconv from MacPorts, but I assume

the find dist will work just as well).
[22 Nov 2007 10:06pm UTC] msf at bitplan dot com
I have the same problem, even with a self compiled libiconv it does not

work.
[14 Dec 2007 3:45pm UTC] aaa at mailinator dot com
@jani:
there are one per OS X sdk, one in /usr and one in /sw.

Linking suggested by scott solves the problem on me.
[18 Dec 2007 8:45am UTC] leon at messiah dot co dot nz
Scott's method may work, but I'm loath to replace system provided header
files.  Seems a bit hacky to me...

Wouldn't a more elegant solution be to configure your build to use the
fink versions of the headers and library?

Something like:

--with-iconv-dir=/sw

I'm using MacPorts so have been trying to do the same thing but using
/opt/local, so far without success.  However, I'm probably doing
something wrong with the configure script (we're not the best of
friends).
[20 Jan 2008 7:59pm UTC] mariano at petersonpages dot com
This configure option worked for me:

--with-iconv=shared,/opt/local

(Mac OS 10.5.1, PHP 5.2.5, iconv installed in /opt/local using macports)
[3 Feb 2008 9:25am UTC] mjs at beebo dot org
Replacing /usr/include/iconv.h with the one from MacPorts and worked for

me.  (I did need to re-configure and re-compile the whole thing
though--
just re-running configure didn't work.)

For what it's worth, the --with-iconv=shared,/opt/local idea *didn't* 
work for me--php configured and built okay, but the iconv module didn't

actually become available.  (php -m doesn't show it.)
[12 Feb 2008 12:03am UTC] mjs at beebo dot org
This appears to be fixed in 10.5.2: the 10.5.2 /usr/include/iconv.h is 
different to the 10.5.1 version, and it compiles successfully as well.
[25 May 2008 3:30am UTC] joe at joeruwe dot com
this happened for me in 10.5.2 with php 5.2.6.

i had to compile everything with --without-iconv then reconfigure and 
remake with the --with-iconv flag..
[15 Oct 2008 9:19am UTC] safdf at mailinator dot com
I still have problem with this on 10.5.4. Could you please add a check
or workaround for this in configure script?
[23 Dec 2008 1:07pm UTC] aalamaki at gmail dot com
Seems to be the same issue on PHP 5.2.8 and 10.5.6, I've tried doing the
mac port with the --with-iconv=shared,/opt/local and it compiled but the
iconv didn't come available.

I also tried copying over the iconv.h from the macports to the
/usr/include but getting the errors mentioned in the first post, it will
not compile with that.

Anyone have experience with this issue on 10.5.6 ?
[27 Dec 2008 3:46pm UTC] wickedguitar6 at yahoo dot com
Same problem on 10.5.6
I had to compile twice:

First time: ./configure --with-apxs2
            make
               ----> just to get libphp5.so

Second time: ./configure --with-iconv=/opt/local etc.etc.
             make
             make install
               ----> compiles normally as long as we do not require the
apache2 module ("--with-apxs2") to be built.

Seems that the "--with-apxs2" directive confuses the linker and it
doesn't know which libiconv to use (i.e. the MacPorts one, or the native
MacOSX one).
[22 Feb 2009 12:26pm UTC] neilmsn at mac dot com
Odd I used the suggested --with-iconv=shared,/opt/local in the configure

and it's worked now BUT it's 5.2.8 installed.

I must have somehow mixed my directories up, so I don't know if PHP 5.3

fixed this error now.
[24 Mar 2009 1:51am UTC] scottmac@php.net
Could you do

./configure --disable-all --with-iconv --with-apxs2

And see if that causes an error? If not then can you slowly add in each
of your additional functions to see which one causes the error. We need
the simplest configure string possible.

Also can you upload your config.log from the failed build somewhere.
[26 Mar 2009 11:12pm UTC] chanleo1985 at gmail dot com
I used a self compiled libiconv downloaded from GNU.
setenv DYLD_LIBRARY_PATH to be my self compiled libiconv/lib

compiling it as static module does not work. I got the same linker error
as above. Configure passed but Make failed

But compiling it as dynamic module , using --with-iconv=shared, worked
for me. Configure passed and Make passed

Bare in mind that even if configure passed and make passed, iconv still
won't show up when you do php -m to list all the modules. You need to
set php.ini to enable it. Need to add the following lines

extension_dir = /location/of/iconv.so
extension=iconv.so
[26 Mar 2009 11:21pm UTC] scottmac@php.net
I need the config.log for the static build to try and work out whats
happening.
[27 Mar 2009 6:10am UTC] senz at senz dot su
To scottmac@php.net:
here's my config.log from compilation with error.
iconv compiled by macports. --with-iconv-dir=shared,/opt/local and
static both failed.
http://rapidshare.com/files/214033749/config.log.html
i also send a copy on your email.
[27 Mar 2009 6:26am UTC] senz at senz dot su
Changing --with-iconv-dir to --with-iconv=shared,/opt/local
solve it on my system.

/opt/local = macports with iconv
[24 Apr 2009 5:38pm UTC] richard dot sentino at mindginative dot com
This configure option worked for me:

--with-iconv=/opt/local

(Mac OS 10.5.6, PHP 5.2.9, iconv installed in /opt/local using
macports)

but it doesn't work with this configure option :

--with-iconv=shared,/opt/local

the configure passed and make passed but iconv won't show up when I do
php -m
[30 Apr 2009 1:03pm UTC] scottmac@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

[24 May 2009 3:54pm UTC] meh at mailinator dot com
It still fails for me in php5.3-200905241430.

This workaround still necessary:
sudo mv /usr/include/iconv.h /usr/include/iconv.h.leo_orig
sudo ln -s /sw/include/iconv.h /usr/include/iconv.h
rm ext/iconv/*.*o
make
[28 May 2009 4:42pm UTC] philip@php.net
For me, the following solution worked:

http://blog.yimingliu.com/2009/02/24/missing-library-symbols-while-
compiling-php-528/

Which involves moving around $(MH_BUNDLE_FLAGS). Looks like a different

yet related bug however, but ....
[1 Jun 2009 9:09am UTC] jani@php.net
Scott, apparently your fix didn't help?
[1 Jun 2009 9:13am UTC] jani@php.net
Just an idea: How about you remove the extra installations of the 
libraries and only use ONE at the time? Or tune your library paths to be

correct..
[1 Jun 2009 9:14am UTC] jani@php.net
And please don't reopen old bugs like this, now there were 2 reports for

same issue..
[1 Jun 2009 9:20am UTC] jani@php.net
See bug #48195

RSS feed | show source 

PHP Copyright © 2001-2009 The PHP Group
All rights reserved.
Last updated: Sat Nov 21 10:30:49 2009 UTC