Repository navigation
Fix doctor on fresh Linux, auto-install llvm-tools for cross builds - #1256
Merged
Merged
Conversation
…builds Follow-up to #1254: - Merge the installer's binary-only package list into a caller's global binary-only instead of replacing it. Since the zig toolchain declares zig in every run, doctor's pkg-config fix built pkg-config from source without zig-cc on PATH and failed on fresh Linux machines. - Replace --with-llvm-tools: ZigToolchain declares llvm-tools for cross builds, and toolchain packages prefer pre-built binaries. - Download pre-built llvm-tools from dl.static-php.dev by host arch and verify the .sha256 sidecar. - Build llvm-tools' private zlib with HAVE_UNISTD_H (clang >= 16). - Use `zig cc -dumpversion`; `--version` left an empty a.o behind. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
henderkes
requested changes
Oct 15, 2026
henderkes
approved these changes
Oct 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Follow-up to #1254, which was merged without these changes.
spc doctor --auto-fixon fresh Linux machines (regression from V3c/llvm tools prev #1254). Since the zig toolchain declareszigin every run,PackageInstaller::run()replaced the doctor's globalbinary-onlywith the list of binary-only packages (zig). The pkg-config fix then built pkg-config from source withzig-cc, which doctor never puts onPATH, and failed with exit code 77. This breaks the first run of static-php/hosted'sllvm-tools.yml(https://github.com/static-php/hosted/actions/runs/38704035893) and every other workflow that starts with doctor. The list is now merged into an existing global flag (DownloaderOptions::addToList()).--with-llvm-tools, as requested in the V3c/llvm tools prev #1254 review.ZigToolchainnow declaresllvm-toolsitself for cross builds, where the host binutils cannot handle the binaries (SystemTarget::isCrossCompiling()reads the architecture from the target triple, so e.g. arm32 targets count too). Toolchain packages prefer the published binary, with the source build as fallback. Native builds keep using the host binutils, and the warnings now point tobin/spc install-pkg llvm-tools.dl.static-php.dev/v3/deps/llvm-tools/, published by static-php/hosted'sllvm-tools.yml. The archive is selected by the host architecture (the tools run on the build machine) and verified against the published.sha256.-DHAVE_UNISTD_H, because clang >= 16 rejects zlib's undeclaredlseek/read/close.a.o:ZigToolchain::getCompilerVersion()useszig cc -dumpversion, becausezig cc --versionleft an emptya.oin the user's working directory on every run.isCrossCompiling()andaddToList().Also validated before #1254 was merged, in a Linux arm64 container (Debian, PHP 8.4):
doctor --auto-fixfrom scratch, thenbuild:libs llvm-tools, producing static binaries (a 2.09 MB archive).Checklist before merging
*.phpor*.yml, run them locally to ensure your changes are valid:composer cs-fix(no changes)composer analyse(no errors)composer test(OK, 465 tests)bin/spc dev:lint-config(no changes)