Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing symbols in php8.0-xml? Causes problem with PECL xmlrpc #1576

Closed
mdrmdrmdr opened this issue Mar 17, 2021 · 17 comments
Closed

Missing symbols in php8.0-xml? Causes problem with PECL xmlrpc #1576

mdrmdrmdr opened this issue Mar 17, 2021 · 17 comments

Comments

@mdrmdrmdr
Copy link

I'm not sure if this is a bug. I recently upgraded my home automation Raspberry to PHP 8.0.3. For that I also changed the repository to https://packages.sury.org/php. On the Raspberry I use the home automation software Homegear. Using the PHP interface of Homegear, I get errors which have not been there with PHP 7.4.

I tracked it down to xmlrpc, which went to PECL. I am in contact with the maintainer to find a solution to the problem.

The error message when using the Homegear PHP interface is:

php: symbol lookup error: /usr/lib/php/20200930/xmlrpc.so: undefined symbol: XML_ParserCreate

Since /usr/lib/php/20200930/xmlrpc.so does use but not define XML_ParserCreate (nm output below), we expected this to be defined in /usr/lib/php/20200930/xml.so. Actually there are no symbols defined at all there:

$ nm /usr/lib/php/20200930/xmlrpc.so |grep XML_ParserCreate
         U XML_ParserCreate

$ nm /usr/lib/php/20200930/xml.so
nm: /usr/lib/php/20200930/xml.so: no symbols

Is that a bug causing my problem? Or do I just think in the wrong direction?

I am running on:

Linux raspberry 5.10.17-v7+ #1403 SMP Mon Feb 22 11:29:51 GMT 2021 armv7l GNU/Linux
Architecture: armhf
Linux: Description: Raspbian GNU/Linux 10 (buster)

With PHP packages installed:

$ dpkg --get-selections | grep php8
libapache2-mod-php8.0                           install
php8.0                                          install
php8.0-cli                                      install
php8.0-common                                   install
php8.0-curl                                     install
php8.0-dev                                      install
php8.0-fpm                                      install
php8.0-mbstring                                 install
php8.0-opcache                                  install
php8.0-readline                                 install
php8.0-soap                                     install
php8.0-sqlite3                                  install
php8.0-xml                                      install

Thanks for any help.

@oerdnj
Copy link
Owner

oerdnj commented Mar 17, 2021

What is your libxml2 version and output of ldd on the extension?

@mdrmdrmdr
Copy link
Author

Asking this?

$ ldd /usr/lib/arm-linux-gnueabihf/libxml2.so
        linux-vdso.so.1 (0x7eee1000)
        /usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so => /usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so (0x76e67000)
        libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0x76e45000)
        libicui18n.so.65 => /usr/lib/arm-linux-gnueabihf/libicui18n.so.65 (0x76c54000)
        libicuuc.so.65 => /usr/lib/arm-linux-gnueabihf/libicuuc.so.65 (0x76b0a000)
        libicudata.so.65 => /usr/lib/arm-linux-gnueabihf/libicudata.so.65 (0x7504a000)
        libz.so.1 => /lib/arm-linux-gnueabihf/libz.so.1 (0x7501f000)
        liblzma.so.5 => /lib/arm-linux-gnueabihf/liblzma.so.5 (0x74fee000)
        libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0x74f6c000)
        libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0x74e1e000)
        /lib/ld-linux-armhf.so.3 (0x76f8c000)
        libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0x74cd7000)
        libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0x74caa000)
        libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0x74c80000)

@oerdnj
Copy link
Owner

oerdnj commented Mar 17, 2021

Nah, ldd /usr/lib/php/20200930/xmlrpc.so

And package versions of the linked libraries. XML_ParserCreate is function from libexpat library.

@mdrmdrmdr
Copy link
Author

What do you mean by package versions of the linked libraries? How do I get this?

$ ldd /usr/lib/php/20200930/xmlrpc.so
        linux-vdso.so.1 (0x7efe9000)
        /usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so => /usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so (0x76ee6000)
        libxml2.so.2 => /usr/lib/arm-linux-gnueabihf/libxml2.so.2 (0x76dc7000)
        libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0x76c79000)
        libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0x76c66000)
        libicui18n.so.65 => /usr/lib/arm-linux-gnueabihf/libicui18n.so.65 (0x76a75000)
        libicuuc.so.65 => /usr/lib/arm-linux-gnueabihf/libicuuc.so.65 (0x7692b000)
        libicudata.so.65 => /usr/lib/arm-linux-gnueabihf/libicudata.so.65 (0x74e6b000)
        libz.so.1 => /lib/arm-linux-gnueabihf/libz.so.1 (0x74e40000)
        liblzma.so.5 => /lib/arm-linux-gnueabihf/liblzma.so.5 (0x74e0f000)
        libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0x74d8d000)
        /lib/ld-linux-armhf.so.3 (0x76f1d000)
        libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0x74c46000)
        libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0x74c19000)
        libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0x74bef000)

@oerdnj
Copy link
Owner

oerdnj commented Mar 17, 2021

Hmm, just a thought (I can't check from mobile) - is there a "priority" line in the /etc/PHP/8.0/mods-available/xmlrpc.ini file? Check other files on how it should look like and then perhaps bump it to the same value as it had in PHP 7.4?

@oerdnj
Copy link
Owner

oerdnj commented Mar 17, 2021

After changing the priority you'll need to run phpdismod xmlrpc and phpenmod xmlrpc

@mdrmdrmdr
Copy link
Author

mdrmdrmdr commented Mar 17, 2021

There is no xmlrpc.ini in /etc/php/8.0/mods-available.
I did not install it via apt install php8.0-xmlrpc but with pecl install channel://pecl.php.net/xmlrpc-1.0.0RC2.

I still have php 7.4 installed as a fallback if php 8 does not work for my software. Should I uninstall it?

@oerdnj
Copy link
Owner

oerdnj commented Mar 17, 2021

Oh, then why are you reporting it here?

Nevertheless, most probably you are loading the xmlrpc extension before loading its dependencies first.

BTW there's a package for php8.0-xmlrpc

@oerdnj oerdnj closed this as completed Mar 17, 2021
@mdrmdrmdr
Copy link
Author

I don't understand your close. Why?

I just deinstalled php7.4. No change. Same error.
I just deinstalled the PECL version of xmlrpc (thought it's the recomended way) and installed php8.0-xmlrpc.

Now a new error in the php logfile and my software does now work at all. Went back to the PECL version for now.

[17-Mar-2021 23:08:02 Europe/Berlin] PHP Warning:  PHP Startup: Unable to load dynamic library 'xmlrpc.so' (tried: /usr/lib/php/20200930/xmlrpc.so (/usr/lib/php/20200930/xmlrpc.so: undefined symbol: XML_GetErrorCode), /usr/lib/php/20200930/xmlrpc.so.so (/usr/lib/php/20200930/xmlrpc.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
[17-Mar-2021 23:08:02 Europe/Berlin] PHP Warning:  PHP Startup: Unable to load dynamic library 'xmlrpc.so' (tried: /usr/lib/php/20200930/xmlrpc.so (/usr/lib/php/20200930/xmlrpc.so: undefined symbol: XML_GetErrorCode), /usr/lib/php/20200930/xmlrpc.so.so (/usr/lib/php/20200930/xmlrpc.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
[17-Mar-2021 23:08:02 Europe/Berlin] PHP Fatal error:  Uncaught Error: Call to undefined function XMLRPC\xmlrpc_encode_request() in /var/lib/homegear/scripts/HM-XMLRPC-Client/Client.php:227
Stack trace:
#0 /var/lib/homegear/scripts/HM-XMLRPC-Client/Client.php(235): XMLRPC\Client->send()
#1 /opt/automation/test_temp.php(36): XMLRPC\Client->__call()
#2 {main}
  thrown in /var/lib/homegear/scripts/HM-XMLRPC-Client/Client.php on line 227
[17-Mar-2021 23:09:02 Europe/Berlin] PHP Warning:  PHP Startup: Unable to load dynamic library 'xmlrpc.so' (tried: /usr/lib/php/20200930/xmlrpc.so (/usr/lib/php/20200930/xmlrpc.so: undefined symbol: XML_GetErrorCode), /usr/lib/php/20200930/xmlrpc.so.so (/usr/lib/php/20200930/xmlrpc.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

@oerdnj
Copy link
Owner

oerdnj commented Mar 17, 2021

I don't understand your close. Why?

This is a tracker to track issues with the packages and there's no issue with the packages since you installed the extension from PECL. I can't help you unless you can reproduce the issue on clean installation and not on system where you did X random things.

@mdrmdrmdr
Copy link
Author

mdrmdrmdr commented Mar 17, 2021

It was a clean installation. I just upgraded php 7.4 to 8.0 (including php8.0-xmlrpc) and the problems started around xmlrpc.
Everwhere is written that Since 8.0, the XML-RPC extension has been moved to PECL and it is no longer included in PHP core.
So I took it from there.

Nevermind, thanks anyway...

@oerdnj
Copy link
Owner

oerdnj commented Mar 17, 2021

Both issues are caused by upstream and needs to be fixed there - there's missing expat dependency and maybe even libxmlrpc-epi, so it breaks unless something else pulls libexpat.so.1 into the PHP process.

See the difference?


root@calcifer:~# ldd /usr/lib/php/20190902/xmlrpc.so 
        linux-vdso.so.1 (0x00007ffeac5a5000)
        libxmlrpc-epi.so.0 => /usr/lib/x86_64-linux-gnu/libxmlrpc-epi.so.0 (0x00007fcb8f712000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fcb8f54d000)
        libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007fcb8f51e000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fcb8f74f000)
root@calcifer:~# ldd /usr/lib/php/20200930/xmlrpc.so 
        linux-vdso.so.1 (0x00007ffed53fc000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7078094000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f7078292000)

But it has nothing to do with the packaging itself. The PECL xmlrpc extension is broken.

@mdrmdrmdr
Copy link
Author

Ok, thanks again. I'll talk to the maintainer of the PECL xmlrpc.

@cmb69
Copy link

cmb69 commented Mar 17, 2021

there's missing expat dependency

ext/xmlrpc does not depend on libexpat; it should be able to use the compat layer over libxml2 provided by ext/xml instead. However, apparently I forgot that system libxmlrpc-epi may be built against libexpat. I guess the solution is that ext/xmlrpc needs to check whether ext/xml provides the respective symbols, if --with-expat is not configured, and to bail out otherwise.

Anyhow, thank you @oerdnj, that was helpful for me. :)

maybe even libxmlrpc-epi,

ext/xmlrpc has a bundled libxmlrpc-epi, which uses the ZendMM, and as such heeds memory_limit what seems like a good idea. OTOH, that bundled lib is not quite up to date. Anyway, which lib to chose is configurable, so that's a documentation issue (if at all).

@oerdnj
Copy link
Owner

oerdnj commented Mar 18, 2021

@cmb69 Umm, maybe this is needed at least on Debian? I am not sure about the other platforms though, it might be just Debian quirk.

diff --git a/xmlrpc-1.0.0RC2/config.m4 b/xmlrpc-1.0.0RC2/config.m4
index 9de44ef..4ac9f10 100644
--- a/xmlrpc-1.0.0RC2/config.m4
+++ b/xmlrpc-1.0.0RC2/config.m4
@@ -97,7 +97,7 @@ elif test "$PHP_XMLRPC" != "no"; then
   fi

   PHP_ADD_INCLUDE($XMLRPC_DIR)
-  PHP_ADD_LIBRARY_WITH_PATH(xmlrpc, $XMLRPC_DIR/$PHP_LIBDIR, XMLRPC_SHARED_LIBADD)
+  PHP_ADD_LIBRARY_WITH_PATH(xmlrpc-epi, $XMLRPC_DIR/$PHP_LIBDIR, XMLRPC_SHARED_LIBADD)
   PHP_NEW_EXTENSION(xmlrpc,xmlrpc-epi-php.c, $ext_shared)
   XMLRPC_MODULE_TYPE=external
 fi

@cmb69
Copy link

cmb69 commented Mar 18, 2021

Thanks, I think you're correct. @remicollet, can you confirm that libxmlrpc-epi i should be used on RHEL/Fedora as well?

@mdrmdrmdr
Copy link
Author

A final comment from my side: A manual build of PECL xmlrpc with CPPFLAGS=-I/usr/include/libxml2/ and --with-expat solves my issue with the Homegear PHP interface under PHP 8. Thanks all for the help and sorry @oerdnj if i missused your issue tracker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants