Skip to content

Feat/pgo v3#1138

Open
henderkes wants to merge 65 commits into
v3from
feat/pgo-v3
Open

Feat/pgo v3#1138
henderkes wants to merge 65 commits into
v3from
feat/pgo-v3

Conversation

@henderkes

Copy link
Copy Markdown
Collaborator

What does this PR do?

Checklist before merging

If your PR involves the changes mentioned below and completed the action, please tick the corresponding option.
If a modification is not involved, please skip it directly.

  • If you modified *.php or *.json, run them locally to ensure your changes are valid:
    • composer cs-fix
    • composer analyse
    • composer test
    • bin/spc dev:sort-config
  • If it's an extension or dependency update, please ensure the following:
    • Add your test combination to src/globals/test-extensions.php.
    • If adding new or fixing bugs, add commit message containing extension test or test extensions to trigger full test suite.

@henderkes henderkes marked this pull request as ready for review May 11, 2026 14:49
@henderkes henderkes requested a review from crazywhalecc May 11, 2026 14:49
@crazywhalecc crazywhalecc added the need-test This PR has not been tested yet, cannot merge now label May 12, 2026
@github-actions

github-actions Bot commented May 12, 2026

Copy link
Copy Markdown

StaticPHP Test Bot

Detected: Extensions: fastchart, fastjson | Libraries: bzip2, fastlz, icu, imagemagick, jbig, krb5, libaom, libffi, libheif, liblz4, libpng, ncurses, openssl, postgresql, qdbm, unixodbc, watcher | Targets: llvm-compiler-rt, llvm-tools, php
Active labels: none
Config: Linux x86_64 + Windows x86_64 + macOS arm64 | PHP 8.5 NTS

@henderkes

Copy link
Copy Markdown
Collaborator Author

(I tested with static-php/packages v3 branch, php 8.5 zig on rpm. Tests with Alpine and gcc are still to finish in a few hours when ci runs.)

@henderkes

Copy link
Copy Markdown
Collaborator Author

Wair, why is curl a target like php and not a package/library? We don't compile the exe right?

@crazywhalecc

Copy link
Copy Markdown
Owner

Wair, why is curl a target like php and not a package/library? We don't compile the exe right?

We could compile curl.exe, which shows that StaticPHP is not only suitable for building static PHP, but also for other projects. Just like we already support building pkg-config and re2c. Making them targets simply makes reasonable.

target is superset of library.

@henderkes

Copy link
Copy Markdown
Collaborator Author

Wair, why is curl a target like php and not a package/library? We don't compile the exe right?

We could compile curl.exe, which shows that StaticPHP is not only suitable for building static PHP, but also for other projects. Just like we already support building pkg-config and re2c. Making them targets simply makes reasonable.

target is superset of library.

Okay, added curl.exe on Windows too. Also figured out the root cause of the BUILD_CC patch minilua crash (zigs undefined behaviour sanitizer tripping up, if you run CC="clang -fsanitize=undefined" it will also fail) which coincidentally also fixed a possible edge case bug. BUILD_CC is also used for gen_ir so by using a different vm type it could have theoretically clashed.

@henderkes

Copy link
Copy Markdown
Collaborator Author

Oh, there's even an issue running the binaries despite no undefined sanitizer that I can't reproduce locally or in docker. Very weird.

@henderkes

Copy link
Copy Markdown
Collaborator Author

wtf I have no idea what failed in the tests and why. it passes locally and looking for php-config there makes no sense, neither of the new extensions does it

@luthermonson

luthermonson commented May 22, 2026

Copy link
Copy Markdown
Contributor

had claude pull everything and this is what it thinks the problem is with CI

Why it broke now (not a PR regression)

  The earlier runs on this same PR (02:27, 06:11 today) passed. Then it broke at 08:43.

  - 06:11 green run used mongodb-2.3.2.tgz
  - 08:43 failed run used mongodb-2.3.3.tgz
  - mongodb 2.3.3 was released today at 07:07:49Z — right between those two runs
  - spc's ext-mongodb.yml uses type: ghrel + match: mongodb.+\.tgz, which always pulls the latest mongodb release. So CI silently picked up the new
  version.

I'll get a PR up with the fix and we'll see if it's right

luthermonson and others added 6 commits May 22, 2026 10:03
mongo-php-driver 2.3.3 added a config.m4 check that falls back to
php-config when PHP_VERSION_ID is unset in the shell env. In-tree
PHP source builds have no php-config, so configure fails with:

    checking PHP version... configure: error: php-config not found

Set PHP_VERSION_ID from main/php_version.h before configureForUnix
so the lookup short-circuits.
… (bleeds libpq polyfills into php configure, poisoning e.g. have_strlcat results)
@henderkes

Copy link
Copy Markdown
Collaborator Author

(current CI failures are because I didn't forward the temporary fixes for fastchart and clickhouse extensions, iliaa will probably release versions with my fixes upstreamed in a few days)

@crazywhalecc

Copy link
Copy Markdown
Owner

I'd like to merge some easily split parts of this branch into v3 first, so that the branch doesn't become too large and make reviews troublesome.

@henderkes

Copy link
Copy Markdown
Collaborator Author

Yes, I'm getting to a point where building static-php/packages based on this branch is possible. The majority of changes here are really just behaviour fixes that can be applied independently.

henderkes added 13 commits May 24, 2026 12:15
Forward-port the genuinely-new fixes from feat/pgo (2026-06-09 .. 07-09)
into v3's reorganized layout:

- zig-cc.sh: prefix runtime-lib appends with `-x none` so the profile/crt/
  cpu_model archives don't poison the following files as `-x c` sources
- ZigToolchain: set ax_cv_have_func_attribute_ifunc=no under -flto
  (an ifunc in LTO bitcode crashes zig 0.16's lld during thin-link)
- php configure: add --with-sysconfdir option; strip build-time env vars
  from phpinfo's "Configure Command"
- ext-brotli / ext-zstd: switch to stable release/tag tarballs; brotli
  configures with --with-libbrotli
- ext-event: patch libevent http_connection.c to use a const peer address
  (both static and shared builds)
- ghrel downloader: prefer GitHub's /releases/latest (the semantically
  latest stable release) over publish-order iteration, so a newer-tagged
  prerelease (e.g. libevent 2.2.x-alpha) can't win over 2.1.x-stable

Commits already present in v3 were skipped: protobuf-latest + libaom
ENABLE_*=OFF (9398a66), the clang runtime -target flag (2adedc0), the
runtime-bits fail-hard half of 3823631, and github prefer-stable's
prerelease skip (incl. the ghtar /releases/latest path, already in v3).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

need-test This PR has not been tested yet, cannot merge now

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants