Repository navigation
build: add synchronization.lib to crates build on Windows - #67590
Open
Renegade334 wants to merge 1 commit into
Open
Renegade334 wants to merge 1 commit into
Renegade334 wants to merge 1 commit into
Conversation
Signed-off-by: René <rene@renegade334.me.uk>
Collaborator
|
Review requested:
|
Member
Author
|
The coverage-windows job in this PR ran on a GHA runner that still had rustc 1.99, whereas the build errors only materialised with 1.100. A manual GHA run with 1.100 was successful. |
Member
|
I ran a local test on this branch on Windows 11 26H2 with Node.js 26.13.1 installed using PowerShell 7 rustup update
git clean -xfd
rustup override set 1.88
.\vcbuild.bat ccache c:\ccache\
git clean -xfd
rustup override set 1.99.1
.\vcbuild.bat ccache c:\ccache\
git clean -xfd
rustup override unset
.\vcbuild.bat ccache c:\ccache\
Original failure rust 1.100.0lld-link : error : undefined symbol: __declspec(dllimport) WakeByAddressSingle
...
lld-link : error : undefined symbol: __declspec(dllimport) WakeByAddressAll
...
lld-link : error : undefined symbol: __declspec(dllimport) WaitOnAddressConclusionResolves #67589 without regressions. Due to successful landing of #67591, CI in the main branch will now be running with |
Collaborator
wszgrcy
pushed a commit
to wszgrcy/GodotJS-Dependencies
that referenced
this pull request
Nov 20, 2026
Run 44652514543 lost windows x86_64/arm64, macos x86_64 and both iOS entries; linux, android and macOS arm64 were fine. Each failure had its own cause. Windows (both arches): every link of node_crates.lib stopped with error LNK2019: unresolved external symbol __imp_WaitOnAddress / __imp_WakeByAddressSingle / __imp_WakeByAddressAll referenced from std-*.rcgu.o. Meaning: Temporal is Rust, cargo builds it into a static library, and Node hands that library to link.exe like any other archive - so every symbol std references has to be findable through an import library. WaitOnAddress/WakeByAddress* live in Synchronization.lib (MSDN: header synchapi.h, served by API-MS-Win-Core-Synch-l1-2-0.dll) and Node never names it. Until Rust 1.99 std declared those three with a raw-dylib link attribute, which needs no import library - verified by comparing library/std/src/sys/pal/windows/c.rs at 1.99.0 and 1.100.0: the block is gone in 1.100.0, only the win7 runtime-loading fallback is left. So the same Node source built green with the image's 1.99.1 on Nov 18 and red with 1.100.0 on Nov 20. The fix is to name the library, not to hold the compiler back: patches/godotjs-node-crates-win-synchronization.patch adds -lsynchronization to the Windows link_settings of deps/crates/crates.gyp - the same one-line change as nodejs/node#67590 for nodejs/node#67589, still open upstream, so this patch can be deleted once that lands. Checked against real Node 26.13.1 sources: applies forward, and the reverse check recognises it as already applied. On the Rust version, since the pin first suggested here was the wrong instinct: Node sets only a floor, rustc and cargo >= 1.86 with LLVM >= 19 (BUILDING.md, and deps/crates/Cargo.toml's rust-version), and carries no rust-toolchain file. Node's Windows CI declares RUSTC_VERSION 1.88, but nodejs/node#67589 says that override has been failing quietly, so upstream really builds against the image's rolling stable - which is why the runner's version moving is what surfaced this. The workflow therefore uses the image's Rust, and NODE_RUST_TOOLCHAIN can name a version when reproducing a build matters. windows arm64 also never got GODOTJS_NODE_CLANG_CL: "is this the runner's own architecture" was asked with uname -m, and Git Bash on a Windows-on-ARM runner reports x86_64 there (log: "arch arm64 is not the runner's arch (x86_64)"), so the entry took the cross branch. VSCMD_ARG_HOST_ARCH from the Visual Studio step says it correctly; uname -m stays as a warned fallback. macos x86_64 and ios: the workflow called $GITHUB_WORKSPACE/tools/apple_toolchain.sh, but the build job checks this repository out under Scripts/ (only pick uses the default path), so it died with 127 before configure. Both call sites name Scripts/tools/ now. ios x86_64 (the simulator): rustup target add x86_64-apple-ios-sim is rejected by stable Rust, and rightly - neither the 1.99.1 nor the 1.100.0 dist manifest has a standard library for that triple (both have aarch64-apple-ios-sim). The matrix entry declares temporal=off, the job turns that into NODE_TEMPORAL=off, and the args file records what the bundle lacks. The device bundle keeps Temporal. lws iOS simulator: lipo takes the file before the command (usage is "lipo <input_file> <command>"), so "lipo -verify_arch x86_64 <file>" read the path as an architecture flag. The check now passes the file first and reads LC_BUILD_VERSION from extracted archive members, so it no longer depends on how otool happens to treat archives.
wszgrcy
pushed a commit
to wszgrcy/GodotJS-Dependencies
that referenced
this pull request
Nov 20, 2026
Runs 44652514543 and 44664449521 lost windows x86_64/arm64 and both iOS entries; linux, android and macOS arm64 built. Five separate causes, each with its own fix. Windows: every link of node_crates.lib stopped with error LNK2019: unresolved external symbol __imp_WaitOnAddress / __imp_WakeByAddressSingle / __imp_WakeByAddressAll referenced from std-*.rcgu.o. Temporal is Rust, cargo builds it into a static library, and Node hands that archive to link.exe like any other one - so every symbol std references has to be reachable through an import library. WaitOnAddress/WakeByAddress* live in Synchronization.lib (MSDN: header synchapi.h, served by API-MS-Win-Core-Synch-l1-2-0.dll) and Node never names it. Until Rust 1.99 std declared them through a raw-dylib link attribute, which needs no import library - compared library/std/src/sys/pal/windows/c.rs at 1.99.0 and 1.100.0: the block is gone in 1.100.0, only the win7 runtime-loading fallback is left - so the same Node source built green with the image's 1.99.1 and red with 1.100.0. Naming the library is the fix, and upstream agrees: patches/ godotjs-node-crates-win-synchronization.patch adds -lsynchronization to the Windows link_settings of deps/crates/crates.gyp, the one line of nodejs/node#67590 (for nodejs/node#67589), still open there, so this patch can go once that lands. Verified against real Node 26.13.1 sources: applies forward, reverse check reads it as already applied. Nothing holds the compiler back over this. Node sets only a floor (rustc and cargo >= 1.86 with LLVM >= 19 in BUILDING.md, rust-version = "1.86" in deps/crates/Cargo.toml) and carries no rust-toolchain file; its own Windows CI declares 1.88 while nodejs/node#67589 says that override has been failing quietly, so upstream builds against the image's rolling stable too. The workflow uses the runner's Rust, and NODE_RUST_TOOLCHAIN can name a version when reproducing a build matters. Windows architecture detection, both places it was wrong. Git Bash on the Windows-on-ARM runner reports x86_64 on an arm64 machine, so: - the workflow's "is clang-cl allowed here" test took the cross branch and left GODOTJS_NODE_CLANG_CL unset, and prepare_node_build.sh then refused to run; - prepare_node_build.sh read the same lie and called a native arm64 build a cross build, which is exactly the case where Temporal is refused (crates.gyp names the Rust archive after the target architecture, so host and target would collide). Both now ask Visual Studio's own environment first: VSCMD_ARG_HOST_ARCH, which the Visual Studio step publishes for the whole job and which spells the answer x64 or arm64 (the run logs show x64 on windows-2022 and arm64 on windows-11-arm). uname -m stays as a fallback and says out loud when it is used. prepare_node_build.sh also accepts NODE_HOST_CPU for a job that wants to say it directly. iOS: the compile lines carried no C++ standard at all, so the first C++ file stopped at deps/v8/include/v8config.h, "C++20 or later required." - and it stopped on the host toolset (obj.host/...), which is why it looked like a toolchain problem rather than a flag problem. Cause: gyp's ninja generator turns xcode_settings into flags only for the mac flavour (tools/gyp/pylib/gyp/generator/ninja.py, `if self.flavor == "mac"`), and Node names its standard and exception setting there (common.gypi: CLANG_CXX_LANGUAGE_STANDARD=gnu++20, GCC_ENABLE_CPP_EXCEPTIONS=NO). With --dest-os=ios the flavour is ios, so nothing ever passed -std=. tools/ apple_toolchain.sh now bakes -std=gnu++20 -fno-exceptions into the iOS C++ wrappers, plus a host_cxx that adds the same flags without aiming the compiler at the SDK, and it prints CXX_host pointing at it; macOS is untouched because gyp handles that flavour itself. tools/test_apple_toolchain.sh grew the matching assertions (44 checks, no Xcode needed). ios x86_64 (the simulator): rustup target add x86_64-apple-ios-sim is rejected by stable Rust, and rightly - neither the 1.99.1 nor the 1.100.0 dist manifest carries a standard library for that triple (both have aarch64-apple-ios-sim). The matrix entry declares temporal=off, the job turns that into NODE_TEMPORAL=off, and the args file records what the bundle lacks. The device bundle keeps Temporal. macos x86_64 and ios called $GITHUB_WORKSPACE/tools/apple_toolchain.sh, but the build job checks this repository out under Scripts/ (only pick uses the default path), so it died with 127 before configure. Both call sites name Scripts/tools/ now. lws iOS simulator: lipo takes the file before the command ("lipo <input_file> <command>"), so "lipo -verify_arch x86_64 <file>" read the path as an architecture flag. The check now passes the file first and reads LC_BUILD_VERSION from extracted archive members, so it no longer depends on how otool happens to treat archives.
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.
Fixes: #67589