Opened 22 months ago

Closed 22 months ago

Last modified 22 months ago

#66660 closed defect (fixed)

php: Certain older version opcache modules don't work properly on Ventura anymore

Reported by: hostep (Pieter Hoste) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version:
Keywords: ventura Cc:
Port: php70-opcache php71-opcache php72-opcache php73-opcache

Description

Hi there

A colleague of mine updated his macOS to Ventura (13) and tried to install a bunch of PHP versions with the opcache module. The installation went fine, but at execution time, the following error showed up for PHP 7.2 and 7.3 (it works fine with 7.4, 8.0 and 8.1), when executing something via PHP on the command line:

Failed loading /opt/local/lib/php72/extensions/no-debug-non-zts-20170718/opcache.so:  dlopen(/opt/local/lib/php72/extensions/no-debug-non-zts-20170718/opcache.so, 0x0009): symbol not found in flat namespace '_zend_file_cache_invalidate'

or

Failed loading /opt/local/lib/php73/extensions/no-debug-non-zts-20180731/opcache.so:  dlopen(/opt/local/lib/php73/extensions/no-debug-non-zts-20180731/opcache.so, 0x0009): symbol not found in flat namespace '_zend_file_cache_invalidate'

This is using an Intel processor if that should matter.

No idea if an easy fix exist for this and if you guys still support these older PHP versions? This still works fine for me on macOS Monterey (12).

Thanks!

Change History (3)

comment:1 Changed 22 months ago by ryandesign (Ryan Carsten Schmidt)

Keywords: ventura added
Port: php70-opcache php71-opcache added
Status: assignedaccepted
Summary: Certain older PHP version opcache modules don't work properly on Ventura anymorephp: Certain older version opcache modules don't work properly on Ventura anymore

I would like for the older PHP ports to still work, so thanks for reporting this problem and for letting me know these older ports are still being used.

I can confirm this issue on Ventura x86_64 with php70-opcache through php73-opcache inclusive and that the problem doesn't occur with php74-opcache.

What I find strange is that even on Monterey, where I don't see the problem, nm (if I understand how to interpret its output) says _zend_file_cache_invalidate is undefined in php70 through php73 and I don't know why.

% for x in /opt/local/lib/php*/extensions/*/opcache.so; do echo $x && nm $x | grep _zend_file_cache_invalidate; done
/opt/local/lib/php70/extensions/no-debug-non-zts-20151012/opcache.so
                 U _zend_file_cache_invalidate
/opt/local/lib/php71/extensions/no-debug-non-zts-20160303/opcache.so
                 U _zend_file_cache_invalidate
/opt/local/lib/php72/extensions/no-debug-non-zts-20170718/opcache.so
                 U _zend_file_cache_invalidate
/opt/local/lib/php73/extensions/no-debug-non-zts-20180731/opcache.so
                 U _zend_file_cache_invalidate
/opt/local/lib/php74/extensions/no-debug-non-zts-20190902/opcache.so
0000000000021256 T _zend_file_cache_invalidate
/opt/local/lib/php80/extensions/no-debug-non-zts-20200930/opcache.so
0000000000022415 T _zend_file_cache_invalidate
/opt/local/lib/php81/extensions/no-debug-non-zts-20210902/opcache.so
0000000000013bbd T _zend_file_cache_invalidate
/opt/local/lib/php82/extensions/no-debug-non-zts-20220829/opcache.so
0000000000013770 T _zend_file_cache_invalidate

_zend_file_cache_invalidate is part of "file-based caching" introduced in PHP 7.0 as an optional feature that could be disabled at compile time (but we enable it in MacPorts). In PHP 7.4 it could no longer be disabled at compile time. Perhaps making the feature non-optional in 7.4 has something to do with the symbol becoming defined in nm or maybe that's just a coincidence.

Comparing my build logs on Monterey and Ventura, on Ventura it says:

ld: warning: -undefined dynamic_lookup may not work with chained fixups

All PHP modules automatically get the -undefined dynamic_lookup linker flags added which lets them look up undefined symbols at runtime, which is I guess why it works at all on earlier systems. This "chained fixups" feature appears to be new in Xcode 13 and applies automatically when compiling for macOS 12 and later:

All programs and dylibs built with a deployment target of macOS 12 [...] or later now use the chained fixups format

and as of Xcode 13.3 it applies automatically for macOS 11 and later:

The new chained fixups format is the default linking method when targeting macOS 11 or later [...]

But maybe there is some new change to dyld on Ventura that causes new problems and that's why they added the warning. This feature is causing problems in the python ecosystem as well. They are currently waiting for a new version of Xcode to make chained fixups work better. In the meantime disabling chained fixups (going back to the behavior of Xcode 12 and earlier) seems to work.

I'm not sure how pervasive this problem is in MacPorts PHP modules so I'll just make the change in the four affected php-opcache ports but if you find other PHP modules with problems please file another ticket and I can add the fix there too or make the fix more general.

comment:2 Changed 22 months ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: acceptedclosed

In b2f2ec1887f32b769364fb761d326708d69076e8/macports-ports (master):

php-opcache: Disable chained fixups

Closes: #66660

comment:3 Changed 22 months ago by hostep (Pieter Hoste)

Thanks Ryan

I got confirmation that the new versions of php7x-opcache work again on Ventura now.

Thank you very much!

Note: See TracTickets for help on using tickets.