Skip to content

[Windows] GD build fails: zlib installs as z.lib/zs.lib but configure expects zlib.lib/zlib_a.lib #1068

@inpq

Description

@inpq

Environment

  • static-php-cli: 2.8.2 (also tested with 2.7.7, same result)
  • Runner: GitHub Actions windows-latest
  • SAPI: micro
  • PHP versions: 8.3, 8.4 (8.4.19 confirmed in logs)
  • Extensions: bcmath,bz2,ctype,curl,dom,fileinfo,filter,ftp,gd,iconv,mbstring,mbregex,mysqlnd,opcache,openssl,pdo,pdo_mysql,pdo_sqlite,phar,soap,session,simplexml,sockets,sqlite3,tokenizer,xmlwriter,xmlreader,xml,zip,zlib

What happens

zlib compiles and installs successfully, but CMake produces files named z.lib and zs.lib:

-- Installing: .../buildroot/lib/z.lib
-- Installing: .../buildroot/lib/zs.lib

Immediately after, SPC's own zlib handler (src/SPC/builder/windows/library/zlib.php) tries to work with zlibstatic.lib and zlib.lib, which do not exist:

PHP Warning: copy(...\buildroot\lib\zlibstatic.lib): Failed to open stream: No such file or directory on line 34
PHP Warning: unlink(...\buildroot\bin\zlib.dll): No such file or directory on line 35
PHP Warning: unlink(...\buildroot\lib\zlib.lib): No such file or directory on line 36

Later, PHP's configure.bat cannot find zlib when checking for GD:
Checking for library zlib_a.lib;zlib.lib ...
ERROR: gd not enabled; zlib not enabled

Build exits with code 1.

Expected behavior

The Windows zlib handler should normalize the installed library names (or update the expected names) so that zlib.lib / zlib_a.lib are present in buildroot/lib before PHP's configure.bat runs.

Workaround tried

Adding a step in the GitHub Actions workflow to manually copy z.libzlib.lib / zlib_a.lib after the full SPC build phase does not work because the files do not exist yet at that point (SPC builds libs internally).

Build command

./bin/spc.exe build --build-micro "bcmath,bz2,ctype,curl,dom,fileinfo,filter,ftp,gd,iconv,mbstring,mbregex,mysqlnd,opcache,openssl,pdo,pdo_mysql,pdo_sqlite,phar,soap,session,simplexml,sockets,sqlite3,tokenizer,xmlwriter,xmlreader,xml,zip,zlib" --debug --with-micro-logo=icon.ico

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions