Edit report at http://bugs.php.net/bug.php?id=49267&edit=1

 ID:               49267
 Updated by:       j...@php.net
 Reported by:      s dot rost at ewerk dot com
 Summary:          Linking fails for iconv: "Undefined symbols:
                   _libiconv"
-Status:           No Feedback
+Status:           Closed
 Type:             Bug
 Package:          Compile Failure
 Operating System: Mac OSX 10.6 Snow Leopard
 PHP Version:      5.3, 6 (2009-08-18)
 Assigned To:      scottmac



Previous Comments:
------------------------------------------------------------------------
[2010-03-05 10:12:15] moriyo...@php.net

Automatic comment from SVN on behalf of moriyoshi
Revision: http://svn.php.net/viewvc/?view=revision&revision=295848
Log: - Fixed bug #49267 (linking fails for iconv)

------------------------------------------------------------------------
[2010-02-25 20:15:29] scruffylion at gmail dot com

Hi, I finally got it to work in multiple versions of PHP after alot of
headbanging.  I'm running snow leopard that was an upgrade and not a
fresh install. 



I did NOT apply the iconv patch to any of the versions I tried this on. 
Also, specific to the compile of PHP, I ran everything literally as
root.



Not all steps are necessary I'm sure, but here's what I did:



1) Forcibly removed and reinstalled macports (had multiple versions of
iconv after the upgrade to snow leopard, one de-activated, but this may
not have done anything with regard to actually solving the iconv
issue).



2) Compile iconv as static with configuration as follows: 

./configure –prefix=/usr/local –enable-static

(I used my own compilations of things such as iconv, mcrypt, ligjpeg,
etc... all in /usr/local) 



3) Configured PHP with iconv directive, and extra LIBS:

env LIBS="-lresolv -liconv" ./configure --prefix=/usr/local/php \

--with-config-file-path=/usr/local/etc \

--with-apxs2=/usr/local/apache2/bin/apxs \

--with-openssl=shared,/opt/local \

--enable-cli \

--enable-mbstring \

--enable-exif \

--enable-sockets \

--with-mcrypt \

--with-zlib \

--with-zlib-dir=/usr/local \

--with-jpeg-dir=/usr/local \

--with-png-dir=/usr/local \

--with-freetype-dir=/usr/local \

--with-mysql=/usr/local/mysql \

--with-mysql-sock=/var/mysql/mysql.sock \

--enable-zip \

--with-iconv=/usr/local \

--with-curl



4) Edited the Makefile prior to compilation and changed the location of
$(MH_BUNDLE_FLAGS) when called by the compiler.



Changed this line:

$(CC) $(MH_BUNDLE_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS)
$(EXTRA_LDFLAGS) $(PHP_GLOBAL_OBJS:.lo=.o) $(PHP_SAPI_OBJS:.lo=.o)
$(PHP_FRAMEWORKS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@ && cp $@
libs/libphp$(PHP_MAJOR_VERSION).so



To:

$(CC) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS)
$(PHP_GLOBAL_OBJS:.lo=.o) $(PHP_SAPI_OBJS:.lo=.o) $(PHP_FRAMEWORKS)
$(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) $(MH_BUNDLE_FLAGS) -o $@ && cp $@
libs/libphp$(PHP_MAJOR_VERSION).so



5) Ran make.



Finally, I got this to work with PHP versions:

php-5.2.12

php-5.3.1

php5.3-201002242130



Final note:  for php-5.2.12 and php-5.3.1 I actually messed up my
mysql.sock location and decided to recompile php, and it failed on the
first attempt.  I then ran a "make clean", and re-configured and
compiled and it workd on the second attempt.  Frankly, I don't know why.
 But if it works for you then great!

------------------------------------------------------------------------
[2010-02-16 00:21:24] lperry65 at gmail dot com

I just tried to install 5.3.1 on os x 10.6.2 and had the following 

error:



Undefined symbols:   "_libiconv", referenced from: etc etc.



Is this issue going to fixed anytime soon ?

------------------------------------------------------------------------
[2010-02-11 10:14:06] sj at sjaensch dot org

The problem seems to be related to MacPorts, which often installs its 

own version of libiconv as dependency for several other ports. In my 

case, I'm using the MacPorts libpng, jpeg and freetype ports to compile


PHP. Even though I specified --with-iconv-dir=/usr, it seems that the 

version in /opt/local gets picked up at the linking stage. The reason is


that the linker command includes -L/opt/local/lib and -Wl,-

rpath,/opt/local/lib.

------------------------------------------------------------------------
[2010-01-28 23:24:00] yux87 at hotmail dot com

Okay, here's the result how I made it work against my environment and
php version after a few times of failure in compiling:



------

Steps

------

1. The only thing I tried to make it work was to hack the iconv.c as the
patch above. ie. manually remove the #ifdef HAVE_LIBICONV, etc. lines.

2. Do a re-configure, re-make. 



-----

Result

-----

./configure --with-iconv-dir=/usr  [Pass]

./make  [Pass]

./make test [Okay, didn't notice any fail with iconv, not sure it's been
tested though]



------

Configuration

------

Snow Leopard, with XCode. I did a fresh install rather than upgrade from
the old 10.5 version, so I guess it could be the reason I didn't suffer
the multiple iconv lib problem as some descriptions above.



PHP version: 5.3.1 - 19 Nov 2009 release from the download page



So I think the problem here is just some need to change the iconv.c code
a bit. Hope this works for you, too. I also tried compiling with my
macport iconv library(coz this'd be the actual one I'm going to use),
there's no problem working with it too.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    http://bugs.php.net/bug.php?id=49267


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=49267&edit=1

Reply via email to