Skip to content

Tutorial: compile for Windows on Linux with MinGW (cross compile) #168

Closed
@Topping1

Description

@Topping1

First, install MinGW
sudo apt install g++-mingw-w64-x86-64-posix
sudo apt install gcc-mingw-w64-x86-64-posix

Then, clone the repository
git clone https://github.com/ggerganov/whisper.cpp

  • then, for compilation, we need to modify the pthread flag and static link libgcc and libstdc++ as follows:

x86_64-w64-mingw32-gcc-posix -I. -O3 -std=c11 -mfma -mf16c -mavx -mavx2 -c ggml.c -o ggml.o

x86_64-w64-mingw32-g++-posix -I. -I./examples -O3 -std=c++11 -lwinpthread -c whisper.cpp -o whisper.o

x86_64-w64-mingw32-g++-posix -I. -I./examples -O3 -std=c++11 -static-libgcc -static-libstdc++ -lwinpthread 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). A workaround (the problem might be with MinGW): before using main.exe on a command prompt window, execute the command chcp 65001 (UTF-8 encoding).

Tried to run it on a 3rd gen intel CPU but did not work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildBuild related issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions