fix(frankenphp): strip Go's -mthreads so the Windows build survives Clang >= 20#1201
Conversation
henderkes
left a comment
There was a problem hiding this comment.
This is most definitely not the right approach. I have a branch somewhere on v3 that successfully builds frankenphp on windows. If we have to create a wrapper around clang-cl it should be a simple inline bash script and not a program we need to compile.
https://github.com/crazywhalecc/static-php-cli/tree/fable-v3-windows
|
OK ! Thanks for your input, I will check on this branch |
…lang >= 20 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, so the final frankenphp go build fails on current windows-latest (VS 18 / LLVM 20+). Wrap Clang with a generated .bat that drops the -mthreads token and forwards the rest, used only when the detected Clang refuses the flag.
4a4c240 to
5a5c784
Compare
|
@henderkes I just changed the base branch to your The .bat seems to be a good solution, for just stripping the |
|
I still don't understand where exactly -mthreads is coming from and why it needs to be stripped. I was able to compile the linked branch without changes with VS26. Is this a new go version? Or what's the cause here? If it's really go this almost certainly has to be raised with the Go team. |
|
It's not a new Go version. Go has always added Here it is on Build log excerptI agree this belongs upstream with Go, I can open an issue there. In the meantime the |
|
Opened the upstream issue with a standalone repro: golang/go#80290 |
|
Ah clang 22, yeah, Go is the right place for this then. In the meantime we should merge it. |
henderkes
left a comment
There was a problem hiding this comment.
We should add a comment linking to the Go issue so we can remove it later.
…n be removed later
|
I just added a link and reference to it, good call ! |
|
Oh wait, this PR is merged into fable-v3-windows branch... |
|
Yes, that contains a bunch of other fixes necessary to make (franken)php build on windows |
Retargeted onto
fable-v3-windowsand cut down to the one thing that branch is missing: the-mthreadsfix. The linking fixes I originally had here are already on your branch (and more complete), so I dropped them.Go passes the MinGW-only
-mthreadsflag to the C compiler for cgo builds (golang/go#16932), and the Clang on currentwindows-latest(VS 18 / LLVM 20+) rejects it for the MSVC target. So the final frankenphpgo buildfails there.This wraps Clang with a generated
.batthat drops the-mthreadstoken and forwards the rest (substring replace, so quoted paths survive). It only kicks in when the detected Clang refuses the flag, so older toolchains are untouched.Verified on
windows-latest:fable-v3-windowsas-is fails atgo buildwithunsupported option '-mthreads'; with this,frankenphp.exebuilds and passesversionandphp-server.Workflow used to build and smoke-test the binary