Skip to content

Commit c48eff9

Browse files
author
Daniele Briggi
committed
fix(makefile): variables declaration before usage
1 parent c29ef75 commit c48eff9

File tree

2 files changed

+50
-37
lines changed

2 files changed

+50
-37
lines changed

.github/workflows/main.yml

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,30 @@ jobs:
1515
fail-fast: false
1616
matrix:
1717
include:
18-
- name: linux-vulkan
19-
os: ubuntu-latest
20-
arch: x86_64
21-
make: LLAMA="-DGGML_BACKEND_DL=ON -DGGML_NATIVE=OFF -DGGML_CPU_ALL_VARIANTS=ON -DGGML_VULKAN=ON"
18+
# - name: linux-vulkan
19+
# os: ubuntu-latest
20+
# arch: x86_64
21+
# make: LLAMA="-DGGML_BACKEND_DL=ON -DGGML_NATIVE=OFF -DGGML_CPU_ALL_VARIANTS=ON -DGGML_VULKAN=ON"
2222
- name: macos
2323
os: macos-latest
24-
- name: windows
25-
os: windows-latest
26-
arch: x86_64
27-
- name: android
28-
os: ubuntu-latest
29-
arch: arm64-v8a
30-
make: PLATFORM=android ARCH=arm64-v8a
31-
- name: android
32-
os: ubuntu-latest
33-
arch: x86_64
34-
make: PLATFORM=android ARCH=x86_64
35-
sqlite-amalgamation-zip: https://sqlite.org/2025/sqlite-amalgamation-3490100.zip
36-
- name: ios
37-
os: macos-latest
38-
make: PLATFORM=ios
39-
- name: isim
40-
os: macos-latest
41-
make: PLATFORM=isim
24+
# - name: windows
25+
# os: windows-latest
26+
# arch: x86_64
27+
# - name: android
28+
# os: ubuntu-latest
29+
# arch: arm64-v8a
30+
# make: PLATFORM=android ARCH=arm64-v8a
31+
# - name: android
32+
# os: ubuntu-latest
33+
# arch: x86_64
34+
# make: PLATFORM=android ARCH=x86_64
35+
# sqlite-amalgamation-zip: https://sqlite.org/2025/sqlite-amalgamation-3490100.zip
36+
# - name: ios
37+
# os: macos-latest
38+
# make: PLATFORM=ios
39+
# - name: isim
40+
# os: macos-latest
41+
# make: PLATFORM=isim
4242

4343
defaults:
4444
run:
@@ -93,6 +93,11 @@ jobs:
9393
run: make extension ${{ matrix.make && matrix.make || ''}}
9494
shell: msys2 {0}
9595

96+
- name: Download ios-cmake toolchain
97+
if: matrix.name == 'macos' || matrix.name == 'isim' || matrix.name == 'ios'
98+
run: |
99+
curl -L -o ios.toolchain.cmake https://raw.githubusercontent.com/leetal/ios-cmake/master/ios.toolchain.cmake
100+
96101
- name: build sqlite-ai
97102
if: matrix.name != 'windows'
98103
run: make extension ${{ matrix.make && matrix.make || ''}}
@@ -149,6 +154,13 @@ jobs:
149154
run: make test
150155
shell: msys2 {0}
151156

157+
- name: check whisper CoreML linking (macOS)
158+
if: matrix.name == 'macos'
159+
run: |
160+
echo "Checking if whisper CoreML symbols are present..."
161+
nm -D dist/ai.dylib | grep -i coreml || echo "CoreML symbols not found in binary"
162+
otool -L dist/ai.dylib | grep CoreML || echo "CoreML framework not linked"
163+
152164
- name: test sqlite-ai
153165
if: matrix.name == 'linux' || matrix.name == 'macos'
154166
run: make test

Makefile

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,6 @@ endif
2424
# Speed up builds by using all available CPU cores
2525
MAKEFLAGS += -j$(CPUS)
2626

27-
# Compiler and flags
28-
CC = gcc
29-
CXX = g++
30-
CFLAGS = -Wall -Wextra -Wno-unused-parameter -I$(SRC_DIR) -I$(LLAMA_DIR)/ggml/include -I$(LLAMA_DIR)/include -I$(WHISPER_DIR)/include -I$(MINIAUDIO_DIR)
31-
LDFLAGS = $(LLAMA_LDFLAGS) $(WHISPER_LDFLAGS) $(MINIAUDIO_LDFLAGS)
32-
LLAMA_OPTIONS = $(LLAMA) -DLLAMA_CURL=OFF -DLLAMA_BUILD_EXAMPLES=OFF -DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_TOOLS=OFF -DLLAMA_BUILD_SERVER=OFF
33-
WHISPER_OPTIONS = $(WHISPER) -DWHISPER_BUILD_EXAMPLES=OFF -DWHISPER_BUILD_TESTS=OFF -DWHISPER_BUILD_SERVER=OFF
34-
MINIAUDIO_OPTIONS = -DMINIAUDIO_BUILD_EXAMPLES=OFF -DMINIAUDIO_BUILD_TESTS=OFF
35-
36-
# Module-specific linking flags
37-
LLAMA_LDFLAGS = -L./$(BUILD_LLAMA)/common -L./$(BUILD_LLAMA)/ggml/src -L./$(BUILD_LLAMA)/src -lcommon -lggml -lggml-cpu -lggml-base -lllama
38-
WHISPER_LDFLAGS = -L./$(BUILD_WHISPER)/src -lwhisper
39-
MINIAUDIO_LDFLAGS = -L./$(BUILD_MINIAUDIO) -lminiaudio
40-
4127
# Directories
4228
SRC_DIR = src
4329
DIST_DIR = dist
@@ -50,6 +36,21 @@ BUILD_LLAMA = $(BUILD_DIR)/llama.cpp
5036
BUILD_WHISPER = $(BUILD_DIR)/whisper.cpp
5137
BUILD_MINIAUDIO = $(BUILD_DIR)/miniaudio
5238

39+
# Compiler and flags
40+
CC = gcc
41+
CXX = g++
42+
CFLAGS = -Wall -Wextra -Wno-unused-parameter -I$(SRC_DIR) -I$(LLAMA_DIR)/ggml/include -I$(LLAMA_DIR)/include -I$(WHISPER_DIR)/include -I$(MINIAUDIO_DIR)
43+
LLAMA_OPTIONS = -DLLAMA_CURL=OFF -DLLAMA_BUILD_EXAMPLES=OFF -DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_TOOLS=OFF -DLLAMA_BUILD_SERVER=OFF
44+
WHISPER_OPTIONS = -DWHISPER_BUILD_EXAMPLES=OFF -DWHISPER_BUILD_TESTS=OFF -DWHISPER_BUILD_SERVER=OFF
45+
MINIAUDIO_OPTIONS = -DMINIAUDIO_BUILD_EXAMPLES=OFF -DMINIAUDIO_BUILD_TESTS=OFF
46+
47+
# Module-specific linking flags
48+
LLAMA_LDFLAGS = -L./$(BUILD_LLAMA)/common -L./$(BUILD_LLAMA)/ggml/src -L./$(BUILD_LLAMA)/src -lcommon -lggml -lggml-cpu -lggml-base -lllama
49+
WHISPER_LDFLAGS = -L./$(BUILD_WHISPER)/src -lwhisper
50+
MINIAUDIO_LDFLAGS = -L./$(BUILD_MINIAUDIO) -lminiaudio
51+
52+
LDFLAGS = $(LLAMA_LDFLAGS) $(WHISPER_LDFLAGS) $(MINIAUDIO_LDFLAGS)
53+
5354
# Files
5455
SRC_FILES = $(wildcard $(SRC_DIR)/*.c)
5556
OBJ_FILES = $(patsubst %.c, $(BUILD_DIR)/%.o, $(notdir $(SRC_FILES)))
@@ -70,7 +71,7 @@ else ifeq ($(PLATFORM),macos)
7071
LDFLAGS += -arch x86_64 -arch arm64 -L./$(BUILD_LLAMA)/ggml/src/ggml-metal -lggml-metal -L./$(BUILD_LLAMA)/ggml/src/ggml-blas -lggml-blas -framework Metal -framework Foundation -framework CoreFoundation -framework QuartzCore -framework Accelerate -framework CoreML -dynamiclib -undefined dynamic_lookup
7172
CFLAGS += -arch x86_64 -arch arm64
7273
LLAMA_OPTIONS += -DBUILD_SHARED_LIBS=OFF -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"
73-
WHISPER_OPTIONS += -DBUILD_SHARED_LIBS=OFF -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DWHISPER_COREML=ON
74+
WHISPER_OPTIONS += -DBUILD_SHARED_LIBS=OFF -DWHISPER_SHARED_LIB=OFF -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DWHISPER_COREML=ON -DCMAKE_TOOLCHAIN_FILE=ios.toolchain.cmake -DPLATFORM=MAC_UNIVERSAL
7475
MINIAUDIO_OPTIONS += -DBUILD_SHARED_LIBS=OFF -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"
7576
STRIP = strip -x -S $@
7677
else ifeq ($(PLATFORM),android)

0 commit comments

Comments
 (0)