Skip to content

fix: compile generated extensions with GCC 14+, pass CI on Ubuntu 26.04 - #2834

Open
nicolas-grekas wants to merge 3 commits into
php:mainfrom
nicolas-grekas:fix-ubuntu-2604
Open

nicolas-grekas wants to merge 3 commits into
php:mainfrom
nicolas-grekas:fix-ubuntu-2604

Conversation

@nicolas-grekas

@nicolas-grekas nicolas-grekas commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

ubuntu-latest is now Ubuntu 26.04, where nine jobs fail on every PR (see the checks of #2833):

  • "Integration Tests": GCC 14+ rejects the generated extensions. cgo includes <stdlib.h> before php.h, so they now define _GNU_SOURCE as cgo.go does, and nullable int and bool arguments point to values of the types cgo declares.
  • "Tests" abort at the second phpinfo() of the process: PHP unloads shared extensions when it shuts down, and libenchant 2.8 can't be loaded twice, GObject still knows its types. The PHP of the CI jobs no longer loads enchant.
  • "msan": MemorySanitizer in clang 21 takes the index of _mm512_permutex2var_epi8() for uninitialized memory (fixed in clang 22 by [msan] Fix 'Simplify 'maskedCheckAVXIndexShadow' #147839' llvm/llvm-project#148785). The sanitizer jobs now use clang 22, which Ubuntu 26.04 has in its archive.

The enchant abort is not only a CI matter: on such a system, a server dies at the first use of enchant after a worker restart, an opcache_reset() or a config reload. Setting ZEND_DONT_UNLOAD_MODULES from FrankenPHP avoids it, and #2730 too, but I left that out: net-snmp doesn't expect to be initialized twice, it floods the log at each start and the suite segfaults on the runner.

ubuntu-latest now resolves to Ubuntu 26.04, where three things break:

- PHP unloads the shared extensions when it shuts down, and libenchant
  2.8 can't be loaded twice in a process: GObject still knows its types,
  so the next use of enchant aborts. That's the second phpinfo() of the
  test suite, and on a server the first use of enchant after a worker
  restart, opcache_reset() or a config reload. ZEND_DONT_UNLOAD_MODULES
  is now set from the library constructor, so extensions stay loaded as
  they do in a static build.
- GCC 14+ rejects the extensions the generator writes: memrchr() is not
  declared because cgo includes <stdlib.h> before php.h, and nullable
  int and bool arguments are passed as pointers to other types than the
  ones cgo declares. The generated files now define _GNU_SOURCE, like
  cgo.go, and point to values of the right types. The manual example of
  the docs gets the define too.
- MemorySanitizer in clang 21 takes the index of
  _mm512_permutex2var_epi8() for uninitialized memory, which clang 22
  fixes. The msan job builds PHP without the AVX-512 VBMI variant of
  base64_decode(), the one place calling it, and the key of the PHP
  cache follows the workflow file so that a change of the configure
  line rebuilds PHP.
With ZEND_DONT_UNLOAD_MODULES, net-snmp is initialized again in the
same image, which it doesn't expect: it floods the log at each start of
PHP and the suite segfaults on the runner. Back to PHP's default: the
PHP of the CI jobs no longer loads enchant.
@nicolas-grekas nicolas-grekas changed the title fix: build and run on Ubuntu 26.04 fix: compile generated extensions with GCC 14+, pass CI on Ubuntu 26.04 Nov 12, 2026
@nicolas-grekas
nicolas-grekas marked this pull request as ready for review November 12, 2026 09:42
@henderkes

Copy link
Copy Markdown
Contributor

Does GitHub offer operating system runners than Ubuntu? I'd rather just run the san tests on an OS that gets proper bug fixes pulled in instead of whatever silly thing Canonical is doing.

@nicolas-grekas

Copy link
Copy Markdown
Contributor Author

Ubuntu is what a big chunk of end users use so it makes sense to keep it, don't you think?

@henderkes

Copy link
Copy Markdown
Contributor

🫣

@nicolas-grekas

Copy link
Copy Markdown
Contributor Author

php/php-src#25412 FYI

@henderkes

Copy link
Copy Markdown
Contributor

I guess we can leave it for this backwards OS, but perhaps with a note. I'm generally not terribly happy with the changes here, they feel a bit misplaced in frankenphp. For enchant we should just wait for upstream fix (it's a bugfix so will go into 8.4+), and for running san tests I would prefer running them on new versions of software (e.g. gcc 16, clang 23).

Ubuntu 26.04 has clang 22 in its archive, where MemorySanitizer no
longer takes the index of an AVX-512 permutation for uninitialized
memory: PHP is built as before. A note next to the enchant line says
when to drop it.
@nicolas-grekas

Copy link
Copy Markdown
Contributor Author

PR updated: the sanitizer jobs now use clang 22, which Ubuntu 26.04 has in its archive, instead of skipping the AVX-512 code. And a note next to the enchant line says when to drop it.

Waiting for the php-src fix alone would keep every PR red for weeks, and 8.2/8.3 won't get it while we test them. The rest is ours: the generator emits C that GCC 14+ refuses.

ini-values: opcache.jit=disable
# libenchant 2.8 can't be loaded again once PHP unloaded it, which each new start of PHP does:
# GObject still knows the types of the first load, and aborts when they come back
# GObject still knows the types of the first load, and aborts when they come back.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this comment isn't really important, just a todo drop when patched upstream is enough

LDFLAGS: -fsanitize=${{ matrix.sanitizer == 'asan' && 'address' || 'memory' }}
CC: clang
CXX: clang++
# MemorySanitizer in clang 21, the default of Ubuntu 26.04, takes the index of an AVX-512 permutation

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also not really important to know imo

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

2 participants