You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
opcache: symbol not found in flat namespace (_zend_gdb_register_code) when JIT enabled on Mac OS X #9639
I get this error when loading the opcache.so extension:
Failed loading /usr/local/lib/php/extensions/no-debug-zts-20220829/opcache.so: dlopen(/usr/local/lib/php/extensions/no-debug-zts-20220829/opcache.so, 0x0009): symbol not found in flat namespace (_zend_gdb_register_code)
I could not reproduce on native arm64 nor in rosetta mode with both gcc and clang, would it be possible to give a bit more context ? did you try for example instead of removing opcache jit, removing zts ?
@devnexen this looks related but I'm not sure if that's precisely the same issue. Unlike #9635, I'm not loading PHP as a plugin for another app. PHP is statically compiled in the main Go binary:
This issue is back again (macOS only). I probably made a mistake while recompiling hiding the issue. I can still give access to a reproducer.
you can send an email however won t be able to have a proper look at it before this weekend at earliest, pretty busy atm. but if someone else wants a crack at it before me that s fine :-)
Now that FrankenPHP is public, here is a quick reproducer (on Mac):
compile PHP
./buildconf
./configure \
--enable-embed=static \
--enable-zts \
--enable-static \
--enable-shared=no \
--with-iconv=/opt/homebrew/opt/libiconv/ \
--enable-debug
make -j$(nproc)
sudo make install
Be sure that opcache is loaded in php.ini
run Franken's test suite
# Go must be installed
git clone --recursive git@github.com:dunglas/frankenphp.git
cd frankenphp
go test -v
Result:
<b>Warning</b>: Failed loading Zend extension 'opcache' (tried: /usr/local/lib/php/extensions/debug-zts-20220830/opcache (dlopen(/usr/local/lib/php/extensions/debug-zts-20220830/opcache, 0x0009): tried: '/usr/local/lib/php/extensions/debug-zts-20220830/opcache' (no such file)), /usr/local/lib/php/extensions/debug-zts-20220830/opcache.so (dlopen(/usr/local/lib/php/extensions/debug-zts-20220830/opcache.so, 0x0009): symbol not found in flat namespace (_zend_gdb_register_code))) in <b>Unknown</b> on line <b>0</b><br />
I believe this has been "fixed" in PHP 8.4 due to the new JIT IR implementation. Since older PHP versions are unsupported I am closing this. If that is not the case and the issue is still reproducible with the new JIT then please reopen the issue or create a new one with steps to reproduce it against PHP 8.4 or master. Also, opcache is no longer optional so no loading is needed.
Activity
devnexen commentedon Sep 29, 2022
I could not reproduce on native arm64 nor in rosetta mode with both gcc and clang, would it be possible to give a bit more context ? did you try for example instead of removing opcache jit, removing zts ?
iluuu1994 commentedon Sep 29, 2022
This is odd,
zend_gdb_register_codeis notstaticandzend_gdb.cis compiled unconditionally.devnexen commentedon Sep 29, 2022
start to wonder if this is a somewhat similar issue found here (as embed sapi involved).
dunglas commentedon Sep 29, 2022
Good catch, removing
--enable-ztsfixes the issue too!I've written a SAPI to embed PHP in a Go binary. I can provide you a (private) repo with a reproducer if needed!
devnexen commentedon Sep 30, 2022
sure why not feel free to send an email if you prefer.
dunglas commentedon Sep 30, 2022
I upgraded to the latest commit of the
PHP-8.2branch, recompiled with the exact same flags... and the issue is gone.Thanks for your help everybody!
dunglas commentedon Oct 3, 2022
This issue is back again (macOS only). I probably made a mistake while recompiling hiding the issue. I can still give access to a reproducer.
devnexen commentedon Oct 3, 2022
did you acknowledge what was advised here ?
dunglas commentedon Oct 4, 2022
@devnexen this looks related but I'm not sure if that's precisely the same issue. Unlike #9635, I'm not loading PHP as a plugin for another app. PHP is statically compiled in the main Go binary:
Basically, the main app loads directly
opcache.so.devnexen commentedon Oct 5, 2022
you can send an email however won t be able to have a proper look at it before this weekend at earliest, pretty busy atm. but if someone else wants a crack at it before me that s fine :-)
dunglas commentedon Oct 17, 2022
Now that FrankenPHP is public, here is a quick reproducer (on Mac):
compile PHP
Be sure that opcache is loaded in
php.inirun Franken's test suite
Result:
kamil-tekiela commentedon Nov 5, 2026
I believe this has been "fixed" in PHP 8.4 due to the new JIT IR implementation. Since older PHP versions are unsupported I am closing this. If that is not the case and the issue is still reproducible with the new JIT then please reopen the issue or create a new one with steps to reproduce it against PHP 8.4 or master. Also, opcache is no longer optional so no loading is needed.