From 203fed65d90e909bcd7794d8b3da41903a20f3f3 Mon Sep 17 00:00:00 2001 From: henderkes Date: Sat, 23 May 2026 16:14:49 +0700 Subject: [PATCH] dont pass shared extension packages to SPCConfigUtil for building php (bleeds libpq polyfills into php configure, poisoning e.g. have_strlcat results) --- src/StaticPHP/Doctor/Item/LlvmCompilerRtCheck.php | 4 ++-- src/StaticPHP/Package/PackageInstaller.php | 14 ++++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/StaticPHP/Doctor/Item/LlvmCompilerRtCheck.php b/src/StaticPHP/Doctor/Item/LlvmCompilerRtCheck.php index 72f172b8..5fff75c4 100644 --- a/src/StaticPHP/Doctor/Item/LlvmCompilerRtCheck.php +++ b/src/StaticPHP/Doctor/Item/LlvmCompilerRtCheck.php @@ -28,7 +28,7 @@ class LlvmCompilerRtCheck #[CheckItem('if llvm-compiler-rt is built for current target', level: 799)] public function checkLlvmCompilerRt(): CheckResult { - $libDir = zig::dir() . '/lib/' . SystemTarget::getCanonicalTriple(); + $libDir = zig::path() . '/lib/' . SystemTarget::getCanonicalTriple(); if (new llvm_compiler_rt()->isBuilt($libDir)) { return CheckResult::ok($libDir); } @@ -42,7 +42,7 @@ class LlvmCompilerRtCheck $installer->addInstallPackage('llvm-compiler-rt'); $installer->run(true); new llvm_compiler_rt()->buildForTriple(); - $libDir = zig::dir() . '/lib/' . SystemTarget::getCanonicalTriple(); + $libDir = zig::path() . '/lib/' . SystemTarget::getCanonicalTriple(); return new llvm_compiler_rt()->isBuilt($libDir); } } diff --git a/src/StaticPHP/Package/PackageInstaller.php b/src/StaticPHP/Package/PackageInstaller.php index b68c855b..fbfd3d52 100644 --- a/src/StaticPHP/Package/PackageInstaller.php +++ b/src/StaticPHP/Package/PackageInstaller.php @@ -304,11 +304,9 @@ class PackageInstaller } /** - * Get resolved package names filtered to only packages whose build artifacts are available. - * This excludes library packages that haven't been built/installed yet, which naturally - * prevents SPCConfigUtil from checking static-lib files of libraries that come after - * the current target in the build order (e.g. 'watcher' for frankenphp isn't built - * when 'php' is being compiled). + * Get resolved package names whose build artifacts contribute to the PHP main link. + * Excludes libraries not yet built (so SPCConfigUtil doesn't probe their .a files) and + * shared-only extensions (they link separately into their own .so). * * @return string[] Available resolved package names */ @@ -318,12 +316,12 @@ class PackageInstaller array_keys($this->packages), function (string $name): bool { $pkg = $this->packages[$name] ?? null; - // Exclude library packages whose build artifacts don't exist yet. - // Extensions and targets are not filtered — extensions are compiled into PHP - // and don't have standalone build artifacts. if ($pkg instanceof LibraryPackage && $pkg->getType() === 'library' && !$pkg->isInstalled()) { return false; } + if ($pkg instanceof PhpExtensionPackage && $pkg->isBuildShared() && !$pkg->isBuildStatic()) { + return false; + } return true; } ));