new(mingw-w64.org): Windows runtime libs (headers + CRT + winpthreads) — from source#13047
Merged
Conversation
Pure runtime — Windows API headers, C runtime, and pthread emulation. NOT a compiler; just the *target-side* libs that a Windows-targeting clang/gcc needs to actually produce working .exe/.dll output. The compiler itself comes from pantry's existing llvm.org (clang + lld). Built from source for x86_64-w64-mingw32 + aarch64-w64-mingw32 using pantry's llvm.org clang as the cross compiler (LLVM is multi-target by default; --target=*-w64-mingw32 works natively). Build order per target: 1. mingw-w64-headers — install only (.h files) 2. mingw-w64-crt — CRT compiled against headers from (1) 3. winpthreads — pthread emulation on top of (2) Composed by llvm.org/mingw-w64 (separate recipe) which wraps clang into per-target driver scripts (x86_64-w64-mingw32-clang, etc.). This replaces the previous vendored-tarball approach of llvm.org/mingw-w64 — pkgx pantry policy is from-source over vendored binaries.
4 tasks
…ses) Upstream `mingw-w64/mingw-w64` only publishes git tags (v9.0.0, v10.0.0, ... v14.0.0) — no GitHub releases. Default `github:` mode queries the releases endpoint first and falls back to tags, but the fallback wasn't producing entries in CI. Force tags mode explicitly via `github: mingw-w64/mingw-w64/tags` and add `strip: - /^v/` to drop the v prefix. Fixes "no versions parsed" failure on all 4 CI runners.
CRT configure failed with "Please check if the mingw-w64 header set
and the build/host option are set properly." — it probes `<windows.h>`
via CC, but clang had no sysroot pointing at the just-installed
headers.
Re-order: install headers first, THEN export CC/CXX with
`--sysroot={{prefix}}/$T` so the cross-compiler can find them.
Matches what llvm-mingw upstream does.
4 tasks
Headers + CRT now build cleanly with --sysroot, but winpthreads failed at the resource-compile step: libtool: error: unrecognised option: '-i' libtool needs RC set so it recognises the windres-compile path through its wrapper. Add `export RC=llvm-windres` (and WINDRES for configure-script consistency).
winpthreads' version.rc includes <winver.h> from the mingw-w64
headers. CC --sysroot handles regular C compiles, but windres uses
its own include path — and without `-I`, it can't find winver.h:
../mingw-w64-libraries/winpthreads/src/version.rc:23:10:
fatal error: 'winver.h' file not found
Pass RCFLAGS=-I{{prefix}}/$T/include to the winpthreads configure
so windres looks in the same place clang's sysroot does.
Contributor
Author
|
Linux x86_64 + aarch64 both green on the latest commit — the from-source build works end-to-end (headers + CRT + winpthreads). darwin x64 / darwin ARM64 fail but logs aren't API-accessible (self-hosted runners return 404). @jhheider could you paste the tail of the failing darwin job? The Linux fix was 3-step:
Darwin uses the same
Job URLs: |
winpthreads' libtool link step failed with:
checking command to parse nm output from clang
--target=x86_64-w64-mingw32 --sysroot=... object... failed
make[2]: *** [libwinpthread.la] Error 1
because the host's GNU nm doesn't grok PE/COFF objects emitted by
clang's mingw32 target. Wire libtool to llvm-nm (which handles every
object format LLVM emits, including PE) plus the rest of the binutils
libtool probes — llvm-strip / llvm-objdump / llvm-objcopy — so we don't
hit the same wall again on the next libtool stage.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…F pipe libtool's configure-time nm probe constructs a global_symbol_pipe that, with llvm-nm on PE/COFF objects, ends up missing a filter stage and emits `llvm-nm ... | | sed ...` (double pipe → shell syntax error). This only affects the shared (DLL) link path; the static .a build never goes through that pipeline. Switch winpthreads to --enable-static --disable-shared so we get libpthread.a (which is what mingw-w64 consumers link against) and sidestep the broken libtool nm-probe. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…test darwin libtool installs the static winpthread as libwinpthread.lib (PE-style .lib extension), not libpthread.a. linux libtool installs libpthread.a. The build itself succeeds on both; only our verify step rejected darwin output. Accept either filename so the darwin job goes green. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Pure Windows runtime (headers + CRT + winpthreads), built from source for x86_64 + aarch64 targets. NOT a compiler — just the target-side libs.
Cross-compiled using pantry's existing llvm.org clang (
--target=*-w64-mingw32).Companion to #12984 which will be refactored to compose this runtime + pantry's llvm.org into the full Windows cross-toolchain (instead of vendoring upstream's prebuilt llvm-mingw).