Opened 7 years ago

Closed 7 years ago

#753 closed defect (worksforme)

Unable to load xapian.so extension on php7 and debian 9

Reported by: Touzeau Owned by:
Priority: normal Milestone:
Component: Xapian-bindings (PHP) Version: 1.4.4
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Operating System: Linux

Description (last modified by Olly Betts)

Using compilation ./configure --with-php7 Compilation was successfull

but the loading library failed :

     27116:	/usr/lib/php/extensions/no-debug-non-zts-20160303/xapian.so: error: symbol lookup error: undefined symbol: zend_standard_class_def (fatal)

How to fix it ?

Attachments (6)

php.ini (3.9 KB ) - added by Touzeau 7 years ago.
php7 ini configuration
debug2.txt (333.2 KB ) - added by Touzeau 7 years ago.
piece of loading library
configure.log (6.3 KB ) - added by Touzeau 7 years ago.
configure log with php7
make_check.log (2.2 KB ) - added by Touzeau 7 years ago.
make check after configure
make_install.log (3.3 KB ) - added by Touzeau 7 years ago.
Make install
smoketest.php.log (38.2 KB ) - added by Touzeau 7 years ago.
smoketest debug

Download all attachments as: .zip

Change History (17)

by Touzeau, 7 years ago

Attachment: php.ini added

php7 ini configuration

by Touzeau, 7 years ago

Attachment: debug2.txt added

piece of loading library

comment:1 by Olly Betts, 7 years ago

Keywords: php7 debian undefined symbol zend_standard_class_def removed
Milestone: 1.4.x
Priority: highnormal

What PHP version are you using here?

