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.

Fix WIN32_LIBS quoting via env vars, add skip_lint to dry-run

Martin Vogelb5f14f115dac
diff --git a/.github/workflows/dry-run.yml b/.github/workflows/dry-run.yml
index 6ee0bd637..aa47912ab 100644
--- a/.github/workflows/dry-run.yml
+++ b/.github/workflows/dry-run.yml
@@ -2,6 +2,11 @@ name: Dry Run
on:
workflow_dispatch:
+ inputs:
+ skip_lint:
+ description: 'Skip lint step (faster iteration)'
+ type: boolean
+ default: false
permissions:
contents: read
@@ -9,6 +14,7 @@ permissions:
jobs:
# ── Step 1: Lint (clang-format + cppcheck) ───────────────────
lint:
+ if: ${{ !inputs.skip_lint }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@@ -48,6 +54,7 @@ jobs:
# Linux: use system gcc — full ASan/UBSan support
# Windows: MSYS2 MinGW GCC
test-unix:
+ if: ${{ always() && (needs.lint.result == 'success' || needs.lint.result == 'skipped') }}
needs: [lint]
strategy:
fail-fast: false
@@ -81,6 +88,7 @@ jobs:
run: scripts/test.sh CC=${{ matrix.cc }} CXX=${{ matrix.cxx }}
test-windows:
+ if: ${{ always() && (needs.lint.result == 'success' || needs.lint.result == 'skipped') }}
needs: [lint]
runs-on: windows-latest
steps:
@@ -98,7 +106,9 @@ jobs:
- name: Test
shell: msys2 {0}
- run: scripts/test.sh CC=clang CXX=clang++ 'WIN32_LIBS=-lws2_32 -lpsapi -Wl,--allow-multiple-definition'
+ env:
+ WIN32_LIBS: -lws2_32 -lpsapi -Wl,--allow-multiple-definition
+ run: scripts/test.sh CC=clang CXX=clang++
# ── Step 3: Build binaries (standard + UI, all OS) ──────────
build-unix:
@@ -180,7 +190,9 @@ 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'
+ env:
+ WIN32_LIBS: -lws2_32 -lpsapi -Wl,--allow-multiple-definition
+ run: scripts/build.sh CC=clang CXX=clang++
- name: Archive standard binary
shell: pwsh
@@ -190,7 +202,9 @@ 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'
+ env:
+ WIN32_LIBS: -lws2_32 -lpsapi -Wl,--allow-multiple-definition
+ run: scripts/build.sh --with-ui CC=clang CXX=clang++
- name: Archive UI binary
shell: pwsh
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 9df25959b..42b528e4f 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -112,7 +112,9 @@ jobs:
- name: Test
shell: msys2 {0}
- run: scripts/test.sh CC=clang CXX=clang++ 'WIN32_LIBS=-lws2_32 -lpsapi -Wl,--allow-multiple-definition'
+ env:
+ WIN32_LIBS: -lws2_32 -lpsapi -Wl,--allow-multiple-definition
+ run: scripts/test.sh CC=clang CXX=clang++
# ── Step 3: Build binaries (standard + UI, all OS) ──────────
build-unix:
@@ -194,7 +196,9 @@ 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'
+ env:
+ WIN32_LIBS: -lws2_32 -lpsapi -Wl,--allow-multiple-definition
+ run: scripts/build.sh --version ${{ inputs.version }} CC=clang CXX=clang++
- name: Archive standard binary
shell: pwsh
@@ -204,7 +208,9 @@ 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'
+ env:
+ WIN32_LIBS: -lws2_32 -lpsapi -Wl,--allow-multiple-definition
+ run: scripts/build.sh --with-ui --version ${{ inputs.version }} CC=clang CXX=clang++
- name: Archive UI binary
shell: pwsh
diff --git a/Makefile.cbm b/Makefile.cbm
index 39098f1d2..a41129cff 100644
--- a/Makefile.cbm
+++ b/Makefile.cbm
@@ -72,8 +72,9 @@ CFLAGS_TSAN = $(CFLAGS_COMMON) -g -O1 \
CXXFLAGS_TSAN = $(CXXFLAGS_COMMON) -g -O1 \
-fsanitize=thread -fno-omit-frame-pointer
-# Windows needs ws2_32 (Winsock) and psapi (GetProcessMemoryInfo).
-# Override via: make WIN32_LIBS="-lws2_32 -lpsapi" for cross-compilation.
+# Windows needs ws2_32 (Winsock), psapi (GetProcessMemoryInfo), and
+# --allow-multiple-definition (MinGW CRT symbol clashes).
+# Pass WIN32_LIBS on command line for Windows builds.
WIN32_LIBS ?=
LDFLAGS = -lm -lstdc++ -lpthread -lz $(LIBGIT2_LIBS) $(WIN32_LIBS)
diff --git a/scripts/build.sh b/scripts/build.sh
index a8c59e736..94bf149ec 100755
--- a/scripts/build.sh
+++ b/scripts/build.sh
@@ -87,6 +87,11 @@ verify_compiler "$CC"
# Step 1: Clean C build artifacts only (not node_modules — npm ci handles that)
rm -rf "$ROOT/build/c"
+# Forward WIN32_LIBS from environment (set by CI env: block)
+if [[ -n "${WIN32_LIBS:-}" ]]; then
+ EXTRA_MAKE_ARGS+=("WIN32_LIBS=$WIN32_LIBS")
+fi
+
# Step 2: Build (with arch prefix on macOS)
if $WITH_UI; then
$ARCH_PREFIX make -j"$NPROC" -f Makefile.cbm cbm-with-ui \
diff --git a/scripts/test.sh b/scripts/test.sh
index aa45811ea..8dca85026 100755
--- a/scripts/test.sh
+++ b/scripts/test.sh
@@ -38,16 +38,20 @@ done
# shellcheck source=env.sh
source "$ROOT/scripts/env.sh"
-# Forward CC/CXX and collect make-passthrough args (WIN32_LIBS=)
+# Forward CC/CXX and collect make-passthrough args
MAKE_ARGS=""
for arg in "$@"; do
case "$arg" in
CC=*|CXX=*) export "${arg}" ;;
- WIN32_LIBS=*) MAKE_ARGS="$MAKE_ARGS $arg" ;;
--arch|--arch=*) ;; # already handled
arm64|x86_64) ;; # already handled
+ *=*) MAKE_ARGS="$MAKE_ARGS $arg" ;; # forward any VAR=VAL to make
esac
done
+# Also forward WIN32_LIBS from environment (set by CI env: block)
+if [[ -n "${WIN32_LIBS:-}" ]]; then
+ MAKE_ARGS="$MAKE_ARGS WIN32_LIBS=$WIN32_LIBS"
+fi
print_env "test.sh"