whisper.cpp
whisper.cpp copied to clipboard
Tutorial: compile for Windows on Linux with MinGW (cross compile)
First, install MinGW sudo apt install mingw-w64
Then, clone the repository git clone https://github.com/ggerganov/whisper.cpp
Then, make the following changes to the files:
-
In ggml.c line 18 change #include <Windows.h> to #include <windows.h> #include <errno.h>
-
From the webpage https://github.com/meganz/mingw-std-threads download the files: mingw.invoke.h mingw.thread.h and place them in the main folder, along with whisper.cpp and others.
-
In whisper.cpp add in line 17 #include "mingw.thread.h"
-
In main.cpp add in line 14 #include "mingw.thread.h"
-
then, for compilation, we need to drop the -pthread flag and static link libgcc and libstdc++ as follows:
x86_64-w64-mingw32-gcc -I. -O3 -std=c11 -mfma -mf16c -mavx -mavx2 -c ggml.c -o ggml.o
x86_64-w64-mingw32-g++ -I. -I./examples -O3 -std=c++11 -c whisper.cpp -o whisper.o
x86_64-w64-mingw32-g++ -I. -I./examples -O3 -std=c++11 -static-libgcc -static-libstdc++ examples/main/main.cpp ggml.o whisper.o -o main
the compiled executable was tested on an Intel 4th gen CPU and it worked BUT accented characters do not show correctly (not a problem for english). Not sure if it has to do with unicode compiler flags or other modifications are needed. Tried to run it on a 3rd gen intel CPU but did not work.