Skip to content

Commit ec505d7

Browse files
committed
fix: add ggml-blas support for macOS build
Fix the following error that occurred when loading the extension: Error: dlopen(./dist/ai.dylib, 0x000A): symbol not found in flat namespace '_ggml_backend_blas_reg' Updated the Makefile to link against libggml-blas.a and include -lggml-blas in LDFLAGS for macOS builds. This enables BLAS support, potentially improving performance on macOS platforms.
1 parent 2e0e251 commit ec505d7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ ifeq ($(PLATFORM),windows)
7272
else ifeq ($(PLATFORM),macos)
7373
TARGET := $(DIST_DIR)/ai.dylib
7474
LLAMA_LIBS += $(BUILD_GGML)/lib/libggml-metal.a
75+
LLAMA_LIBS += $(BUILD_GGML)/lib/libggml-blas.a
7576
ifndef ARCH
7677
LDFLAGS += -arch x86_64 -arch arm64
7778
CFLAGS += -arch x86_64 -arch arm64
@@ -85,7 +86,7 @@ else ifeq ($(PLATFORM),macos)
8586
WHISPER_OPTIONS += -DGGML_OPENMP=OFF -DCMAKE_OSX_ARCHITECTURES="$(ARCH)" -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0
8687
MINIAUDIO_OPTIONS += -DCMAKE_OSX_ARCHITECTURES="$(ARCH)" -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0
8788
endif
88-
LDFLAGS += -L./$(BUILD_GGML)/lib -lggml-metal -L./$(BUILD_GGML)/lib -framework Metal -framework Foundation -framework CoreFoundation -framework QuartzCore -dynamiclib -undefined dynamic_lookup -headerpad_max_install_names
89+
LDFLAGS += -L./$(BUILD_GGML)/lib -lggml-metal -L./$(BUILD_GGML)/lib -lggml-blas -framework Metal -framework Foundation -framework CoreFoundation -framework QuartzCore -dynamiclib -undefined dynamic_lookup -headerpad_max_install_names
8990
STRIP = strip -x -S $@
9091
else ifeq ($(PLATFORM),android)
9192
ifndef ARCH # Set ARCH to find Android NDK's Clang compiler, the user should set the ARCH
@@ -348,4 +349,4 @@ help:
348349
@echo " xcframework - Build the Apple XCFramework"
349350
@echo " aar - Build the Android AAR package"
350351

351-
.PHONY: all clean test extension help version xcframework aar
352+
.PHONY: all clean test extension help version xcframework aar

0 commit comments

Comments
 (0)