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
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
macOS cross-compilation passes Zig-style host triples to Autoconf instead of GNU-compatible Darwin triples, risking validation failures or incorrect configuration and overriding libffi’s valid host argument.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The new --host argument breaks liburing cross-build configuration, while omitting --build can leave Autoconf executing target probes instead of entering cross-compilation mode.
Passing only --host does not force Autoconf into cross-compilation mode: when --build is omitted, configure first attempts to run a compiled test program and stays in native mode if it succeeds. On Linux cross builds with binfmt/QEMU enabled, this still executes target probes instead of using their cross-compilation fallback paths, contrary to the intent of this change. Please also pass an explicit GNU triplet for the build machine so cross mode is selected independently of whether target executables happen to run.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Zig’s cache remains keyed by the target platform rather than the host, allowing incompatible archives to be reused and leaving execution-format failures unresolved.
Key Zig archive cache by host platform, not target
src/Package/Artifact/zig.php:43
Zig's cache still uses the target platform, so an x86_64 host targeting aarch64 reuses a previously cached aarch64 archive and skips this host-selection callback, leaving the execution-format failure unresolved. New host archives are also saved under the target key, allowing incompatible reuse when caches are shared across hosts. Use a host-specific identity consistently for Zig's cache lookup, locking, and extraction, and invalidate legacy entries that do not match the host.
php_micro_fileinfo.c only typedefs Elf_Shdr in its 64-bit (__LP64__)
branch; the 32-bit branch defines Elf_Ehdr and Elf_Phdr but not
Elf_Shdr, and neither glibc's nor musl's elf.h provides a native-class
alias. 64-bit targets build fine; 32-bit targets (arm-linux-musleabihf)
fail with 'use of undeclared identifier Elf_Shdr'.
configureForUnix() ran ./configure without --host/--build, so autoconf
assumed a native build for cross targets and died with exit 77 trying
to execute the arm conftest binary on the x86_64 host
('cannot run C compiled programs'). UnixAutoconfExecutor already does
this for library builds; mirror it for the php target.
…fibers
spc craft prepares artifact downloads as concurrent fibers. Two providers
(llvm-compiler-rt downSource, llvm-tools downBinary) probe the toolchain
clang version at the same moment. getCompilerVersion() set
compiler_version_resolved BEFORE running 'zig cc -dumpversion'; while
the first fiber was suspended inside that probe, the second saw the
resolved flag and got the still-null value, which llvm_tools turned into
'DownloaderException: Cannot determine the clang version of the active
toolchain'. The abort then proc_terminated the first fiber's child before
it produced any output. Set the resolved marker after the probe instead;
concurrent callers redo the cheap probe and all observe a correct value.
zig's musl headers only define the LFS64 typedefs (off64_t etc.) with
_LARGEFILE64_SOURCE; _GNU_SOURCE alone does not, unlike glibc. php-src's
cookie seeker probe resolves HAVE_COOKIE_IO_FUNCTIONS_T_OFF64_T, so
main/streams/cast.c then fails with 'unknown type name off64_t'. Add the
define to the default C/CXX flags and php make extra flags for -musl
targets; it is a no-op on glibc.
- Custom binary fetchers (zig, rust, llvm-tools, go, ...) deliver tools that execute on the build machine, but their download cache, update checks and callback resolution were keyed by SystemTarget::getCurrentPlatformString(), i.e. the build target.
- An x86_64 host building for aarch64 reused a previously cached aarch64 archive (skipping the host-selection callback) and failed with an execution-format error; the zig wrong-arch fix was therefore defeated by the cache.
- Add SystemTarget::getHostPlatformString() and Artifact::getBinaryPlatform(); use the host key consistently for lock (ArtifactDownloader), queue skip (isBinaryDownloaded default), extraction (ArtifactExtractor), tool version record (PackageInstaller), check updates and callback resolution. Config-based binaries keep the target key.
- Legacy target-keyed entries are simply not consulted anymore; extraction re-runs via the .spc-hash check when content differs, so stale incompatible archives recover without manual cache clearing.
- Also fix the same wrong-arch class of bug in rust (GNU_ARCH instead of getTargetArch()) and go-xcaddy (getHostPlatformString() instead of getCurrentPlatformString()).
- EMULATE_PLATFORM is set only by tests to fake the current platform for target-keyed lookups; nothing in src/ or CI ever sets it in production.
- Honoring it in a host platform string would key host-executed tools under a platform they cannot run on, which is exactly the class of failure this key exists to prevent.
- Tests now use SystemTarget::getHostPlatformString() directly instead of the EMULATE-aware getCurrentPlatform() helper for host keys.
I've done a quick review of the changes, but the current implementation is not yet complete I think.
Replace custom_binary_callbacks !== [] with a call to isHostRun(), and then include logic to check whether the package is of the tool type or contains custom methods.
The execution path for hasPlatformBinary() does not behave as expected. It should not rely on the binary's current state for its determination.
While the $pkg_name is known at the time an inline artifact is registered, the current registerInlineArtifact call only stores the configuration without any ownership information. It should record the "owner package", combined with the isHostRun() check (or a similar mechanism) mentioned in the first point, will enable full support for cross-compilation at the artifact level.
- ArtifactConfig::registerInlineArtifact() records the owning package; Artifact::isHostRun()
returns true for tool-owned artifacts and artifacts with custom binary callbacks, so
host-run tools are keyed by the host platform regardless of callback load order.
- hasPlatformBinary(), getBinaryDownloadConfig(), getBinaryExtractConfig() and the
downloader queue/check-update paths select binary config under the artifact's binary
platform instead of the build target.
- ToolVersionRegistry::record() takes the platform from the caller (binary platform for
tools).
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Cross builds still fail because liburing rejects the generated --build argument, and unresolved artifact-platform selection and LLVM license-packaging issues remain.
… callbacks
- liburing: strip the executor-generated --build/--host triples; its hand-written
configure rejects unknown options.
- llvm-tools: copy llvm/LICENSE.TXT into the install root during source builds so
license-files resolves for both install modes.
- Track ownership for referenced (non-inline) artifacts: Package::getArtifact() claims
ownership, with tool packages taking precedence over non-tool claimers.
- Resolve custom binary check-update callbacks and binary extract callbacks under the
artifact's binary platform instead of the host/current platform.
- Cross builds emit target-architecture binaries, so smokeTestForUnix()/
smokeTestFrankenphpForUnix() would exec target binaries on the host and fail the
build with an exec-format error after an otherwise successful compile. Return early
from php::postInstall() while cross-compiling.
- Add PhpPostInstallTest covering the cross-build guard.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because direct downloads of string-referenced tool artifacts can bypass ownership registration and select target binaries instead of host binaries during cross-builds.
Human assessment is needed because direct downloads of string-referenced tool artifacts can bypass ownership registration and select target binaries instead of host binaries during cross-builds.
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
need-testThis PR has not been tested yet, cannot merge now
4 participants
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.
we may have flat brained before