NoiseByNorthwest / php-spx

A simple & straight-to-the-point PHP profiling extension with its built-in web UI
GNU General Public License v3.0
2.1k stars 81 forks source link

spx.so: undefined symbol: gc_globals #239

Open sergeypechenyuk opened 9 months ago

sergeypechenyuk commented 9 months ago

There was an identical ticket https://github.com/NoiseByNorthwest/php-spx/issues/188, but how to solve the problem is not described

OS: Centos8

$ php74 -v
PHP Warning:  PHP Startup: Unable to load dynamic library 'spx.so' (tried: /opt/remi/php74/root/usr/lib64/php/modules/spx.so (/opt/remi/php74/root/usr/lib64/php/modules/spx.so: undefined symbol: gc_globals), /opt/remi/php74/root/usr/lib64/php/modules/spx.so.so (/opt/remi/php74/root/usr/lib64/php/modules/spx.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'spx.so' (tried: /opt/remi/php74/root/usr/lib64/php/modules/spx.so (/opt/remi/php74/root/usr/lib64/php/modules/spx.so: undefined symbol: gc_globals), /opt/remi/php74/root/usr/lib64/php/modules/spx.so.so (/opt/remi/php74/root/usr/lib64/php/modules/spx.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 7.4.33 (cli) (built: Aug  1 2023 08:46:35) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.33, Copyright (c), by Zend Technologies
    with Xdebug v3.1.6, Copyright (c) 2002-2022, by Derick Rethans
$ ls -l /opt/remi/php74/root/usr/lib64/php/modules/spx.so
-rwxr-xr-x 1 root root 363440 Jan 11 08:35 /opt/remi/php74/root/usr/lib64/php/modules/spx.so

What should I do to make the module work?

NoiseByNorthwest commented 9 months ago

Are you sure that spx.so is built with php7.4 dev package ?

sergeypechenyuk commented 9 months ago

Yes, for 7.4

$ phpize -v
Configuring for:
PHP Api Version:         20190902
Zend Module Api No:      20190902
Zend Extension Api No:   320190902
NoiseByNorthwest commented 9 months ago

But loading your spx.so seems to require the existence of gc_globals global var which is private (non extern) since php7.3, so it really looks like spx.so has been built with php7.2 or older.

The patch making gc_globals private https://github.com/php/php-src/commit/baa9890112a863f10e62bbb4c5a1623642a5db3c#diff-73f4feabd42f36a08c6fcf95029444538908ab8df3cd9c5790edf7d72e7e6d34L118

$ git tag --contains baa9890112a863f10e62bbb4c5a1623642a5db3c | sort | head
php-7.3.0
php-7.3.0RC6
php-7.3.1
php-7.3.10
php-7.3.10RC1
php-7.3.11
php-7.3.11RC1
php-7.3.12
php-7.3.12RC1
php-7.3.13

Could you show me the output of strings /opt/remi/php74/root/usr/lib64/php/modules/spx.so | grep API20 ?

sergeypechenyuk commented 9 months ago

Return 'API20170718,NTS' and this is 7.2. I'll look for why it doesn't compile correctly