You say "debian 9" which has PHP 7.0, but that uses PHP API 20151012 and your report indicates 20160303 which would be 7.1. If you're building with 7.0 and trying to use the result with 7.1 (or vice versa) that isn't going to work (and would likely result in an undefined symbol error for some PHP-related symbol, just as you're reporting).

If you are building with the same PHP version you trying to use at run-time, please show the full output of these commands in the xapian-bindings-1.4.4 source tree:

make distclean
./configure --with-php7
make
make check

comment:2 by Olly Betts, 7 years ago

Description: modified (diff)

by Touzeau, 7 years ago

Attachment: configure.log added

configure log with php7

by Touzeau, 7 years ago

Attachment: make_check.log added

make check after configure

by Touzeau, 7 years ago

Attachment: make_install.log added

Make install

comment:3 by Touzeau, 7 years ago

Added requested information. To be more precise, i'm using

PHP 7.1.8 (cli) (built: Aug 31 2017 21:33:38) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies

comment:4 by Olly Betts, 7 years ago

Could you please also attach php7/smoketest.php.log which should show what's causing the testsuite to fail?

Where did this build of PHP 7.1 come from? There's no PHP 7.1 package for Debian 9 that I can see, and the paths don't seem match the Debian packaging either.

BTW, I really wouldn't recommend building software as root.

by Touzeau, 7 years ago

Attachment: smoketest.php.log added

smoketest debug

comment:5 by Touzeau, 7 years ago

Attached the file

Yes, we have compiled our php, but according Debian pre-requesites:

'./configure' '--prefix=/usr' '--with-config-file-path=/etc/php7' '--with-config-file-scan-dir=/etc/php7/cli/conf.d' '--build=x86_64-kfreebsd-gnu' '--host=x86_64-kfreebsd-gnu' '--sysconfdir=/etc' '--localstatedir=/var' '--mandir=/usr/share/man' '--with-pdo-pgsql' '--with-zlib-dir' '--with-freetype-dir' '--enable-mbstring' '--with-libxml-dir=/usr' '--enable-soap' '--enable-calendar' '--with-curl=' '--with-mcrypt' '--with-gd' '--with-pgsql' '--disable-rpath' '--with-snmp' '--enable-inline-optimization' '--with-bz2' '--with-zlib' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-pcntl' '--enable-mbregex' '--enable-exif' '--with-mysql' '--enable-bcmath' '--with-mhash' '--enable-zip' '--with-pcre-regex' '--with-pdo-mysql' '--with-mysqli' '--with-mysql-sock=/var/run/mysqld/mysqld.sock' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--enable-gd-native-ttf' '--with-openssl' '--with-fpm-user=www-data' '--with-fpm-group=www-data' '--with-libdir=/lib/x86_64-linux-gnu' '--enable-ftp' '--with-imap' '--with-imap-ssl' '--with-ldap' '--with-kerberos' '--with-ldap-sasl' '--with-gettext' '--with-xmlrpc' '--with-xsl' '--enable-opcache' '--enable-fpm' 'build_alias=x86_64-kfreebsd-gnu' 'host_alias=x86_64-kfreebsd-gnu'

comment:6 by Olly Betts, 7 years ago

You seem to be configuring your PHP mostly as x86_64-kfreebsd-gnu but with --with-libdir=/lib/x86_64-linux-gnu. Are you really using kfreebsd? Note that kfreebsd isn't part of Debian stable releases (https://wiki.debian.org/DebianStretch), and is a rather oddball configuration - if you're really using that it's something you ought to mention up front in a bug report, rather than letting it slip 5 comments in.

That log file seems to contain a lot of unrelated stuff - no idea where that's coming from - but the key issue is right near the bottom:

/root/xapian-bindings-1.4.4/php7/smoketest.php:38: include(xapian.php): failed to open stream: No such file or directory

I think you need to debug why that's failing. It works fine for me on x86-64 Debian Linux, so it looks like it's something specific to your set-up.

comment:7 by Touzeau, 7 years ago

Installed a fresh 9.2 debian with Debian PHP pre-compiled. Issue is fixed because some ZEND extensions are added in Debian PHP. Suggest to add pre-requisites on ZEND extensions in documentation

Thanks!

comment:8 by Olly Betts, 7 years ago

I'm testing with PHP 7.1 and /usr/bin/php7.1 -m shows me:

$ /usr/bin/php7.1 -m
[PHP Modules]
calendar
Core
ctype
date
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
openssl
pcntl
pcre
PDO
Phar
posix
readline
Reflection
session
shmop
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
Zend OPcache
zlib

[Zend Modules]
Zend OPcache

However, make check in the source tree runs the testsuite like so:

php7.1 -n -d safe_mode=off -d enable_dl=on -d extension_dir=.libs -d include_path=php7

The -n tells it not to load the default config files, and in that mode no "Zend Modules" are loaded:

$ /usr/bin/php7.1 -n -d safe_mode=off -d enable_dl=on -d extension_dir=.libs -d include_path=php7 -m
[PHP Modules]
Core
date
filter
hash
libxml
openssl
pcntl
pcre
Reflection
session
SPL
standard
zlib

[Zend Modules]

And in the PHP 7.1 config, I can see that "opcache" is loaded by default but no others are, which matches the output above:

$ rgrep -i zend_extension /etc/php/7.1
/etc/php/7.1/mods-available/opcache.ini:zend_extension=opcache.so

So it seems to me that Debian's PHP 7.1 loads the opcache Zend extension (and no others) by default, but that Xapian's bindings don't need this, as the tests are run without it by default anyway.

What Zend extensions do you think are needed, and what evidence do you have for that?

comment:9 by Touzeau, 7 years ago

It seems you so file is linked/needed to zend_standard_class_def() function that is a part of zend library ( inside zend.cpp )

comment:10 by Olly Betts, 7 years ago

But Zend is just something internal to PHP (https://en.wikipedia.org/wiki/Zend_Engine) and that symbol should be provided by PHP - e.g. in the case of the CLI version:

$ objdump -T /usr/bin/php7.1|grep -i zend_standard_class
000000000066d4c8 g    DO .bss	0000000000000008  Base        zend_standard_class_def

comment:11 by Olly Betts, 7 years ago

Resolution: worksforme
Status: newclosed

No further response from submitter as to what they think needs documenting and it doesn't look to me like anything does, so closing.

If you want to take this further, I'd suggest showing us exactly how to reproduce the problem step-by-step.

Note: See TracTickets for help on using tickets.