From e12fb33b03769927b0cb74d3a81a343d7fe7691f Mon Sep 17 00:00:00 2001 From: gpb Date: Fri, 20 Feb 2026 14:10:52 +0800 Subject: [PATCH 1/9] fix zlib Windows build for 1.3.2+ cmake output naming change Fixes #1039 zlib 1.3.2 changed cmake output file names on Windows: zlibstatic.lib -> zs.lib, zlib.lib -> z.lib, zlib.dll -> z.dll Update all references to use the new names directly. --- config/lib.json | 2 +- src/SPC/builder/windows/library/openssl.php | 4 ++-- src/SPC/builder/windows/library/zlib.php | 9 ++++++--- src/globals/extra/gd_config_80.w32 | 2 +- src/globals/extra/gd_config_81.w32 | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/config/lib.json b/config/lib.json index ebbf4b87b..8c4b78252 100644 --- a/config/lib.json +++ b/config/lib.json @@ -1019,7 +1019,7 @@ "libz.a" ], "static-libs-windows": [ - "zlib_a.lib" + "zs.lib" ], "headers": [ "zlib.h", diff --git a/src/SPC/builder/windows/library/openssl.php b/src/SPC/builder/windows/library/openssl.php index 491a33b4d..5daebf01c 100644 --- a/src/SPC/builder/windows/library/openssl.php +++ b/src/SPC/builder/windows/library/openssl.php @@ -42,13 +42,13 @@ protected function build(): void ); // patch zlib - FileSystem::replaceFileStr($this->source_dir . '\Makefile', 'ZLIB1', 'zlibstatic.lib'); + FileSystem::replaceFileStr($this->source_dir . '\Makefile', 'ZLIB1', 'zs.lib'); // patch debug: https://stackoverflow.com/questions/18486243/how-do-i-build-openssl-statically-linked-against-windows-runtime FileSystem::replaceFileStr($this->source_dir . '\Makefile', '/debug', '/incremental:no /opt:icf /dynamicbase /nxcompat /ltcg /nodefaultlib:msvcrt'); cmd()->cd($this->source_dir)->execWithWrapper( $this->builder->makeSimpleWrapper('nmake'), 'install_dev ' . - 'CNF_LDFLAGS="/NODEFAULTLIB:kernel32.lib /NODEFAULTLIB:msvcrt /NODEFAULTLIB:msvcrtd /DEFAULTLIB:libcmt /LIBPATH:' . BUILD_LIB_PATH . ' zlibstatic.lib"' + 'CNF_LDFLAGS="/NODEFAULTLIB:kernel32.lib /NODEFAULTLIB:msvcrt /NODEFAULTLIB:msvcrtd /DEFAULTLIB:libcmt /LIBPATH:' . BUILD_LIB_PATH . ' zs.lib"' ); copy($this->source_dir . '\ms\applink.c', BUILD_INCLUDE_PATH . '\openssl\applink.c'); diff --git a/src/SPC/builder/windows/library/zlib.php b/src/SPC/builder/windows/library/zlib.php index 03fd033b9..accd3dcfd 100644 --- a/src/SPC/builder/windows/library/zlib.php +++ b/src/SPC/builder/windows/library/zlib.php @@ -31,8 +31,11 @@ protected function build(): void $this->builder->makeSimpleWrapper('cmake'), "--build build --config Release --target install -j{$this->builder->concurrency}" ); - copy(BUILD_LIB_PATH . '\zlibstatic.lib', BUILD_LIB_PATH . '\zlib_a.lib'); - unlink(BUILD_ROOT_PATH . '\bin\zlib.dll'); - unlink(BUILD_LIB_PATH . '\zlib.lib'); + // zlib 1.3.2 changed cmake output names on Windows (see #1039): + // zlibstatic.lib -> zs.lib + // zlib.lib -> z.lib + // zlib.dll -> z.dll + unlink(BUILD_ROOT_PATH . '\bin\z.dll'); + unlink(BUILD_LIB_PATH . '\z.lib'); } } diff --git a/src/globals/extra/gd_config_80.w32 b/src/globals/extra/gd_config_80.w32 index ea7582b86..8c29f91c6 100644 --- a/src/globals/extra/gd_config_80.w32 +++ b/src/globals/extra/gd_config_80.w32 @@ -9,7 +9,7 @@ if (PHP_GD != "no") { } // zlib ext support (required) - if (!CHECK_LIB("zlib_a.lib;zlib.lib", "gd", PHP_GD)) { + if (!CHECK_LIB("zs.lib", "gd", PHP_GD)) { ERROR("gd not enabled; zlib not enabled"); } diff --git a/src/globals/extra/gd_config_81.w32 b/src/globals/extra/gd_config_81.w32 index 528de3194..c106e2a73 100644 --- a/src/globals/extra/gd_config_81.w32 +++ b/src/globals/extra/gd_config_81.w32 @@ -9,7 +9,7 @@ if (PHP_GD != "no") { } // zlib ext support (required) - if (!CHECK_LIB("zlib_a.lib;zlib.lib", "gd", PHP_GD)) { + if (!CHECK_LIB("zs.lib", "gd", PHP_GD)) { ERROR("gd not enabled; zlib not enabled"); } From f483649766ade148521682b08288ffe3bf69ff9f Mon Sep 17 00:00:00 2001 From: gpb Date: Fri, 20 Feb 2026 15:42:21 +0800 Subject: [PATCH 2/9] remove superfluous comments --- src/SPC/builder/windows/library/zlib.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/SPC/builder/windows/library/zlib.php b/src/SPC/builder/windows/library/zlib.php index accd3dcfd..413151d6f 100644 --- a/src/SPC/builder/windows/library/zlib.php +++ b/src/SPC/builder/windows/library/zlib.php @@ -31,10 +31,6 @@ protected function build(): void $this->builder->makeSimpleWrapper('cmake'), "--build build --config Release --target install -j{$this->builder->concurrency}" ); - // zlib 1.3.2 changed cmake output names on Windows (see #1039): - // zlibstatic.lib -> zs.lib - // zlib.lib -> z.lib - // zlib.dll -> z.dll unlink(BUILD_ROOT_PATH . '\bin\z.dll'); unlink(BUILD_LIB_PATH . '\z.lib'); } From f0c925d4ffb03cf1f946340033d444e86470b9b1 Mon Sep 17 00:00:00 2001 From: Marc Date: Sat, 21 Feb 2026 12:43:21 +0700 Subject: [PATCH 3/9] Update test-extensions.php for OS configurations --- src/globals/test-extensions.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index ba02e672d..ed738e076 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -26,12 +26,12 @@ // 'macos-15-intel', // bin/spc for x86_64 // 'macos-15', // bin/spc for arm64 // 'ubuntu-latest', // bin/spc-alpine-docker for x86_64 - 'ubuntu-22.04', // bin/spc-gnu-docker for x86_64 - 'ubuntu-24.04', // bin/spc for x86_64 - 'ubuntu-22.04-arm', // bin/spc-gnu-docker for arm64 - 'ubuntu-24.04-arm', // bin/spc for arm64 - // 'windows-2022', // .\bin\spc.ps1 - // 'windows-2025', + // 'ubuntu-22.04', // bin/spc-gnu-docker for x86_64 + // 'ubuntu-24.04', // bin/spc for x86_64 + // 'ubuntu-22.04-arm', // bin/spc-gnu-docker for arm64 + // 'ubuntu-24.04-arm', // bin/spc for arm64 + 'windows-2022', // .\bin\spc.ps1 + 'windows-2025', ]; // whether enable thread safe @@ -50,7 +50,7 @@ // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). $extensions = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => 'pgsql', + 'Linux', 'Darwin' => 'zlib', 'Windows' => 'com_dotnet', }; From a85097ef709b8aab2de2935ea0cba69b1fe64642 Mon Sep 17 00:00:00 2001 From: Marc Date: Sat, 21 Feb 2026 12:54:27 +0700 Subject: [PATCH 4/9] Change Windows base combination from 'none' to 'common' --- src/globals/test-extensions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index ed738e076..d54175562 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -75,7 +75,7 @@ // note: combination is only available for *nix platform. Windows must use `none` combination $base_combination = match (PHP_OS_FAMILY) { 'Linux', 'Darwin' => 'minimal', - 'Windows' => 'none', + 'Windows' => 'common', }; // -------------------------- code area, do not modify -------------------------- From 0c89e22f4aa212caa268c0edfc2666cf740db3d9 Mon Sep 17 00:00:00 2001 From: Marc Date: Sat, 21 Feb 2026 13:08:25 +0700 Subject: [PATCH 5/9] Modify PHP extensions and base combination for Windows Updated the list of PHP extensions for Windows and changed the base combination setting. --- src/globals/test-extensions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index d54175562..0381344a7 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -51,7 +51,7 @@ // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). $extensions = match (PHP_OS_FAMILY) { 'Linux', 'Darwin' => 'zlib', - 'Windows' => 'com_dotnet', + 'Windows' => 'amqp,apcu,bcmath,bz2,calendar,ctype,curl,dba,dom,ds,exif,ffi,fileinfo,filter,ftp,gd,iconv,igbinary,libxml,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pdo,pdo_mysql,pdo_sqlite,pdo_sqlsrv,phar,rar,redis,session,shmop,simdjson,simplexml,soap,sockets,sqlite3,sqlsrv,ssh2,sysvshm,tokenizer,xml,xmlreader,xmlwriter,yac,yaml,zip,zlib', }; // If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`). @@ -75,7 +75,7 @@ // note: combination is only available for *nix platform. Windows must use `none` combination $base_combination = match (PHP_OS_FAMILY) { 'Linux', 'Darwin' => 'minimal', - 'Windows' => 'common', + 'Windows' => 'none', }; // -------------------------- code area, do not modify -------------------------- From cdde34398efa5d23e40848be669dcddc79c7fda8 Mon Sep 17 00:00:00 2001 From: gpb Date: Sun, 22 Feb 2026 06:54:52 +0800 Subject: [PATCH 6/9] Add ZLIB_LIBRARY path to zs.lib to SystemUtil::makeCmakeToolchainFile() remove gd as it has pre-existing other issue copy zs.lib to zlib_a.lib to see if it builds at least 7 extensions all rely on zlib_a.lib in their config.w32 windows pdo is enabled by default pdo_sqlsrv compilation errors against PHP 8.5 skip openssl_password_hash check in ZTS mode Fixes assertion fail in text since now PHP 8.5 disables openssl_password_hash in ZTS mode flag is PHP_ZTS not ZTS --- src/SPC/builder/windows/SystemUtil.php | 1 + src/SPC/builder/windows/library/zlib.php | 1 + src/globals/ext-tests/openssl.php | 2 +- src/globals/test-extensions.php | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/SPC/builder/windows/SystemUtil.php b/src/SPC/builder/windows/SystemUtil.php index 3a0c23ae4..2caf88e15 100644 --- a/src/SPC/builder/windows/SystemUtil.php +++ b/src/SPC/builder/windows/SystemUtil.php @@ -96,6 +96,7 @@ public static function makeCmakeToolchainFile(?string $cflags = null, ?string $l SET(CMAKE_EXE_LINKER_FLAGS "{$ldflags}") SET(CMAKE_FIND_ROOT_PATH "{$buildroot}") SET(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded) +SET(ZLIB_LIBRARY "{$buildroot}/lib/zs.lib") CMAKE; if (!is_dir(SOURCE_PATH)) { FileSystem::createDir(SOURCE_PATH); diff --git a/src/SPC/builder/windows/library/zlib.php b/src/SPC/builder/windows/library/zlib.php index 413151d6f..7b4763684 100644 --- a/src/SPC/builder/windows/library/zlib.php +++ b/src/SPC/builder/windows/library/zlib.php @@ -33,5 +33,6 @@ protected function build(): void ); unlink(BUILD_ROOT_PATH . '\bin\z.dll'); unlink(BUILD_LIB_PATH . '\z.lib'); + copy(BUILD_LIB_PATH . '\zs.lib', BUILD_LIB_PATH . '\zlib_a.lib'); } } diff --git a/src/globals/ext-tests/openssl.php b/src/globals/ext-tests/openssl.php index c687d0fc7..66b33a45f 100644 --- a/src/globals/ext-tests/openssl.php +++ b/src/globals/ext-tests/openssl.php @@ -31,6 +31,6 @@ } assert($valid); } -if (PHP_VERSION_ID >= 80500 && defined('OPENSSL_VERSION_NUMBER') && OPENSSL_VERSION_NUMBER >= 0x30200000) { +if (PHP_VERSION_ID >= 80500 && defined('PHP_ZTS') && PHP_ZTS === 0 && defined('OPENSSL_VERSION_NUMBER') && OPENSSL_VERSION_NUMBER >= 0x30200000) { assert(function_exists('openssl_password_hash')); } diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 0381344a7..5c74565b0 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -51,7 +51,7 @@ // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). $extensions = match (PHP_OS_FAMILY) { 'Linux', 'Darwin' => 'zlib', - 'Windows' => 'amqp,apcu,bcmath,bz2,calendar,ctype,curl,dba,dom,ds,exif,ffi,fileinfo,filter,ftp,gd,iconv,igbinary,libxml,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pdo,pdo_mysql,pdo_sqlite,pdo_sqlsrv,phar,rar,redis,session,shmop,simdjson,simplexml,soap,sockets,sqlite3,sqlsrv,ssh2,sysvshm,tokenizer,xml,xmlreader,xmlwriter,yac,yaml,zip,zlib', + 'Windows' => 'amqp,apcu,bcmath,bz2,calendar,ctype,curl,dba,dom,ds,exif,ffi,fileinfo,filter,ftp,iconv,igbinary,libxml,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pdo_mysql,pdo_sqlite,phar,rar,redis,session,shmop,simdjson,simplexml,soap,sockets,sqlite3,sqlsrv,ssh2,sysvshm,tokenizer,xml,xmlreader,xmlwriter,yac,yaml,zip,zlib', }; // If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`). From a66db67515d2b12a82f7422132a1fa756b60b4e0 Mon Sep 17 00:00:00 2001 From: gpb Date: Sun, 22 Feb 2026 13:05:31 +0800 Subject: [PATCH 7/9] =?UTF-8?q?revert=20all=20workarounds=20except=20copy?= =?UTF-8?q?=20zs.lib=20=E2=9F=B6=20zlib=5Fa.lib?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SPC/builder/windows/SystemUtil.php | 1 - src/globals/ext-tests/openssl.php | 2 +- src/globals/test-extensions.php | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/SPC/builder/windows/SystemUtil.php b/src/SPC/builder/windows/SystemUtil.php index 2caf88e15..3a0c23ae4 100644 --- a/src/SPC/builder/windows/SystemUtil.php +++ b/src/SPC/builder/windows/SystemUtil.php @@ -96,7 +96,6 @@ public static function makeCmakeToolchainFile(?string $cflags = null, ?string $l SET(CMAKE_EXE_LINKER_FLAGS "{$ldflags}") SET(CMAKE_FIND_ROOT_PATH "{$buildroot}") SET(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded) -SET(ZLIB_LIBRARY "{$buildroot}/lib/zs.lib") CMAKE; if (!is_dir(SOURCE_PATH)) { FileSystem::createDir(SOURCE_PATH); diff --git a/src/globals/ext-tests/openssl.php b/src/globals/ext-tests/openssl.php index 66b33a45f..c687d0fc7 100644 --- a/src/globals/ext-tests/openssl.php +++ b/src/globals/ext-tests/openssl.php @@ -31,6 +31,6 @@ } assert($valid); } -if (PHP_VERSION_ID >= 80500 && defined('PHP_ZTS') && PHP_ZTS === 0 && defined('OPENSSL_VERSION_NUMBER') && OPENSSL_VERSION_NUMBER >= 0x30200000) { +if (PHP_VERSION_ID >= 80500 && defined('OPENSSL_VERSION_NUMBER') && OPENSSL_VERSION_NUMBER >= 0x30200000) { assert(function_exists('openssl_password_hash')); } diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 5c74565b0..0381344a7 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -51,7 +51,7 @@ // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). $extensions = match (PHP_OS_FAMILY) { 'Linux', 'Darwin' => 'zlib', - 'Windows' => 'amqp,apcu,bcmath,bz2,calendar,ctype,curl,dba,dom,ds,exif,ffi,fileinfo,filter,ftp,iconv,igbinary,libxml,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pdo_mysql,pdo_sqlite,phar,rar,redis,session,shmop,simdjson,simplexml,soap,sockets,sqlite3,sqlsrv,ssh2,sysvshm,tokenizer,xml,xmlreader,xmlwriter,yac,yaml,zip,zlib', + 'Windows' => 'amqp,apcu,bcmath,bz2,calendar,ctype,curl,dba,dom,ds,exif,ffi,fileinfo,filter,ftp,gd,iconv,igbinary,libxml,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pdo,pdo_mysql,pdo_sqlite,pdo_sqlsrv,phar,rar,redis,session,shmop,simdjson,simplexml,soap,sockets,sqlite3,sqlsrv,ssh2,sysvshm,tokenizer,xml,xmlreader,xmlwriter,yac,yaml,zip,zlib', }; // If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`). From 69137da7b9dc69ee7b4ce6bebeb70748b4343b76 Mon Sep 17 00:00:00 2001 From: gpb Date: Sun, 22 Feb 2026 13:47:42 +0800 Subject: [PATCH 8/9] one more file copy? --- src/SPC/builder/windows/library/zlib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SPC/builder/windows/library/zlib.php b/src/SPC/builder/windows/library/zlib.php index 7b4763684..acaf9165b 100644 --- a/src/SPC/builder/windows/library/zlib.php +++ b/src/SPC/builder/windows/library/zlib.php @@ -34,5 +34,6 @@ protected function build(): void unlink(BUILD_ROOT_PATH . '\bin\z.dll'); unlink(BUILD_LIB_PATH . '\z.lib'); copy(BUILD_LIB_PATH . '\zs.lib', BUILD_LIB_PATH . '\zlib_a.lib'); + copy(BUILD_LIB_PATH . '\zs.lib', BUILD_LIB_PATH . '\zlibstatic.lib'); } } From fcadaf32318f982ccc643b25aaa13a92d843fbd7 Mon Sep 17 00:00:00 2001 From: gpb Date: Sun, 22 Feb 2026 14:09:09 +0800 Subject: [PATCH 9/9] gd is broken --- src/globals/test-extensions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 0381344a7..8c0c42eb5 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -51,7 +51,7 @@ // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). $extensions = match (PHP_OS_FAMILY) { 'Linux', 'Darwin' => 'zlib', - 'Windows' => 'amqp,apcu,bcmath,bz2,calendar,ctype,curl,dba,dom,ds,exif,ffi,fileinfo,filter,ftp,gd,iconv,igbinary,libxml,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pdo,pdo_mysql,pdo_sqlite,pdo_sqlsrv,phar,rar,redis,session,shmop,simdjson,simplexml,soap,sockets,sqlite3,sqlsrv,ssh2,sysvshm,tokenizer,xml,xmlreader,xmlwriter,yac,yaml,zip,zlib', + 'Windows' => 'amqp,apcu,bcmath,bz2,calendar,ctype,curl,dba,dom,ds,exif,ffi,fileinfo,filter,ftp,iconv,igbinary,libxml,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pdo,pdo_mysql,pdo_sqlite,pdo_sqlsrv,phar,rar,redis,session,shmop,simdjson,simplexml,soap,sockets,sqlite3,sqlsrv,ssh2,sysvshm,tokenizer,xml,xmlreader,xmlwriter,yac,yaml,zip,zlib', }; // If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`).