From 72d4e321484fbfd41f38cf8eef07b446cbd125fe Mon Sep 17 00:00:00 2001 From: Bas van Gijzel Date: Wed, 22 Jul 2026 13:00:21 +0000 Subject: [PATCH] ci(windows): drop rustc's stale libwinpthread so C++ proc-macros load rustc loads proc-macros via LoadLibraryExW with the default search order, where the application directory - rustc's sysroot bin/ - beats PATH. The windows-gnu dist ships a stale libwinpthread-1.dll there that nothing in bin/ imports (verified: rustc.exe, rustdoc.exe, rustc_driver-*.dll, std-*.dll depend only on KERNEL32/msvcrt/ntdll/ libgcc; rust-lld.exe has its own copies under rustlib/, untouched here). Since the shared-libstdc++ workaround for #550, a freshly compiled melior-macro (proc-macro linking LLVM C++ via tblgen) depends on GCC 16's libstdc++-6.dll at load time, which imports clock_gettime64, nanosleep64 and pthread_cond_timedwait64 from mingw-w64 v14 winpthreads. The stale copy predates those exports, the dependency chain fails to load, and rustc reports the generic E0463 "can't find crate for melior_macro" - Slang Tests / Windows has been red on main since the melior rev bump in #557 forced the first fresh melior build (runs 29910202004, 29912409528). Deleting the dead DLL lets the dependency fall through to MSYS2's copy via PATH. Same-class prior art: rust-lang/rust#99534 (stale bundled libgcc_s_dw2-1.dll vs MSYS2 gcc >= 11.3, fixed by a bundled-mingw bump), ddnet/ddnet#10203, and a ruby-core report with the identical delete-the-stale-DLL fix. --- .github/actions/build-toolchain/action.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/actions/build-toolchain/action.yml b/.github/actions/build-toolchain/action.yml index 67865d091..d0825d0c5 100644 --- a/.github/actions/build-toolchain/action.yml +++ b/.github/actions/build-toolchain/action.yml @@ -59,6 +59,20 @@ runs: shell: bash run: rm -v target-llvm/target-final/lib/libstdc++.a + # Consequence of the shared libstdc++ above: rustc loads proc-macros with + # the default Windows DLL search order, where the application dir — + # rustc's sysroot bin/ — beats PATH. The windows-gnu dist ships a stale + # libwinpthread-1.dll there (imported by nothing in bin/; rust-lld has + # its own copy under rustlib/), lacking the mingw-w64 v14 64-bit-time + # symbols that GCC 16's shared libstdc++-6.dll needs, so loading any + # C++-linking proc-macro (melior-macro via tblgen) fails with E0463. + # Drop it so the dependency resolves to MSYS2's copy via PATH. -f: the + # step self-noops (and can be deleted) once rust ships mingw-w64 >= v14. + - name: Drop rustc's stale libwinpthread (Windows) + if: runner.os == 'Windows' && inputs.llvm == 'true' + shell: bash + run: rm -fv "$(rustc --print sysroot)/bin/libwinpthread-1.dll" + - name: Build solc if: inputs.solc == 'true' uses: ./.github/actions/build-solc