Skip to content

Include Rust in the minimal-sdk/makepkg-git/build-installers SDK artifacts - #67

Merged
dscho merged 5 commits into
mainfrom
include-rust-in-makepkg-git
Nov 25, 2026
Merged

dscho merged 5 commits into
mainfrom
include-rust-in-makepkg-git

Conversation

@dscho

@dscho dscho commented Sep 26, 2026 •

Copy link
Copy Markdown
Member

This comes at a bit of a hefty price; the build-installers.tar.zst increases size from ~243MB to ~317MB (although that is less of a delta than for the sibling PR git-for-windows#132), while minimal-sdk.tar.zst increases from ~121MB to ~194MB.

The upside is that we're staying consistent with the MSYS2 project instead of mixing a MSYS2-provided Clang with a Rust-provided Cargo targeting Clang.

@dscho
dscho force-pushed the include-rust-in-makepkg-git branch 2 times, most recently from bc22926 to 4747c0d Compare September 28, 2026 14:08
@dscho

dscho commented Sep 28, 2026

Copy link
Copy Markdown
Member Author

So, a couple of notes:

  • rustc.exe is unhappy about our minimal libLLVM-22.dll, we'll have to switch back to MSYS2's version of mingw-w64-llvm-libs
  • As a consequence, we'll have to deal with the ~138MB libLLVM-22.dll. I propose to use UPX, even though that will require upstreaming my UPX fixes to make it work on win64/arm64 (and not crash under some circumstances, or worse).
  • cargo.exe links to libcrypto-3-arm64.dll, which means that we have to unshadow mingw-w64-openssl, too, in addition to mingw-w64-llvm-libs
  • Since we do link to libcrypto-3.dll in libcurl-openssl-4.dll, we will have to deploy a new pkgrel of mingw-w64-curl after unshadowing mingw-w64-openssl. I would like to do that before Sep 14 (which is when the next cURL release is scheduled).
  • build-installers will increase size from 207MB (which is pronouncedly larger than the git-sdk-64 equivalent, which weighs only 188MB, most likely because of the libLLVM-22.dll that is large even in its reduced size we currently carry) to 292MB (which is not quite as bad as git-sdk-64's 188MB -> 301MB).
  • The installer I built using this here PR's version of the SDK is broken: It does not include libunwind.dll but git.exe relies on it. This is most likely an artifact of including the Rust parts of Git, and we will have to prepare make-file-list.sh to include libunwind.dll, but only when needed (most likely recapitulating the libssp dependency check). This will obsolete https://github.com/git-for-windows/build-extra/blob/ac9bc0a1ebc39357a30669b034f80f97b86d328f/make-file-list.sh#L93.
  • Obviously, this quite messy commit order will need to be cleaned up before merging! For one, I want to run the install-pacman-package workflow afresh, after polishing the branch, so that it is sitting on top, and its commit message should record which workflow run produced it (unlike the current version of that commit).

@dscho

dscho commented Sep 28, 2026

Copy link
Copy Markdown
Member Author

I propose to use UPX, even though that will require upstreaming my UPX fixes to make it work on win64/arm64 (and not crash under some circumstances, or worse).

-> upx/upx#18927

@dscho

dscho commented Sep 28, 2026

Copy link
Copy Markdown
Member Author
  • The installer I built using this here PR's version of the SDK is broken: It does not include libunwind.dll but git.exe relies on it.

The only reason why this isn't pointed out by the failing check-for-missing-dlls run is that the included git.exe was not rebuilt with Rust bits enabled yet.

Howver, the failures do point straight at the mingw-w64-openssl problem:

c:/a/git-sdk-arm64/git-sdk-arm64/build-installers/clangarm64/bin/libcurl-openssl-4.dll is missing libssl-3.dll
c:/a/git-sdk-arm64/git-sdk-arm64/build-installers/clangarm64/bin/libcurl-openssl-4.dll is missing libcrypto-3.dll
c:/a/git-sdk-arm64/git-sdk-arm64/build-installers/clangarm64/libexec/git-core/git-imap-send.exe is missing libssl-3.dll
c:/a/git-sdk-arm64/git-sdk-arm64/build-installers/clangarm64/libexec/git-core/git-imap-send.exe is missing libcrypto-3.dll

So apparently not only a new pkgrel of mingw-w64-curl will be needed, but also of mingw-w64-git? But then, it only affects git imap-send, which I don't really care about that much as to go through the hassle of upgrading mingw-w64-git outside of a regular Git for Windows release...

dscho added a commit that referenced this pull request Nov 4, 2026
## Summary

Prepare package-update automation to store Rust's LLVM DLL through the
UPX clean filter, preserving original package bytes in the working tree.

- Configure repository-local filters before staging in
`.github/commit-sdk.sh`, using `--no-refresh`.
- Stop before staging if filter setup fails.
- Select only `clangarm64/bin/libLLVM-22.dll` with `filter=upx`.
- Remove sync's oversized-DLL stripping workaround, including its
temporary installation and removal of x64 LLVM.

UPX now supports Windows ARM64 binaries, allowing explicitly selected
LLVM DLLs to use compressed storage without stripping package files.

Ordinary clones retain runnable packed binaries. Users can optionally
enable smudge filtering to trade disk space for faster loading.

## Follow-ups

This does not install Rust or LLVM. Updating the package-install
workflow on Rust PR #67 is a follow-up. No installation workflow has
been dispatched.

## Validation

Disposable repository tests verified setup runs before staging,
successful commits leave working-tree bytes unchanged, and setup failure
prevents staging and committing.

Attribute checks confirmed only the intended LLVM DLL is selected.
Actionlint, shell syntax, and whitespace checks passed. Native ARM64
filter execution has not been tested locally.
dscho added a commit that referenced this pull request Nov 24, 2026
As part of #67, I
unshadowed `mingw-w64-llm`. Or at least, I
[tried](https://github.com/git-for-windows/git-for-windows-automation/actions/runs/45251567691),
[tried
again](https://github.com/git-for-windows/git-for-windows-automation/actions/runs/45258314743),
and [eventually
succeeded](https://github.com/git-for-windows/git-for-windows-automation/actions/runs/45259053139)
(third time's a charm, right?).

[EDIT] Narrator's voice: it
[wasn't](https://github.com/git-for-windows/git-for-windows-automation/actions/runs/45359350453).

Unfortunately, the [`sync` after that
failed](https://github.com/git-for-windows/git-sdk-arm64/actions/runs/45254159505).
The reason is that UPX is apparently found somewhere on the `PATH`, but
not the intended one, and it's apparently missing DLLs on the `PATH`,
resulting in an exit code 127. Let's work around that by forcing "our"
UPX to be in the `PATH` _first_.

While at it, clean up some `update-via-pacman` things, too.
@dscho
dscho force-pushed the include-rust-in-makepkg-git branch 2 times, most recently from 68bba00 to 16ac2cb Compare November 25, 2026 01:26
dscho added a commit to git-for-windows/build-extra that referenced this pull request Nov 25, 2026
…#777)

The `git-sdk-64` and `git-sdk-arm64` repositories store their largest
DLLs packed with UPX, merely to stay below GitHub's 100MB file size
limit. The SDK artifacts should not inherit that workaround: UPX-packed
DLLs need to be decompressed every single time they are loaded, and they
even compress worse: with zstd level 10, `libLLVM-23.dll` takes up
41,589,197 bytes when packed, but only 38,354,366 bytes when unpacked.

So let's install the large-DLL filter in the worktree from which the
artifacts are generated. The filter script and `upx.exe` are written
into the worktree's gitdir, so that they don't end up in the artifacts.

While at it, let's also hard-link identical files: Git stores each blob
only once, but a checkout writes every copy, whereas `tar` stores
hard-linked files only once. That shaves another ~2.3% off the minimal
SDK (with Rust).

This was prototyped in git-for-windows/git-sdk-arm64#67.
Rust needs to enter the SDK so that we can have "time-traveling"
branches for security bug fix releases and MinGit backports.

The safest way to install Rust is by running the `pacman -S` command in
a clean, pristine SDK checkout in a GitHub workflow, so that it's not
only virtually guaranteed that it's not tampered with, there is also a
public record.

Assisted-by: GPT-6 Sol
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Cherry-picked-from: 22f11cc (ci: Add a GitHub workflow to install Pacman packages into the SDK, 2026-09-25)
Upstream Git plans to make its Rust parts mandatory with v3.0, and Git
for Windows will enable them already after v2.56. Let's include what is
needed to build them in the minimal SDK, which is what Git's CI uses.
Since the `git-sdk-aarch64-build-installers` artifact is the minimal SDK
plus the `makepkg-git` sparse checkout, it gets them, too.

The ARM64 Rust package uses the `aarch64-pc-windows-gnullvm` target
provided by the Clang/LLVM subsystem. Cargo's default linker for that
target is `aarch64-w64-mingw32-clang`. Without it, the build fails with
"error: linker `aarch64-w64-mingw32-clang` not found". Linking also
needs `libsynchronization.a`.

Shipping the prefixed name means nobody has to override Cargo's linker
in every environment. The file is byte-identical to `clang.exe`, and
`please.sh create-sdk-artifact` hard-links identical files (see
git-for-windows/build-extra#777), so the extra
name costs practically nothing in the archive.

This does make the artifact substantially larger: the zstd-compressed
(level 10) minimal-sdk CI artifact grew from 121.41 MiB to 191.65 MiB,
i.e. by 70.24 MiB (+57.85%). That was measured before build-extra#777's
hard-linking and DLL unpacking, which shave off some of that.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
The minimal SDK now has what it takes to build Git's Rust parts, so
there's no reason to keep passing `NO_RUST=UnfortunatelyYes` to the test
build. Let's drop it. That way, this job checks that the minimal SDK
really can build Git with Rust, and the downstream test jobs exercise
that build.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho
dscho force-pushed the include-rust-in-makepkg-git branch from 3615d61 to b2c37ed Compare November 25, 2026 20:39
Git for Windows Build Agent added 2 commits November 25, 2026 12:42
mingw-w64-clang-aarch64-http-parser (new: 2.9.4-3)
mingw-w64-clang-aarch64-libgit2 (new: 1.9.7-3)
mingw-w64-clang-aarch64-rust (new: 1.100.0-2)

Signed-off-by: Git for Windows Build Agent <ci@git-for-windows.build>
Rust is now installed via pacman, and the SDK package changes
have been committed. Retire the workflow so later pushes to the PR
branch do not repeat the installation.

Generated by https://github.com/git-for-windows/git-sdk-arm64/actions/runs/45697015836

Signed-off-by: Git for Windows Build Agent <ci@git-for-windows.build>
@dscho
dscho marked this pull request as ready for review November 25, 2026 21:03
@dscho dscho changed the title Include Rust in the makepkg-git/build-installers SDK artifacts Include Rust in the minimal-sdk/makepkg-git/build-installers SDK artifacts Nov 25, 2026
dscho added a commit to dscho/git-sdk-64 that referenced this pull request Nov 25, 2026
Upstream Git plans to make its Rust parts mandatory with v3.0, and Git
for Windows will enable them already after v2.56. Let's include what is
needed to build them in the minimal SDK, which is what Git's CI uses.
Since the `git-sdk-x86_64-build-installers` artifact is the minimal SDK
plus the `makepkg-git` sparse checkout, it gets them, too.

The UCRT64 Rust package targets `x86_64-pc-windows-gnu`, and Cargo's
default linker for that target is `x86_64-w64-mingw32-gcc`. Without it,
the build fails with "error: linker `x86_64-w64-mingw32-gcc` not found".
`libsynchronization.a` is included as well because the ARM64 counterpart
(git-for-windows#67) needed it to
link, and the Rust standard library is the same on both architectures.

Shipping the prefixed name means nobody has to set
`CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER=gcc` in every environment.
The file is byte-identical to `gcc.exe`, and `please.sh
create-sdk-artifact` hard-links identical files (see
git-for-windows/build-extra#777), so the extra
name costs practically nothing in the archive.

This does make the artifact substantially larger. For reference, the
ARM64 counterpart grew the zstd-compressed (level 10) build-installers
artifact from ~243MB to ~317MB, and the minimal SDK from ~121MB to
~194MB.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
dscho added a commit to dscho/git-sdk-64 that referenced this pull request Nov 25, 2026
Upstream Git plans to make its Rust parts mandatory with v3.0, and Git
for Windows will enable them already after v2.56. Let's include what is
needed to build them in the minimal SDK, which is what Git's CI uses.
Since the `git-sdk-x86_64-build-installers` artifact is the minimal SDK
plus the `makepkg-git` sparse checkout, it gets them, too.

The UCRT64 Rust package targets `x86_64-pc-windows-gnu`, and Cargo's
default linker for that target is `x86_64-w64-mingw32-gcc`. Without it,
the build fails with "error: linker `x86_64-w64-mingw32-gcc` not found".
`libsynchronization.a` is included as well because the ARM64 counterpart
(git-for-windows#67) needed it to
link, and the Rust standard library is the same on both architectures.

Shipping the prefixed name means nobody has to set
`CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER=gcc` in every environment.
The file is byte-identical to `gcc.exe`, and `please.sh
create-sdk-artifact` hard-links identical files (see
git-for-windows/build-extra#777), so the extra
name costs practically nothing in the archive.

This does make the artifact substantially larger. For reference, the
ARM64 counterpart grew the zstd-compressed (level 10) build-installers
artifact from ~243MB to ~317MB, and the minimal SDK from ~121MB to
~194MB.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho
dscho merged commit 90d2118 into main Nov 25, 2026
22 checks passed
@dscho
dscho deleted the include-rust-in-makepkg-git branch November 25, 2026 23:37
dscho added a commit to git-for-windows/build-extra that referenced this pull request Nov 26, 2026
I ran into this while measuring how much including Rust in the minimal
SDK (git-for-windows/git-sdk-arm64#67) would
grow the artifacts. `please.sh create-sdk-artifact --head=<rev>` checked
out the files of `<rev>`, but it read the `.sparse/*` definitions from
the SDK repository's `HEAD`. Which means the file selection came from
`HEAD`, not from the revision I was trying to measure. With this fix,
both `build-installers` and `minimal-sdk` grow by roughly 74MB (zstd
level 10, as in CI).

CI does not pass `--head`, so its behavior is unchanged.
github-actions Bot pushed a commit to PtJade-Ceramic/build-extra that referenced this pull request Nov 26, 2026
The Git for Windows SDK repositories contain many byte-identical files
(`clang.exe` and its aliases, for example). Git stores each such blob
only once, but a checkout writes a separate copy for every path, which
inflates the artifacts produced by `please.sh create-sdk-artifact`.

Turning those copies into hard links recovers some of that space. In a
minimal-sdk artifact including Rust, 129 groups of identical files
accounted for 21,126,354 duplicate bytes uncompressed. Archived with
Windows' `tar.exe` (bsdtar) at zstd level 10, the archive shrank from
200,956,866 to 196,312,913 bytes, about 2.3%. Both bsdtar and MSYS tar
store the extra names as hard-link entries and recreate them as hard
links on extraction.

Only files that are unmodified relative to the index and have the
regular mode 100644 are linked. Files this function deliberately
rewrites, such as the minimal `etc/profile`, therefore never end up
linked to pristine copies.

This logic was first proven as an interim step in git-sdk-arm64's
ci-artifacts workflow, in
git-for-windows/git-sdk-arm64#67. Doing it
here benefits every caller.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
github-actions Bot pushed a commit to PtJade-Ceramic/build-extra that referenced this pull request Nov 26, 2026
The `--head=<rev>` option is supposed to create the artifact from a
commit other than the SDK repository's HEAD. It already does that for
the files themselves, but the sparse-checkout definitions were still
read from HEAD. The result mixed the two: the files came from <rev>,
yet the set of files was decided by HEAD's definitions.

This came up while measuring how much adding Rust to the minimal SDK
(git-for-windows/git-sdk-arm64#67) grows the
`build-installers` artifact. With `--head` pointing at that PR's commit
and HEAD still on `main`, the generated sparse definition was missing
the Rust entries.

CI calls `create-sdk-artifact` without `--head`, so there HEAD and
<rev> are the same commit and nothing changes.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
dscho added a commit to git-for-windows/git-for-windows-automation that referenced this pull request Nov 26, 2026
This covers the remaining checkbox of git-for-windows/git#6276 ("Build
with the Rust bits by default") for the release builds. All the
prerequisites are now merged: git-for-windows/MINGW-packages#235 on
2026-11-12, and git-for-windows/git-sdk-64#132 and
git-for-windows/git-sdk-arm64#67 earlier today, which add the Rust
toolchain to the SDK artifacts these workflows use.

The `git-artifacts` workflows in git-sdk-64 and git-sdk-arm64 have
opt-outs of their own; those are reverted in separate PRs in those
repositories. git-sdk-32 keeps its opt-out, as there is no usable i686
Rust.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant