php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64258 --with-mcrypt causes bad linking (with --with-libxml-dir). Reason: -lltdl flag
Submitted: 2013-02-21 00:01 UTC Modified: 2017-10-24 08:01 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: spamik at yum dot pl Assigned: derick (profile)
Status: Wont fix Package: *Compile Issues
PHP Version: 5.4.16 OS:
Private report: No CVE-ID: None
 [2013-02-21 00:01 UTC] spamik at yum dot pl
Description:
------------
<?php
$xml = new XMLReader();
$xmldata = '<TestOne><tag>data</tag><tag>data</tag></TestOne>';
$xml->XML($xmldata);
?>

php 5.4.11 compiled with libxml2 2.9.0

/usr/bin/php: symbol lookup error: /usr/bin/php: undefined symbol: 
xmlTextReaderSetup

It works when php is compiled against libxml2 2.6.26 
XMLReader is not compatibile with new libxml2 version.


Patches

mcrypt-config-20130613 (last revision 2013-06-13 08:56 UTC by derick@php.net)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-02-21 15:33 UTC] remi@php.net
Cannot reproduce.

php 5.4.11 and 5.4.12 build against libxml2 and work as expected.
 [2013-02-22 00:28 UTC] spamik at yum dot pl
I've tested with ONLY --with-libxml-dir=/usr/libxml2-2.9.0 and it does work. Some 
other extension (on my normal configure) must be interfering. I will try to 
determine which one with trial and error and soon let you know.
 [2013-02-22 01:23 UTC] spamik at yum dot pl
>>Problem appears when compiling with mcrypt and extension (and libxml2 2.9)<<

Package libmcrypt-devel-2.5.8-4.el5.centos.x86_64 already installed and latest 
version
./configure '--prefix' '/usr/share/php-5.3.21' --with-libxml-dir=/usr/libxml2-
2.9.0/ '--with-mcrypt
make install
<?php
$xml = new XMLReader();
$xmldata = '<TestOne><tag>data</tag><tag>data</tag></TestOne>';
$xml->XML($xmldata);
?>
/usr/bin/php: symbol lookup error: /usr/bin/php: undefined symbol: 
xmlTextReaderSetup

I've also tried compiling libmcrypt from source - no changes.

./configure --prefix=/usr/libmcrypt-2.5.8 --disable-posix-threads
make install
./configure '--prefix' '/usr/share/php-5.3.21' --with-libxml-dir=/usr/libxml2-
2.9.0/ '--with-mcrypt=/usr/libmcrypt-2.5.8'  

sill does not work (it works with libxml2 2.6.x for some reason)
 [2013-02-22 01:38 UTC] spamik at yum dot pl
also during make install (php) i see

./configure '--prefix' '/usr/share/php-5.3.21' --with-libxml-dir=/usr/libxml2-
2.9.0/ '--with-mcrypt
make install

/root/naox/php-5.3.21/sapi/cli/php: /usr/lib64/libxml2.so.2: no version 
information available (required by /root/naox/php-5.3.21/sapi/cli/php)
/root/naox/php-5.3.21/sapi/cli/php: /usr/lib64/libxml2.so.2: no version 
information available (required by /root/naox/php-5.3.21/sapi/cli/php)
/root/naox/php-5.3.21/sapi/cli/php: /usr/lib64/libxml2.so.2: no version 
information available (required by /root/naox/php-5.3.21/sapi/cli/php)
/root/naox/php-5.3.21/sapi/cli/php: /usr/lib64/libxml2.so.2: no version 
information available (required by /root/naox/php-5.3.21/sapi/cli/php)
/root/naox/php-5.3.21/sapi/cli/php: /usr/lib64/libxml2.so.2: no version 
information available (required by /root/naox/php-5.3.21/sapi/cli/php)
/root/naox/php-5.3.21/sapi/cli/php: /usr/lib64/libxml2.so.2: no version 
information available (required by /root/naox/php-5.3.21/sapi/cli/php)
/root/naox/php-5.3.21/sapi/cli/php: /usr/lib64/libxml2.so.2: no version 
information available (required by /root/naox/php-5.3.21/sapi/cli/php)
/root/naox/php-5.3.21/sapi/cli/php: /usr/lib64/libxml2.so.2: no version 
information available (required by /root/naox/php-5.3.21/sapi/cli/php)
/root/naox/php-5.3.21/sapi/cli/php: /usr/lib64/libxml2.so.2: no version 
information available (required by /root/naox/php-5.3.21/sapi/cli/php)
/root/naox/php-5.3.21/sapi/cli/php: /usr/lib64/libxml2.so.2: no version 
information available (required by /root/naox/php-5.3.21/sapi/cli/php)
/root/naox/php-5.3.21/sapi/cli/php: /usr/lib64/libxml2.so.2: no version 
information available (required by /root/naox/php-5.3.21/sapi/cli/php)
/root/naox/php-5.3.21/sapi/cli/php: /usr/lib64/libxml2.so.2: no version 
information available (required by /root/naox/php-5.3.21/sapi/cli/php)
/root/naox/php-5.3.21/sapi/cli/php: /usr/lib64/libxml2.so.2: no version 
information available (required by /root/naox/php-5.3.21/sapi/cli/php)
/root/naox/php-5.3.21/sapi/cli/php: /usr/lib64/libxml2.so.2: no version 
information available (required by /root/naox/php-5.3.21/sapi/cli/php)
/root/naox/php-5.3.21/sapi/cli/php: /usr/lib64/libxml2.so.2: no version 
information available (required by /root/naox/php-5.3.21/sapi/cli/php)
/root/naox/php-5.3.21/sapi/cli/php: /usr/lib64/libxml2.so.2: no version 
information available (required by /root/naox/php-5.3.21/sapi/cli/php)
/root/naox/php-5.3.21/sapi/cli/php: /usr/lib64/libxml2.so.2: no version 
information available (required by /root/naox/php-5.3.21/sapi/cli/php)


I did not linked to usr/lib64/libxml2.so.2 !! Some error in linking (but only 
when mcrypt is present)
 [2013-02-22 01:56 UTC] spamik at yum dot pl
I would guess that mere presence of --with-mcrypt on configure breaks linking to 
custom libxml2 directory (--with-libxml-dir=/usr/libxml2-2.9.0/) and it defaults 
to system /usr/lib64 (and there is distro standard old libxml2 there which break 
things).
 [2013-02-27 03:15 UTC] veillard at redhat dot com
just to point out that xmlTextReaderSetup is not part of libxml2
ABI, nor on current version nor on 2.6.26.

thinkpad:~/XML -> grep xmlTextReaderSetup doc/libxml2-api.xml 
thinkpad:~/XML -> 


[root@test-rhel55 ~]# gunzip -c /usr/share/doc/libxml2-devel-2.6.26/libxml2-api.xml.gz | grep xmlTextReaderSetup
[root@test-rhel55 ~]# 

it would be good if PHP didn't use name which looks like that they are coming
from libxml2 even if they are possibly wrappers around libxml2 functions.
 [2013-06-12 20:53 UTC] spamik at yum dot pl
Problem is still not addressed.

root@sv18 [~/php-5.4.16]# ./configure --with-libxml-dir=/usr/libxml2-2.9.0
root@sv18 [~/php-5.4.16]# ldd sapi/cli/php|grep xml
        libxml2.so.2 => /usr/libxml2-2.9.0/lib/libxml2.so.2 (0x00007f6b2c098000)
        
root@sv18 [~/php-5.4.16]# ./configure --with-libxml-dir=/usr/libxml2-2.9.0 --
with-mcrypt
root@sv18 [~/php-5.4.16]# ldd sapi/cli/php|grep xml
sapi/cli/php: /usr/lib64/libxml2.so.2: no version information available 
(required by sapi/cli/php)
sapi/cli/php: /usr/lib64/libxml2.so.2: no version information available 
(required by sapi/cli/php)
sapi/cli/php: /usr/lib64/libxml2.so.2: no version information available 
(required by sapi/cli/php)
sapi/cli/php: /usr/lib64/libxml2.so.2: no version information available 
(required by sapi/cli/php)
sapi/cli/php: /usr/lib64/libxml2.so.2: no version information available 
(required by sapi/cli/php)
sapi/cli/php: /usr/lib64/libxml2.so.2: no version information available 
(required by sapi/cli/php)
sapi/cli/php: /usr/lib64/libxml2.so.2: no version information available 
(required by sapi/cli/php)
sapi/cli/php: /usr/lib64/libxml2.so.2: no version information available 
(required by sapi/cli/php)
sapi/cli/php: /usr/lib64/libxml2.so.2: no version information available 
(required by sapi/cli/php)
sapi/cli/php: /usr/lib64/libxml2.so.2: no version information available 
(required by sapi/cli/php)
sapi/cli/php: /usr/lib64/libxml2.so.2: no version information available 
(required by sapi/cli/php)
sapi/cli/php: /usr/lib64/libxml2.so.2: no version information available 
(required by sapi/cli/php)
sapi/cli/php: /usr/lib64/libxml2.so.2: no version information available 
(required by sapi/cli/php)
sapi/cli/php: /usr/lib64/libxml2.so.2: no version information available 
(required by sapi/cli/php)
sapi/cli/php: /usr/lib64/libxml2.so.2: no version information available 
(required by sapi/cli/php)
sapi/cli/php: /usr/lib64/libxml2.so.2: no version information available 
(required by sapi/cli/php)
sapi/cli/php: /usr/lib64/libxml2.so.2: no version information available 
(required by sapi/cli/php)
        libxml2.so.2 => /usr/lib64/libxml2.so.2 (0x00007f1478692000)
 [2013-06-12 20:56 UTC] spamik at yum dot pl
