Skip to content

Commit 61c43b5

Browse files
authored
ci(windows): ship php8embed.lib static dependency libs in the SDK tarball (#16)
The Windows Package SDK step copied only php8embed.lib. spc's --build-embed is a static build: php8embed.lib carries PHP's objects but its third-party deps (openssl/libcrypto, zlib, libxml2, ICU, oniguruma, sqlite3, ...) are separate .lib files. ephpm links the embed lib statically (like libphp.a on Linux/macOS), so those dep libs must ship or the final MSVC link fails with unresolved externals -- the Linux and macOS Package SDK steps already copy every *.a from buildroot/lib for exactly this reason. Copy all *.lib from spc's buildroot*/lib dirs plus php8embed.lib's own directory (scoped to spc output, not a tree-wide sweep that would grab MSVC/Windows-SDK import libs), and print a full .lib inventory so the downstream link's unresolved-externals list can be matched against what actually shipped.
1 parent c2314c9 commit 61c43b5

1 file changed

Lines changed: 39 additions & 8 deletions

File tree

.github/workflows/build.yml

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ jobs:
527527
run: |
528528
New-Item -ItemType Directory -Force -Path sdk/lib, sdk/include
529529
530-
# Find php8embed.lib (fat static library containing all PHP objects)
530+
# Find php8embed.lib (the embed SAPI static library)
531531
$lib = Get-ChildItem -Recurse -Filter "php8embed.lib" -ErrorAction SilentlyContinue | Select-Object -First 1
532532
if ($lib) {
533533
Copy-Item $lib.FullName sdk/lib/
@@ -537,14 +537,45 @@ jobs:
537537
exit 1
538538
}
539539
540-
# Copy any DLLs if present (not expected for spc static builds)
541-
foreach ($name in @("php8embed.dll", "php8ts.dll")) {
542-
$dll = Get-ChildItem -Recurse -Filter $name -ErrorAction SilentlyContinue | Select-Object -First 1
543-
if ($dll) {
544-
Copy-Item $dll.FullName sdk/lib/
545-
Write-Host "==> Found $name at $($dll.FullName)"
546-
}
540+
# Ship php8embed.lib's static dependency libraries too. spc's
541+
# --build-embed is a static build: php8embed.lib carries PHP's
542+
# own objects, but the third-party deps it was compiled against
543+
# (openssl/libcrypto, zlib, libxml2, ICU, oniguruma, sqlite3, ...)
544+
# live as separate .lib files under spc's buildroot. ephpm links
545+
# the embed lib STATICALLY (like libphp.a on Linux/macOS), so those
546+
# dep libs must be in the tarball or the final MSVC link fails with
547+
# unresolved externals. The Linux/macOS Package SDK steps already
548+
# copy every *.a from buildroot/lib for the same reason; do the
549+
# equivalent here.
550+
#
551+
# Sources, in priority order: every buildroot*/lib directory spc
552+
# produced, plus any .lib sitting alongside php8embed.lib. We do NOT
553+
# do a tree-wide *.lib copy -- that would sweep in MSVC/Windows-SDK
554+
# import libs. Scope to spc's own output dirs only.
555+
$depDirs = @()
556+
Get-ChildItem -Recurse -Directory -ErrorAction SilentlyContinue |
557+
Where-Object { $_.Name -eq "lib" -and $_.Parent.Name -like "buildroot*" } |
558+
ForEach-Object { $depDirs += $_.FullName }
559+
$depDirs += (Split-Path $lib.FullName -Parent)
560+
$depDirs = $depDirs | Select-Object -Unique
561+
$copied = 0
562+
foreach ($dir in $depDirs) {
563+
Get-ChildItem -Path $dir -Filter "*.lib" -File -ErrorAction SilentlyContinue |
564+
ForEach-Object {
565+
Copy-Item $_.FullName sdk/lib/ -Force
566+
$copied++
567+
}
547568
}
569+
Write-Host "==> Staged $copied .lib file(s) from spc buildroot dirs: $($depDirs -join ', ')"
570+
571+
# Diagnostic: full inventory of every .lib spc produced anywhere in
572+
# the tree (path + size). If the downstream static link still hits
573+
# unresolved externals, this log pinpoints which lib provides the
574+
# missing symbols and whether it shipped.
575+
Write-Host "==> Full .lib inventory in build tree:"
576+
Get-ChildItem -Recurse -Filter "*.lib" -File -ErrorAction SilentlyContinue |
577+
Sort-Object FullName |
578+
ForEach-Object { Write-Host (" {0,12:N0} {1}" -f $_.Length, $_.FullName) }
548579
549580
Copy-Item -Recurse buildroot/include/php sdk/include/php
550581

0 commit comments

Comments
 (0)