Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(sidecar): -MAP fehlte auf CMAKE_MODULE_LINKER_FLAGS

purplec25584953a8b
diff --git a/scripts/build-llama-flags.test.mjs b/scripts/build-llama-flags.test.mjs
index 0090c6ec..b7ee39e6 100644
--- a/scripts/build-llama-flags.test.mjs
+++ b/scripts/build-llama-flags.test.mjs
@@ -41,6 +41,18 @@ test('BL1: the Windows MSVC linker-map flags use -MAP, not /MAP', () => {
assert.match(flags, /-DCMAKE_EXE_LINKER_FLAGS=-MAP\b/);
});
+test('BL1 (real box rebuild finding): CMAKE_MODULE_LINKER_FLAGS also carries -MAP, not just SHARED/EXE', () => {
+ // ggml/src/CMakeLists.txt adds every GGML_BACKEND_DL backend
+ // (ggml-cpu-*.dll, ggml-vulkan.dll — exactly the files this guard cares
+ // about most) as a CMake MODULE library, which MSVC links with
+ // CMAKE_MODULE_LINKER_FLAGS, not CMAKE_SHARED_LINKER_FLAGS. A real sidecar
+ // rebuild on the box with only the SHARED/EXE flags set produced .map
+ // files for ggml.dll/ggml-base.dll/llama*.dll/mtmd.dll/the exe but NOT ONE
+ // for any ggml-cpu-*.dll or ggml-vulkan.dll.
+ const flags = cmakeFlagsFor('x86_64-pc-windows-msvc');
+ assert.match(flags, /-DCMAKE_MODULE_LINKER_FLAGS=-MAP\b/);
+});
+
test('BL1: no leading-slash /MAP survives anywhere in the Windows linker flags', () => {
const flags = cmakeFlagsFor('x86_64-pc-windows-msvc');
assert.doesNotMatch(flags, /LINKER_FLAGS=\/MAP\b/, 'BL1 would recur if either linker-flags variable used the leading-slash spelling again');
diff --git a/scripts/build-llama.sh b/scripts/build-llama.sh
index e44fd866..e5ac0176 100755
--- a/scripts/build-llama.sh
+++ b/scripts/build-llama.sh
@@ -147,7 +147,24 @@ cmake_flags_for() {
# MSYS's argv rewriter), so use that instead of the LDFLAGS/
# MSYS2_ENV_CONV_EXCL environment-variable workaround the box bauer used
# to prove this out (e2e/k1-avx, 04-BOX-SIDECAR-AVX-BEFUND.md Schritt 1).
- echo "$common -DBUILD_SHARED_LIBS=ON -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON -DGGML_VULKAN=ON -DCMAKE_SHARED_LINKER_FLAGS=-MAP -DCMAKE_EXE_LINKER_FLAGS=-MAP" ;;
+ #
+ # A REAL sidecar rebuild on the box with only the two flags above
+ # (round 2's first attempt) surfaced a second, genuine gap: cmake has
+ # THREE linker-flags cache variables, not two.
+ # ggml/src/CMakeLists.txt:267 adds every GGML_BACKEND_DL backend
+ # (`add_library(${backend} MODULE ${ARGN})`, both the nine
+ # ggml-cpu-*.dll variants and ggml-vulkan.dll) as a CMake MODULE
+ # library, not SHARED, and MSVC/CMake links a MODULE target with
+ # CMAKE_MODULE_LINKER_FLAGS, a cache variable CMAKE_SHARED_LINKER_FLAGS
+ # never reaches. Measured: a build with only
+ # CMAKE_SHARED_LINKER_FLAGS/CMAKE_EXE_LINKER_FLAGS set to -MAP produced
+ # ggml.map, ggml-base.map, llama.map, llama-common.map,
+ # llama-server-impl.map, mtmd.map and llama-server.map (the exe) but
+ # NOT ONE .map for any ggml-cpu-*.dll or ggml-vulkan.dll — exactly the
+ # files verify-sidecar-isa.sh's Windows guard most needs a map for,
+ # since they are where an unconditional-AVX regression would actually
+ # ship. All three linker-flags variables now carry -MAP.
+ echo "$common -DBUILD_SHARED_LIBS=ON -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON -DGGML_VULKAN=ON -DCMAKE_SHARED_LINKER_FLAGS=-MAP -DCMAKE_EXE_LINKER_FLAGS=-MAP -DCMAKE_MODULE_LINKER_FLAGS=-MAP" ;;
x86_64-unknown-linux-gnu)
# CMAKE_BUILD_RPATH_USE_ORIGIN=ON (BLOCKER B3): without it,
# CMAKE_BUILD_WITH_INSTALL_RPATH's OFF default still makes CMake write