Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

Switch to llvm-mingw for local Windows testing, fix CI quoting

Martin Vogel5c9f97b5b45e
diff --git a/.github/workflows/dry-run.yml b/.github/workflows/dry-run.yml
index 223561b28..6ee0bd637 100644
--- a/.github/workflows/dry-run.yml
+++ b/.github/workflows/dry-run.yml
@@ -98,7 +98,7 @@ jobs:
- name: Test
shell: msys2 {0}
- run: scripts/test.sh CC=clang CXX=clang++ WIN32_LIBS="-lws2_32 -lpsapi -Wl,--allow-multiple-definition"
+ run: scripts/test.sh CC=clang CXX=clang++ 'WIN32_LIBS=-lws2_32 -lpsapi -Wl,--allow-multiple-definition'
# ── Step 3: Build binaries (standard + UI, all OS) ──────────
build-unix:
@@ -180,7 +180,7 @@ jobs:
- name: Build standard binary
shell: msys2 {0}
- run: scripts/build.sh CC=clang CXX=clang++ WIN32_LIBS="-lws2_32 -lpsapi -Wl,--allow-multiple-definition"
+ run: scripts/build.sh CC=clang CXX=clang++ 'WIN32_LIBS=-lws2_32 -lpsapi -Wl,--allow-multiple-definition'
- name: Archive standard binary
shell: pwsh
@@ -190,7 +190,7 @@ jobs:
- name: Build UI binary
shell: msys2 {0}
- run: scripts/build.sh --with-ui CC=clang CXX=clang++ WIN32_LIBS="-lws2_32 -lpsapi -Wl,--allow-multiple-definition"
+ run: scripts/build.sh --with-ui CC=clang CXX=clang++ 'WIN32_LIBS=-lws2_32 -lpsapi -Wl,--allow-multiple-definition'
- name: Archive UI binary
shell: pwsh
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 7dc5c1a18..9df25959b 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -112,7 +112,7 @@ jobs:
- name: Test
shell: msys2 {0}
- run: scripts/test.sh CC=clang CXX=clang++ WIN32_LIBS="-lws2_32 -lpsapi -Wl,--allow-multiple-definition"
+ run: scripts/test.sh CC=clang CXX=clang++ 'WIN32_LIBS=-lws2_32 -lpsapi -Wl,--allow-multiple-definition'
# ── Step 3: Build binaries (standard + UI, all OS) ──────────
build-unix:
@@ -194,7 +194,7 @@ jobs:
- name: Build standard binary
shell: msys2 {0}
- run: scripts/build.sh --version ${{ inputs.version }} CC=clang CXX=clang++ WIN32_LIBS="-lws2_32 -lpsapi -Wl,--allow-multiple-definition"
+ run: scripts/build.sh --version ${{ inputs.version }} CC=clang CXX=clang++ 'WIN32_LIBS=-lws2_32 -lpsapi -Wl,--allow-multiple-definition'
- name: Archive standard binary
shell: pwsh
@@ -204,7 +204,7 @@ jobs:
- name: Build UI binary
shell: msys2 {0}
- run: scripts/build.sh --with-ui --version ${{ inputs.version }} CC=clang CXX=clang++ WIN32_LIBS="-lws2_32 -lpsapi -Wl,--allow-multiple-definition"
+ run: scripts/build.sh --with-ui --version ${{ inputs.version }} CC=clang CXX=clang++ 'WIN32_LIBS=-lws2_32 -lpsapi -Wl,--allow-multiple-definition'
- name: Archive UI binary
shell: pwsh
diff --git a/test-infrastructure/Dockerfile.mingw b/test-infrastructure/Dockerfile.mingw
index 0abec1bad..fbe9acd01 100644
--- a/test-infrastructure/Dockerfile.mingw
+++ b/test-infrastructure/Dockerfile.mingw
@@ -1,25 +1,36 @@
-# Cross-compile for Windows using mingw-w64 — catches all compile errors
-# (missing headers, POSIX functions, type mismatches) without needing Windows.
+# Cross-compile AND run Windows tests locally using llvm-mingw + Wine.
#
-# Compiles all source files to .o but does NOT link (Ubuntu's mingw CRT
-# differs from MSYS2 UCRT64). Linking is verified by CI on actual Windows.
+# llvm-mingw: LLVM/Clang-based MinGW toolchain with ASan support
+# Wine: runs the resulting .exe for actual test execution
+#
+# Usage:
+# docker compose -f test-infrastructure/docker-compose.yml run --rm build-windows
+# docker compose -f test-infrastructure/docker-compose.yml run --rm test-windows
-FROM ubuntu:noble
+FROM mstorsjo/llvm-mingw:latest
+# Install Wine for running Windows executables
RUN apt-get update && apt-get install -y --no-install-recommends \
- mingw-w64 make \
- libz-mingw-w64-dev \
+ wine64 curl zstd \
&& rm -rf /var/lib/apt/lists/*
+# Install zlib into the llvm-mingw sysroot (from MSYS2 CLANG64 repo)
+# Extract to temp dir first, then copy — avoids overwriting existing sysroot files
+RUN mkdir -p /tmp/zlib-pkg && \
+ curl -sL "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-zlib-1.3.1-1-any.pkg.tar.zst" \
+ | zstd -d | tar xf - -C /tmp/zlib-pkg && \
+ cp -rn /tmp/zlib-pkg/clang64/include/* /opt/llvm-mingw/x86_64-w64-mingw32/include/ && \
+ cp -rn /tmp/zlib-pkg/clang64/lib/* /opt/llvm-mingw/x86_64-w64-mingw32/lib/ && \
+ rm -rf /tmp/zlib-pkg
+
WORKDIR /src
-# Compile-check: build all objects without linking
ENTRYPOINT ["/bin/bash", "-c"]
+
+# Default: cross-compile production build
CMD ["make -j4 -f Makefile.cbm clean-c && \
- CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ \
- make -j4 -f Makefile.cbm build/c/codebase-memory-mcp \
- CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ \
- 'WIN32_LIBS=-lws2_32 -lpsapi' \
- LDFLAGS='-lm -lstdc++ -lz -lws2_32 -lpsapi -Wl,--allow-multiple-definition' \
- LDFLAGS_TEST='-lm -lstdc++ -lz -lws2_32 -lpsapi -Wl,--allow-multiple-definition' \
- && echo '=== Windows cross-compile: all sources compiled ==='"]
+ make -j4 -f Makefile.cbm cbm \
+ CC=x86_64-w64-mingw32-clang \
+ CXX=x86_64-w64-mingw32-clang++ \
+ 'WIN32_LIBS=-lws2_32 -lpsapi -Wl,--allow-multiple-definition' \
+ && echo '=== Windows cross-compile: OK ==='"]
diff --git a/test-infrastructure/docker-compose.yml b/test-infrastructure/docker-compose.yml
index aa1402109..6f5bb0985 100644
--- a/test-infrastructure/docker-compose.yml
+++ b/test-infrastructure/docker-compose.yml
@@ -47,13 +47,30 @@ services:
entrypoint: ["scripts/build.sh"]
command: ["CC=gcc", "CXX=g++"]
- # ── Windows cross-compile (mingw-w64, compile-check only) ──
+ # ── Windows cross-compile + test (llvm-mingw + Wine) ────────
build-windows:
build:
context: ..
dockerfile: test-infrastructure/Dockerfile.mingw
+ platform: linux/amd64
+ volumes:
+ - ..:/src
+
+ test-windows:
+ build:
+ context: ..
+ dockerfile: test-infrastructure/Dockerfile.mingw
+ platform: linux/amd64
volumes:
- ..:/src
+ command: >-
+ make -j4 -f Makefile.cbm clean-c &&
+ make -j4 -f Makefile.cbm test
+ CC=x86_64-w64-mingw32-clang
+ CXX=x86_64-w64-mingw32-clang++
+ WIN32_LIBS='-lws2_32 -lpsapi'
+ SANITIZE=
+ && echo '=== Windows test: OK ==='
# ── Lint ────────────────────────────────────────────────────
lint: