Skip to content

Commit aed0f01

Browse files
tannevaledclaude
authored andcommitted
fix(llvm.org/mingw-w64): install the full toolchain tree (fixes darwin)
The install cherry-picked bin/lib/include/share, which drops llvm-mingw's per-target sysroots — generic-w64-mingw32/include holds the mingw headers (stdio.h et al.) and each <triple>-w64-mingw32/lib holds the import libs. Without them the cross compiler can't find its own headers, exactly the darwin failure @jhheider captured: `'stdio.h' file not found`. It was masked on Linux because the brewkit sandbox (debian:buster, glibc 2.28) can't load llvm-mingw's clang at all, so the compile test hit the `clang --version` guard and skipped — green by no-op. darwin runs the clang for real, so it surfaced there. Now extract into a staging dir and copy the whole tree. Verified on darwin/arm64: both x86_64 and aarch64 cross-compiles of a <stdio.h> program produce valid PE/COFF (MZ) binaries. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 3e26999 commit aed0f01

1 file changed

Lines changed: 19 additions & 14 deletions

File tree

projects/llvm.org/mingw-w64/package.yml

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,21 +62,26 @@ build:
6262
- URL="https://github.com/mstorsjo/llvm-mingw/releases/download/{{version.raw}}/llvm-mingw-{{version.raw}}-ucrt-${PLATFORM}.tar.xz"
6363
- echo "fetching $URL"
6464
- curl -Lfo llvm-mingw.tar.xz "$URL"
65-
- tar Jxf llvm-mingw.tar.xz --strip-components=1 -C .
6665

67-
# Copy the prebuilt toolchain into {{prefix}}. Upstream's drivers
68-
# (x86_64-w64-mingw32-clang etc.) are wrappers that call into
69-
# ../lib/clang/.../bin via relative paths — already relocatable.
70-
# brewkit doesn't pre-create {{prefix}}, so mkdir it first;
71-
# otherwise `cp -a bin {{prefix}}/` fails with "cannot create
72-
# directory" on the first cp.
73-
- mkdir -p "{{prefix}}"
74-
- cp -a bin "{{prefix}}/"
75-
- cp -a lib "{{prefix}}/"
76-
- |
77-
for d in share include; do
78-
[ -d "$d" ] && cp -a "$d" "{{prefix}}/"
79-
done
66+
# Copy the WHOLE prebuilt toolchain into {{prefix}}. Upstream's
67+
# drivers (x86_64-w64-mingw32-clang etc.) are wrappers that call
68+
# into ../lib/clang/.../bin via relative paths — already
69+
# relocatable. Extract into a staging dir (keeps the downloaded
70+
# tarball out of the copy) and copy everything.
71+
#
72+
# Copying the full tree matters: besides bin/lib/include/share,
73+
# llvm-mingw ships per-target sysroots — generic-w64-mingw32/include
74+
# holds the mingw headers (stdio.h & friends) and each
75+
# <triple>-w64-mingw32/lib holds the import libs. Cherry-picking only
76+
# bin+lib+share+include dropped those, so the cross compiler couldn't
77+
# find its own headers ("'stdio.h' file not found"). This was masked
78+
# on the Linux CI sandbox (its old glibc can't even load the clang,
79+
# so the compile test skipped) and only bit on darwin, which runs it.
80+
#
81+
# brewkit doesn't pre-create {{prefix}}, so mkdir it first.
82+
- rm -rf staging && mkdir -p staging "{{prefix}}"
83+
- tar Jxf llvm-mingw.tar.xz --strip-components=1 -C staging
84+
- cp -a staging/. "{{prefix}}/"
8085

8186
test:
8287
# winehq.org/wine is a soft dep — if present, we actually run the

0 commit comments

Comments
 (0)