Repository navigation
Conversation
The Windows stages compile against the MSYS2 sysroot, but link against and ship BinaryBuilder's compiler support libraries, which BinaryBuilder-built packages also expect at run time. Neither set of runtime DLLs is a superset of the other, so the source-built code has to bind to BinaryBuilder's. libstdc++ implements std::call_once differently in each: MSYS2's is configured with TLS, and since GCC 16 its headers call accessors that BinaryBuilder's libstdc++ does not export, so linking LLVM's tools fails. Force-include a header that makes <mutex> use the implementation without TLS. Tools built during a stage then need BinaryBuilder's libstdc++ at run time too, so put a directory holding only that DLL first on PATH; the stage's other DLLs stay behind the sysroot's, which its compiler needs. MSYS2's winpthreads headers also route nanosleep, clock_gettime and the timed waits to 64-bit time variants that BinaryBuilder's winpthreads lacks, e.g. nanosleep64 through std::this_thread::sleep_for in libLLVM, which then fails to load. On x86-64 these are the plain functions, so stage 0 generates an import library that imports them under those names, and every link takes it ahead of the sysroot's. Assisted-by: Claude Code (Opus 5.5)
Member
Author
|
I'm not really a fan of this, though. It seems questionable that Windows CI relies on the MSYS SDK while some of our artifacts assume the BB toolchain is being linked against. |
Member
Author
|
Going to try this differently. |
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 optimized Windows build (#63214) fails on CI while linking LLVM's own
tools in stage 1:
The stages compile against the MSYS2 sysroot of the CI image
(
package-windows-x86_64:v8.5, gcc 16.1.0, winpthreads 14), but linkagainst and ship BinaryBuilder's compiler support libraries (GCC 15). Those
are also what BinaryBuilder-built packages load. The two sets are not
interchangeable: neither DLL is a superset of the other for
libstdc++,libwinpthreadorlibgcc_s. Shipping MSYS2's instead would break thepackages' C++ libraries. This PR makes the source-built code bind to
BinaryBuilder's:
std::call_once. MSYS2's libstdc++ is configured with TLS, and sinceGCC 16 its headers call
std::__get_once_callable()/__get_once_call().BinaryBuilder's is configured without TLS and exports
__once_functoretc. instead. The stages now force-include
contrib/windows/libstdcxx-call-once.h, which undefines_GLIBCXX_HAVE_TLS. That macro only selects between these twoimplementations in
<mutex>.nanosleep,clock_gettimeand the timed waits tonanosleep64etc. BinaryBuilder'solder winpthreads lacks those, so
libLLVM(viastd::this_thread::sleep_for) failed to load. On x86-64 they are the plainfunctions, so stage 0 builds an import library from
contrib/windows/winpthread-time64.defthat imports them under the oldnames. Every link takes it ahead of the sysroot's import library. It is
passed by name (
-L… -l…) because MSYS2's argument conversion mangles aC:/…path inside LLVM's CMake linker flags.llvm-tblgen,now load BinaryBuilder's
libstdc++. A directory holding only that DLLgoes first on
PATH. The stage's other DLLs stay behind the sysroot's,because MSYS2's
cc1(used bywindres) finds its GMP/MPFR/winpthreadthrough
PATHand fails with BinaryBuilder's.The earlier Windows validation didn't catch this because it swapped the
stage trees' compiler support DLLs for MSYS2's by hand.
Not marked "needs full CI" yet because JuliaCI/julia-buildkite#636 hasn't merged.
Assisted-by: Claude Code (Opus 5.5)