build(win): compile WebSocket on Windows - #303
Merged
Merged
Conversation
`config.w32` listed core, http1, formats, log, room, static and llhttp, and never `src/websocket` or the bundled wslay: the class did not exist in a Windows build and its whole phpt group failed, which is most of what `WINDOWS_X64_ZTS_RELEASE` reports as red on main. Nothing platform specific was in the way — the recipe simply did not name the sources. Three things the port needed. wslay's translation units include no PHP header, so the macros this extension owns are passed on the command line as the compression block already does. `wslay.h` types its callbacks with `ssize_t`, which MSVC does not have and php-src answers with `#define ssize_t SSIZE_T` in a header those units never see; SSIZE_T comes from BaseTsd.h, force-included because wslay includes no Windows header of its own. And the block sits below the include-path section because ADD_FLAG skips a flag that is a substring of one already added: the wslay include path added first swallowed the module root's own `/I`. CI needs no change: it does not pass `--disable-all`, so the new `--enable-websocket` takes its default. Evidence: the group goes from absent to 60 of 61 executed tests passing on Windows; the whole phpt tree reads 496 tests, 270 passed, 2 failed. One is `websocket/035-recv-queue-overflow`, which fails 2 of 3 runs here and is not a build problem: its client reads the stream expecting the CLOSE frame first and misparses anything the server sends ahead of it. The other is a test of an unrelated branch present in the working copy.
Contributor
CoverageTotal lines: 82.98% → 82.99% (+0.02 pp)
|
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.
config.w32named core, http1, formats, log, room, static and llhttp, and neversrc/websocketor the bundled wslay. SoTrueAsync\WebSocketdid not exist in a Windows build and its entire phpt group failed — most of whatWINDOWS_X64_ZTS_RELEASEhas been reporting as red onmain. Nothing platform-specific stood in the way; the recipe simply did not list the sources.Three things the port needed, and each is a trap worth naming:
main/config.w32.hnever arrives there, soHAVE_WSLAYandHAVE_HTTP_SERVER_WEBSOCKETare passed on the command line, exactly as fix(build): pass the compression feature macros to the Windows build #292 had to do for compression.wslay.htypes its callbacks withssize_t, which MSVC does not have. php-src answers this with#define ssize_t SSIZE_Tinmain/config.w32.h— a header those units never see.SSIZE_Titself comes fromBaseTsd.h, force-included becausewslay.hincludes onlystdint.h,stdlib.handsys/types.h.ADD_FLAGskips a flag that is a substring of one already added: with the wslay include path added first, the module root's own/Iwas dropped and every file reached throughphp_true_async_server.hstopped resolving.CI needs no change — the Windows workflow does not pass
--disable-all, so the new--enable-websocket(default yes, mirroring config.m4) applies on its own.Evidence. On this Windows build the group goes from absent to 60 of 61 executed tests passing; the whole phpt tree reads 496 tests, 270 passed, 224 skipped, 2 failed.
One of those two is real and outside this change:
websocket/035-recv-queue-overflowfails 2 runs of 3 here withclient saw close: NULL, while the handler side reports 1013 correctly. Its client reads the socket into one buffer and looks for the CLOSE opcode at byte 0, so anything the server sends ahead of the close leaves it parsing a data frame's header forever. That is a framing assumption in the test, not a build problem, and it wants its own change.The other failure is
core/078-listener-port-zero, which belongs to #302 and is present in the working copy but not in this build.