Skip to content

Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦

C

setup: MSYS2 for a Vulkan build, libgomp, scoop's MSYS2 (#1900)

JustVugg174b5fbda866
diff --git a/c/setup_flow.py b/c/setup_flow.py
index d5abb739..d5a163d0 100644
--- a/c/setup_flow.py
+++ b/c/setup_flow.py
@@ -155,7 +155,8 @@ def read_state():
def find_msys2():
candidates = [os.environ.get("MSYS2_ROOT"), r"C:\msys64",
- os.path.join(os.environ.get("ProgramFiles", r"C:\Program Files"), "msys64")]
+ os.path.join(os.environ.get("ProgramFiles", r"C:\Program Files"), "msys64"),
+ os.path.join(os.path.expanduser("~"), "scoop", "apps", "msys2", "current")]
for root in candidates:
if root and os.path.isfile(os.path.join(root, "usr", "bin", "bash.exe")):
return root
@@ -283,7 +284,19 @@ def toolchain(here=None):
"msys2": None, "npm": shutil.which("npm")}
if sys.platform == "win32":
tc["nvcc"] = None # the Windows CUDA path is a separate MSVC build (docs/windows.md)
+ path_vulkan = False
+ if tc["cc"]:
+ prefix = os.path.dirname(os.path.dirname(tc["cc"]))
+ path_vulkan = bool(tc["glslc"]) and os.path.isfile(os.path.join(prefix, "include", "vulkan", "vulkan.h"))
+ # MSYS2's UCRT64 when the PATH has no compiler, and also when the PATH's cannot
+ # build the Vulkan backend (no headers or no glslc) and MSYS2 has a compiler of
+ # its own: a gcc and make from elsewhere (scoop's) used to hide it (#1900)
root = None if (tc["make"] and tc["cc"]) else find_msys2()
+ if root is None and not path_vulkan:
+ found = find_msys2()
+ if found and os.path.isfile(os.path.join(found, "ucrt64", "bin", "gcc.exe")) \
+ and os.path.isfile(os.path.join(found, "usr", "bin", "make.exe")):
+ root = found
if root:
ucrt = os.path.join(root, "ucrt64")
tc["msys2"] = root
@@ -340,7 +353,7 @@ PACKAGES = {
"cuda": ["cuda"], "python": ["python"]}),
"suse": ("sudo zypper install", {"build": ["gcc", "make"], "vulkan": ["vulkan-devel", "shaderc"],
"python": ["python3"]}),
- "msys2": ("pacman -S --needed", {"build": ["mingw-w64-ucrt-x86_64-gcc", "make"],
+ "msys2": ("pacman -S --needed", {"build": ["mingw-w64-ucrt-x86_64-gcc", "mingw-w64-ucrt-x86_64-libgomp", "make"],
"vulkan": ["mingw-w64-ucrt-x86_64-vulkan-headers",
"mingw-w64-ucrt-x86_64-vulkan-loader",
"mingw-w64-ucrt-x86_64-shaderc"]}),
diff --git a/c/tests/test_setup_flow.py b/c/tests/test_setup_flow.py
index 22a13fcb..705c5056 100644
--- a/c/tests/test_setup_flow.py
+++ b/c/tests/test_setup_flow.py
@@ -1451,5 +1451,62 @@ class CommandLine(HomeTestCase):
self.assertIn("coli setup", result.stderr)
+class WindowsToolchainTests(unittest.TestCase):
+ """toolchain() on Windows: a gcc and make on the PATH that cannot build the Vulkan
+ backend no longer hide an MSYS2 that can (#1900)."""
+
+ def tree(self, root, files):
+ for f in files:
+ path = os.path.join(root, *f.split("/"))
+ os.makedirs(os.path.dirname(path), exist_ok=True)
+ open(path, "w").close()
+ return root
+
+ def run_toolchain(self, path_tools, msys2):
+ def which(name):
+ return path_tools.get(name)
+ with mock.patch.object(setup_flow.sys, "platform", "win32"), \
+ mock.patch.object(setup_flow.shutil, "which", side_effect=which), \
+ mock.patch.object(setup_flow, "find_msys2", return_value=msys2):
+ return setup_flow.toolchain(here=str(C_DIR))
+
+ def setUp(self):
+ self.tmp = tempfile.TemporaryDirectory()
+ self.addCleanup(self.tmp.cleanup)
+ base = self.tmp.name
+ self.msys2 = self.tree(os.path.join(base, "msys64"), [
+ "usr/bin/bash.exe", "usr/bin/make.exe", "ucrt64/bin/gcc.exe", "ucrt64/bin/glslc.exe",
+ "ucrt64/include/vulkan/vulkan.h", "ucrt64/lib/libvulkan-1.dll.a"])
+ scoop = self.tree(os.path.join(base, "scoop"), ["bin/gcc.exe", "bin/make.exe"])
+ self.scoop = {"gcc": os.path.join(scoop, "bin", "gcc.exe"), "make": os.path.join(scoop, "bin", "make.exe")}
+
+ def test_msys2_beats_a_path_compiler_without_vulkan(self):
+ tc = self.run_toolchain(self.scoop, self.msys2)
+ self.assertEqual(tc["msys2"], self.msys2)
+ self.assertEqual(tc["cc"], os.path.join(self.msys2, "ucrt64", "bin", "gcc.exe"))
+ self.assertTrue(tc["can_build_vulkan"])
+
+ def test_a_path_compiler_with_vulkan_stays(self):
+ prefix = self.tree(os.path.join(self.tmp.name, "full"),
+ ["bin/gcc.exe", "bin/make.exe", "bin/glslc.exe", "include/vulkan/vulkan.h"])
+ tools = {"gcc": os.path.join(prefix, "bin", "gcc.exe"), "make": os.path.join(prefix, "bin", "make.exe"),
+ "glslc": os.path.join(prefix, "bin", "glslc.exe")}
+ tc = self.run_toolchain(tools, self.msys2)
+ self.assertIsNone(tc["msys2"])
+ self.assertEqual(tc["cc"], tools["gcc"])
+ self.assertTrue(tc["can_build_vulkan"])
+
+ def test_an_msys2_without_its_compiler_does_not_replace_a_working_one(self):
+ bare = self.tree(os.path.join(self.tmp.name, "bare"), ["usr/bin/bash.exe"])
+ tc = self.run_toolchain(self.scoop, bare)
+ self.assertIsNone(tc["msys2"])
+ self.assertEqual(tc["cc"], self.scoop["gcc"])
+ self.assertTrue(tc["can_build"])
+ self.assertFalse(tc["can_build_vulkan"])
+
+ def test_msys2_build_packages_include_libgomp(self):
+ self.assertIn("mingw-w64-ucrt-x86_64-libgomp", setup_flow.PACKAGES["msys2"][1]["build"])
+
+
if __name__ == "__main__":
unittest.main()
diff --git a/docs/windows.md b/docs/windows.md
index faaa2bdd..f0322e8f 100644
--- a/docs/windows.md
+++ b/docs/windows.md
@@ -151,6 +151,11 @@ This is not Defender and not Mark-of-the-Web — SAC blocks *all* unsigned, unkn
# 0 = off, 1 = enforced, 2 = evaluation
```
+SAC can also block the compiler itself: right after `pacman` installs gcc, its own
+`collect2.exe` is unknown to SAC until the cloud verdict arrives (two hours, in #1900),
+and gcc only says `cannot execute 'collect2.exe': CreateProcess: No such file or
+directory`. The fix is the same (SAC off and a reboot), or waiting for the verdict.
+
## 3. Build the CUDA DLL (GPU tier)
nvcc needs MSVC as host compiler, so this one step must run from a shell with the MSVC environment: open **"x64 Native Tools Command Prompt for VS 2022"** from the Start menu (plain PowerShell will fail the `cl` check). Not the generic "Developer Command Prompt": that one is the 32-bit compiler, and nvcc then fails inside `cuda_fp16.hpp` with `asm operand type size(8) does not match ... constraint 'r'` (#1405). `cl` alone prints which one you have: `for x64` is the right banner. Then:
@@ -200,6 +205,10 @@ Size `CUDA_EXPERT_GB` so dense (~10 GB) + experts + working set stays under your
|---|---|---|
| `'printf' is not recognized` / `The system cannot find the path specified` during `make colibri.exe` | scoop MinGW has no `sh.exe`; make fell back to cmd.exe (#478) | §0 — use MSYS2/w64devkit, or `set PATH=%PATH%;C:\msys64\usr\bin` |
| `An Application Control policy has blocked this file` | Smart App Control | §2 — turn SAC off + **reboot** |
+| `cannot execute 'collect2.exe': CreateProcess: No such file or directory` | Smart App Control blocked the freshly installed compiler (#1900) | §2: SAC off and a reboot, or wait for SAC's verdict |
+| `cannot find -lgomp` at the link | MSYS2's gcc 16 no longer pulls libgomp (#1900) | `pacman -S mingw-w64-ucrt-x86_64-libgomp` (`coli setup` lists it) |
+| `make qwen38` (or glm53, inkling, kimi_k3, olmoe, deepseek_v41) ends in `undefined reference to ...` | older tree: no bare target for that engine, make compiled the `.c` alone (#1945) | update, or name the binary: `make qwen38.exe ...` |
+| `coli setup` does not find MSYS2 installed by scoop, or uses another gcc on the PATH without Vulkan | older tree (#1900) | update, or set `MSYS2_ROOT` to the MSYS2 folder |
| `cuda-dll ... Error 1` immediately | old tree: spaced CUDA_HOME / MSVC rejects `-Wextra` | update to current `dev` (#314) |
| `colibri.exe is up to date` but GPU never engages | old tree: stale CPU-only binary | update to `dev`, or delete the binary and rebuild |
| `cl.exe (MSVC) not in PATH` | built from plain PowerShell | use the x64 Native Tools prompt |