-Summary: XMLReader not compatibile with new libxml2 (undefined symbol: xmlTextReaderSet) +Summary: --with-mcrypt causes bad linking when --with-libxml-dir is present -Package: XML Reader +Package: mcrypt related -PHP Version: 5.4.11 +PHP Version: 5.4.16
 [2013-06-12 20:56 UTC] spamik at yum dot pl
changing to mcrypt package. Maybe more devs there will be more active.
 [2013-06-12 20:58 UTC] spamik at yum dot pl
-Package: mcrypt related +Package: *Compile Issues
 [2013-06-12 20:58 UTC] spamik at yum dot pl
or better  I'll put in into to compile issues...
 [2013-06-13 00:57 UTC] spamik at yum dot pl
-Summary: --with-mcrypt causes bad linking when --with-libxml-dir is present +Summary: --with-mcrypt causes bad linking (with --with-libxml-dir). Reason: -lltdl flag
 [2013-06-13 00:57 UTC] spamik at yum dot pl
root@sv18 [~/php-5.4.16]# ./configure --with-libxml-dir=/usr/libxml2-2.9.0 && make
root@sv18 [~/php-5.4.16]# ldd sapi/cli/php|grep xml 
        libxml2.so.2 => /usr/libxml2-2.9.0/lib/libxml2.so.2 (0x00007f6b2c098000)
        
root@sv18 [~/php-5.4.16]# ./configure --with-libxml-dir=/usr/libxml2-2.9.0 --
with-mcrypt && make
root@sv18 [~/php-5.4.16]# ldd sapi/cli/php|grep xml
        libxml2.so.2 => /usr/lib64/libxml2.so.2 (0x00007f1478692000)

When configured with mcrypt Makefile has
EXTRA_LIBS = -lcrypt -lresolv -lcrypt -lrt -lmcrypt -lltdl -lrt -lm -ldl -lnsl -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt -
lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt

when configured without mcrypt Makefile has
EXTRA_LIBS = -lcrypt -lresolv -lcrypt -lrt -lrt -lm -ldl -lnsl -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt -lxml2 -lz -lm -
lxml2 -lz -lm -lxml2 -lz -lm -lcrypt


problem seems to be caused by flag -lltdl. When removed manualy, libxml2 is liked ok. What is this flag?
 [2013-06-13 08:55 UTC] derick@php.net
It's a linker helper library as used by gnu libtool. I have no idea why it messes the libxml include though, and as far as I know, that library is no longer needed since libmcrypt 2.5.4. So unless your version is that old, -lltdl should not be part of your Makefile. If I manually remove -lltdl from the Makefile, PHP still compiles and links, so I would recommend you try the following:

cat /usr/include/mutils/mcrypt.h | grep VER

And let me know what it says. Secondly, apply the attached patch to ext/mcrypt/config.m4 and then run:

make clean
./buildconf --force
./config.nice
make

and see which libxml it now links too.
 [2013-06-13 08:56 UTC] derick@php.net
The following patch has been added/updated:

Patch Name: mcrypt-config-20130613
Revision:   1371113762
URL:        https://bugs.php.net/patch-display.php?bug=64258&patch=mcrypt-config-20130613&revision=1371113762
 [2013-06-13 17:11 UTC] spamik at yum dot pl
# cat /usr/include/mutils/mcrypt.h | grep VER
#define MCRYPT_API_VERSION 20021217
#define LIBMCRYPT_VERSION "2.5.8"

I've aplied PATCH but it DOES NOT WORK (tested on freshly unpacked source)
root@sv18 [/root/naox/php-5.4.16]# patch -p1 < p
patching file ext/mcrypt/config.m4

# ./configure --with-libxml-dir=/usr/libxml2-2.7.8 --with-mcrypt && make

root@sv18 [/root/naox/php-5.4.16]# ldd sapi/cli/php|grep xml
        libxml2.so.2 => /usr/lib64/libxml2.so.2 (0x00007f95fe8bd000)

root@sv18 [/root/naox/php-5.4.16]# cat Makefile|grep 'lltdl'
EXTRA_LIBS = -lcrypt -lresolv -lcrypt -lrt -lmcrypt -lltdl -lrt -lm -ldl -lnsl -
lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt -lxml2 -lz -lm -lxml2 -lz -
lm -lxml2 -lz -lm -lcrypt

-lltdl is still present even with the pathc
 [2013-06-13 17:25 UTC] spamik at yum dot pl
./buildconf --force
sorry I've missed that.

Now patch does work
 [2013-06-24 17:29 UTC] felipe@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: derick
 [2013-06-24 17:29 UTC] felipe@php.net
Derick, feedback has been supplied.
 [2017-10-24 08:01 UTC] kalle@php.net
-Status: Assigned +Status: Wont fix
 [2017-10-24 08:01 UTC] kalle@php.net
Closing as mcrypt is no longer apart of PHP
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 13:01:30 2024 UTC