|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44294 Undefined symbols with libxml2
Submitted: 2008-02-29 16:32 UTC Modified: 2009-07-17 01:00 UTC
Avg. Score:4.2 ± 0.9
Reproduced:14 of 14 (100.0%)
Same Version:10 (71.4%)
Same OS:8 (57.1%)
From: danval at gmail dot com Assigned: fb-req-jani (profile)
Status: No Feedback Package: Compile Failure
PHP Version: 5.*, 6CVS (2009-07-09) OS: Mac 10.5 Leopard Client
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2008-02-29 16:32 UTC] danval at gmail dot com
Installation warning error when compiling php 5

Reproduce code:
configuration used with compiled extensions

./configure \
--prefix=/Apache/php \
--with-libxml-dir=/Apache/local/libxml \
--with-zlib-dir=/Apache/local/zlib \
--with-zlib \
--with-curl=/Apache/local/curl \
--with-jpeg-dir=/Apache/local/gd \
--with-png-dir=/Apache/local/gd \
--with-gd \
--with-mcrypt=/Apache/local/mcrypt \
--with-mhash=/Apache/local/mhash \
--with-mysql=/usr/local/mysql \
--with-mysql-sock=/usr/local/mysql/run \
--with-apxs2=/Apache/bin/apxs \
--enable-soap \
--enable-sockets \
--enable-shared \
--enable-cli \
--enable-exif \
--enable-ftp \
--enable-mbstring \
--enable-mbregex \

Expected result:
successful sudo make

Actual result:
Last few lines after 'sudo make'

sapi/apache2handler/apache_config.o sapi/apache2handler/php_functions.o main/internal_functions.o  -lmysqlclient -lmhash -lmcrypt -lltdl -liconv -lpng -lz -ljpeg -lcurl -lz -lm -lxml2 -lz -liconv -lm -lcurl -lssl -lcrypto -lldap -lz -lxml2 -lz -liconv -lm -lxml2 -lz -liconv -lm -lxml2 -lz -liconv -lm -lxml2 -lz -liconv -lm -lxml2 -lz -liconv -lm -lxml2 -lz -liconv -lm  -o libs/libphp5.bundle && cp libs/libphp5.bundle libs/
Undefined symbols:
  "_xmlTextReaderSchemaValidate", referenced from:
      _zim_xmlreader_setSchema in php_xmlreader.o
  "_xmlTextReaderSetup", referenced from:
      _zim_xmlreader_XML in php_xmlreader.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [libs/libphp5.bundle] Error 1


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-01 08:28 UTC] danval at gmail dot com
Seems it was the way i configured libxml2? this was my setting

./configure --prefix=/Apache/local/libxml \
--enable-shared \

do you see how it would generate that error? is this zlib directory the same as the one configured in php? 

I was able to use a binary version of libxml2 when i configured php to successfully build.
 [2008-03-03 13:02 UTC]
Check that your installed libxml2 is clean, ie. you don't have messed up the headers vs. libraries when installing it. It happens when if you install it from sources and don't remove the existing installation first. Most likely this is just a messed up installation of libxml2 so the easiest way to solve it is first removing all instances of any libxml2 related files from your system and reinstalling it from scratch, then do the same for PHP. (use _fresh_ sources!)
 [2008-08-03 16:21 UTC] whisller at gmail dot com
I also have this same problem on Leopard.
But solution which you wrote, "remove all instances of libxml from your system" can only crash Leopard ( - see comments ).

My "sudo make" also return this same error like in danval situation.
 [2009-05-08 18:43 UTC] rdohms at gmail dot com
Compiling libxml2 from source solved this for me
 [2009-05-26 01:03 UTC]
The problem is described here:

The provided solution (editing Makefile) worked for me.
 [2009-06-19 12:49 UTC] rdohms at gmail dot com
Tried recompiling PHP again some time after doing it with the fresh libxml2 install, and it no longer works, breaking with the same error as above.

Also tried the Makefile editing and it still gives me tehe same errors.
Tried with PHP 5.3.0RC2 and HEAD
 [2009-06-19 14:28 UTC] rdohms at gmail dot com

Phillips solution points to the right direction. The changes in the Makefile did not work for me, seems there was more then one point to it.

The solution came down to adding -L/path/to/lib in front of all the commands that generate the broken message reported above.

I then ran these commands (2 in my case, for and the cli) by hand and ran make again, so it pickedup from where it had stopped.

This worked for me in 5.3RC2 and HEAD. 

PS: you need to include "lib"in the --with-libxml-dir and in these paths above
 [2009-06-22 11:04 UTC]
Does it work, if you write


in your ./configure call?

It works for me at least ...
 [2009-06-22 13:31 UTC] rdohms at gmail dot com

My ./configure had that and it pointed to /opt/xml/lib .. this only stopped the error for the CLI compile.. not the command. On that one i still had to add the -L directive stated above
 [2009-06-22 13:49 UTC] rdohms at gmail dot com
actualy sorry.

I had --with-libxml-dir declared.
Tried running it with --enable-xmlreader-/opt/xml/lib, just like the above setting and it broke on the same place as before.
 [2009-07-09 20:41 UTC]
Remove the /lib from those paths. "rdohms at gmail dot com":  Where did 
you get the idea it's okay to pass that anywhere?!
 [2009-07-09 20:43 UTC]
And if you change the version, add a note about it. Now there's no way 
to know what version you reported this with, what version it works 
 [2009-07-17 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2009-07-18 23:20 UTC] rdohms at gmail dot com

Adding /lib was the only way i got it working.. otherwise it skipped those dirs and kep hamerring /usr/lib which is the next in line, like here:

cc -bundle -bundle_loader /Applications/Server/Apache2/bin/httpd  -L/usr/lib -L/usr/lib -laprutil-1...

What i have been doing to compile succesfully is altering to this

cc -bundle -bundle_loader /Applications/Server/Apache2/bin/httpd -L/opt/xml/lib -L/opt/local/lib -L/usr/lib -L/usr/lib -laprutil-1...

This was gwyne's suggestion and it works great.

After I enabled OpenSSL i got evem more of these, hence the /opt/local/lib i also placed there.

As for versions, i have reproduced these today on:
PHP_5_3, PHP_5_2 and trunk, straight from SVN

I'm rdohms on php.pecl if you want to chat about this
 [2012-03-20 20:09 UTC] jmlane at gmail dot com
Issue still exists in 5.x trunk from SVN.

The solution is simple: in the Makefile, on the line where "libs/libphp$(PHP_MAJOR_VERSION).bundle:" appears, the $(MH_BUNDLE_FLAGS) variable should be called after "$(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS)" so that the hard-coded "/usr/lib" search path is searched after any user-provided search paths given during configure.

For example, the Makefile currently contains this passage:

"MH_BUNDLE_FLAGS = -bundle -bundle_loader /usr/sbin/httpd -L/usr/lib -L/usr/lib -laprutil-1 -lsqlite3 -lexpat -liconv -L/usr/lib -lapr-1 -lpthread"

...which sets library search paths as '/usr/lib'.

Further below:


...demonstrates that the '-L/usr/lib' from $MH_BUNDLE_FLAGS is given priority and will be searched before the '-L/custom/paths' contained in the variables immediately following it. This is likely not the intended behaviour, since it circumvents the user's intentions when passing library search paths to the configure script.

What should be found in the Makefile—which will resolve this issue—is the following:


Can anyone with autotools and PHP build process familiarity comment on any possible repercussions from this minor and logical change?
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Thu Jul 19 19:01:25 2018 UTC