Skip to content

Commit 19e180c

Browse files
author
Daniele Briggi
committed
fix(windows): missing codecvt link
1 parent 0e86c29 commit 19e180c

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

.github/workflows/main.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,21 @@ jobs:
8888
pacman -S --noconfirm git
8989
shell: msys2 {0}
9090

91+
- name: windows check compiler versions
92+
if: matrix.os == 'windows-latest'
93+
run: |
94+
echo "=== Compiler Versions ==="
95+
gcc --version
96+
g++ --version
97+
echo "=== C++17 Feature Test ==="
98+
echo '#include <iostream>' > test.cpp
99+
echo '#include <codecvt>' >> test.cpp
100+
echo '#include <locale>' >> test.cpp
101+
echo 'int main() { std::codecvt_utf8_utf16<wchar_t> conv; return 0; }' >> test.cpp
102+
g++ -std=c++17 -c test.cpp 2>&1 || echo "C++17 codecvt not supported"
103+
rm -f test.cpp test.o
104+
shell: msys2 {0}
105+
91106
- name: windows build sqlite-ai
92107
if: matrix.name == 'windows'
93108
run: make extension ${{ matrix.make && matrix.make || ''}}

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ MAKEFLAGS += -j$(CPUS)
2828
CC = gcc
2929
CXX = g++
3030
CFLAGS = -Wall -Wextra -Wno-unused-parameter -I$(SRC_DIR) -I$(LLAMA_DIR)/ggml/include -I$(LLAMA_DIR)/include
31+
CXXFLAGS =
3132
LDFLAGS = -L./$(BUILD_LLAMA)/common -L./$(BUILD_LLAMA)/ggml/src -L./$(BUILD_LLAMA)/src -L./$(BUILD_WHISPER)/src -lcommon -lggml -lggml-cpu -lggml-base -lllama -lwhisper
3233
LLAMA_OPTIONS = $(LLAMA) -DLLAMA_CURL=OFF -DLLAMA_BUILD_EXAMPLES=OFF -DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_TOOLS=OFF -DLLAMA_BUILD_SERVER=OFF
3334
WHISPER_OPTIONS = $(WHISPER) -DWHISPER_BUILD_EXAMPLES=OFF -DWHISPER_BUILD_TESTS=OFF -DWHISPER_BUILD_SERVER=OFF
@@ -55,6 +56,12 @@ ifeq ($(PLATFORM),windows)
5556
# Create .def file for Windows
5657
DEF_FILE := $(BUILD_DIR)/ai.def
5758
STRIP = strip --strip-unneeded $@
59+
# Windows-specific C++ flags to work around MinGW codecvt issues
60+
# CXXFLAGS += -D_GLIBCXX_USE_CXX11_ABI=1 -DGGML_USE_UNICODE=0 -DLLAMA_DISABLE_UNICODE=1
61+
CXXFLAGS += -std=c++17 -Wall -Wextra -Wno-unused-parameter -I$(SRC_DIR) -I$(LLAMA_DIR)/ggml/include -I$(LLAMA_DIR)/include
62+
# Windows-specific flags to work around MinGW codecvt issues
63+
# LLAMA_OPTIONS += -DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=1 -DGGML_USE_UNICODE=0 -DLLAMA_DISABLE_UNICODE=1"
64+
# WHISPER_OPTIONS += -DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=1 -DGGML_USE_UNICODE=0"
5865
else ifeq ($(PLATFORM),macos)
5966
TARGET := $(DIST_DIR)/ai.dylib
6067
LLAMA_LIBS += $(BUILD_LLAMA)/ggml/src/ggml-metal/libggml-metal.a $(BUILD_LLAMA)/ggml/src/ggml-blas/libggml-blas.a
@@ -132,7 +139,7 @@ all: $(TARGET)
132139

133140
# Loadable library
134141
$(TARGET): $(OBJ_FILES) $(DEF_FILE) $(LLAMA_LIBS) $(WHISPER_LIBS)
135-
$(CXX) $(OBJ_FILES) $(DEF_FILE) -o $@ $(LDFLAGS)
142+
$(CXX) $(CXXFLAGS) $(OBJ_FILES) $(DEF_FILE) -o $@ $(LDFLAGS)
136143
ifeq ($(PLATFORM),windows)
137144
# Generate import library for Windows
138145
dlltool -D $@ -d $(DEF_FILE) -l $(DIST_DIR)/ai.lib

0 commit comments

Comments
 (0)