Skip to content

Commit 7527e1c

Browse files
dharmabclaude
andcommitted
Fix Windows: rename ggml .a files to add lib prefix after cmake build
CMake on MSYS2 outputs ggml.a, ggml-base.a, ggml-cpu.a without the "lib" prefix. CMAKE_STATIC_LIBRARY_PREFIX doesn't propagate to the ggml subdirectory. Instead, rename any .a files missing the prefix after build so the linker's -lggml flags can find them. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 7f05ae7 commit 7527e1c

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ SKYEYE_SCALER_BIN = skyeye-scaler.exe
6868
# Override Windows Go environment with MSYS2 UCRT64 Go environment
6969
GO = /ucrt64/bin/go
7070
GOBUILDVARS += GOROOT="/ucrt64/lib/go" GOPATH="/ucrt64"
71-
# CMake on MSYS2 omits the "lib" prefix; force it so -lggml works
72-
WHISPER_CPP_CMAKE_ARGS = -G "MSYS Makefiles" -DCMAKE_STATIC_LIBRARY_PREFIX=lib
71+
# Use MSYS Makefiles generator for cmake on MSYS2
72+
WHISPER_CPP_CMAKE_ARGS = -G "MSYS Makefiles"
7373
# Static linking on Windows to avoid MSYS2 dependency at runtime
7474
LIBRARIES = opus soxr
7575
CFLAGS = $(shell pkg-config $(LIBRARIES) --cflags --static)
@@ -156,7 +156,10 @@ $(LIBWHISPER_PATH) $(WHISPER_H_PATH):
156156
-DCMAKE_BUILD_TYPE=Release \
157157
-DBUILD_SHARED_LIBS=OFF \
158158
$(WHISPER_CPP_CMAKE_ARGS) && \
159-
cmake --build "$(WHISPER_CPP_BUILD_DIR)" --target whisper; \
159+
cmake --build "$(WHISPER_CPP_BUILD_DIR)" --target whisper && \
160+
for f in $$(find "$(WHISPER_CPP_BUILD_DIR)" -name '*.a' ! -name 'lib*'); do \
161+
mv "$$f" "$$(dirname $$f)/lib$$(basename $$f)"; \
162+
done; \
160163
fi
161164

162165
.PHONY: whisper

0 commit comments

Comments
 (0)