fix(frankenphp): build a working static binary on Windows#1201
Open
m-this wants to merge 2 commits into
Open
Conversation
Three issues prevented the frankenphp Windows target from linking: - Go passes the MinGW-only -mthreads flag to the C compiler for cgo builds (golang/go#16932); Clang >= 20 rejects it for the MSVC target. Wrap Clang to strip the flag when it is refused. - secur32 (InitSecurityInterfaceA) and pathcch (PathCchCanonicalizeEx, referenced by php8embed since PHP 8.5) were not linked. - zend_atomic_bool_{load,store} are only referenced via __imp_, so their objects were never pulled from php8embed.lib; force them in with /INCLUDE. The embed smoke test needed pathcch too.
This was referenced Jul 6, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The frankenphp Windows target did not link. Three fixes:
-mthreads: for cgo builds Go passes this MinGW-only flag to the C compiler (golang/go#16932), and Clang >= 20 rejects it for the MSVC target. A small wrapper strips the flag, and only kicks in when the detected Clang refuses it.secur32(InitSecurityInterfaceA) andpathcch(PathCchCanonicalizeEx, referenced byphp8embedsince PHP 8.5) are now linked, for both frankenphp and the embed test.zend_atomic_bool_{load,store}: frankenphp only references these via__imp_, so their objects never got pulled fromphp8embed.lib. Forced in with/INCLUDE.Tested on
windows-latestwith PHP 8.5 (ZTS): the resultingfrankenphp.exerunsversion/build-infoand serves a PHP page viaphp-server.Related to #1100.
Workflow used to build and test the binary