From 6e9eedfd2179f1b22ac918f4ed881d7553d46d18 Mon Sep 17 00:00:00 2001 From: Jorijn van der Graaf Date: Sat, 3 Oct 2026 19:04:47 +0200 Subject: [PATCH] fix(packaging): check out the WASI sysroot's LLVM tree from git The previous commit made the LLVM tree inside the wasi-sdk checkout a git repository with `git init`, so that wasi-sdk's patch step would apply. That was half the fix: wasi-sdk also runs `git rev-parse HEAD` in that tree to write the sysroot's VERSION file, which on an empty repository raises a traceback during configure and leaves VERSION without its llvm lines. The build went on regardless, so the suite passed and the published beta carries the truncated file. Fetching the tree as a git source pinned to the release tag gives wasi-sdk what it has upstream, a submodule checkout at a commit, and removes the shell step instead of stacking a second workaround on it. The llvm module keeps the release tarball: it is the same commit, and a tarball is the cheaper download for a tree that is only compiled. flatpak-builder keeps a mirror of the clone in its state directory, so the fetch costs the cold run about 300 MB once. Verified locally: no traceback, VERSION lists llvm 85ac56026243 and llvm-version 23.1.2, the eight patch steps apply, the suite passes in the sandbox and a wasm32-wasip1 program runs under the bundled wasmtime. Co-Authored-By: Claude Fable 5.1 --- .../flatpak/net.catcrafts.CrafterBuild.yaml | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/packaging/flatpak/net.catcrafts.CrafterBuild.yaml b/packaging/flatpak/net.catcrafts.CrafterBuild.yaml index 7eb8644..3584063 100644 --- a/packaging/flatpak/net.catcrafts.CrafterBuild.yaml +++ b/packaging/flatpak/net.catcrafts.CrafterBuild.yaml @@ -113,7 +113,7 @@ modules: # wasi-sdk's sysroot-only mode, driven by the clang built above: # wasi-libc, compiler-rt builtins (installed into our clang's resource # dir, where the wasm32 driver looks for them) and libc++ for wasip1 and - # wasip1-threads. The llvm-project tree is the same tarball as above so + # wasip1-threads. The llvm-project tree is the same release as above so # the wasm libc++ matches the native one. buildsystem: cmake-ninja builddir: true @@ -154,22 +154,20 @@ modules: url: https://github.com/WebAssembly/wasi-libc.git commit: 2e6fb9d8ee0cdf9e431fbcabe8af3115de000a13 dest: src/wasi-libc - - type: archive - url: https://github.com/llvm/llvm-project/releases/download/llvmorg-23.1.2/llvm-project-23.1.2.src.tar.xz - sha256: c98bbef08a2b4c2613cd50e9aa9ae7b69b1fe6c16b2c40373bc0ab6116fdf78a - dest: src/llvm-project - # wasi-sdk patches its LLVM tree before building libc++ (`git apply` in - # src/llvm-project), and upstream that directory is a submodule, a - # repository of its own. Unpacked from a tarball it is a plain + # A git checkout, where the llvm module above unpacks the release + # tarball of the same tag: wasi-sdk treats src/llvm-project as the + # submodule it is upstream. It patches the tree with `git apply` before + # building libc++, and records `git rev-parse HEAD` in the sysroot's + # VERSION file. Unpacked from a tarball the directory is a plain # subdirectory of the wasi-sdk checkout, where git treats the patched # paths as outside the current directory, skips every one of them and # exits 0. LLVM 22 happened to build without the patches; LLVM 23's - # libc++ does not compile for WASI without one of them. Making the tree - # a repository lets wasi-sdk's own patch step do what it does upstream, - # with whatever patch list the pinned tag carries. - - type: shell - commands: - - git init -q src/llvm-project + # libc++ does not compile for WASI without one of them. + - type: git + url: https://github.com/llvm/llvm-project.git + tag: llvmorg-23.1.2 + commit: 85ac560262434c9ccfc0c183ec22d4138ed647fb + dest: src/llvm-project - type: file path: wasi-host-toolchain.cmake