ggerganov / whisper.cpp

Port of OpenAI's Whisper model in C/C++
MIT License
35.82k stars 3.65k forks source link

Go bindings fail to compile on Windows because of incorrect Make target name #2582

Open dharmab opened 1 day ago

dharmab commented 1 day ago

Makefile for Go bindings has a hardcoded libwhisper.a, however on Windows this object (and target) is named whisper.a

make -C third_party/whisper.cpp/bindings/go whisper
make[1]: Entering directory '/d/a/skyeye/skyeye/third_party/whisper.cpp/bindings/go'
Mkdir build
Mkdir models
Build whisper
make[2]: Entering directory '/d/a/skyeye/skyeye/third_party/whisper.cpp'
which: no ccache in (/ucrt64/bin:/usr/local/bin:/usr/bin:/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)
I ccache not found. Consider installing it for faster compilation.
I whisper.cpp build info: 
I UNAME_S:   MINGW64_NT-10.0-20348
I UNAME_P:   unknown
I UNAME_M:   x86_64
I CFLAGS:    -Iggml/include -Iggml/src -Iinclude -Isrc -Iexamples -D_XOPEN_SOURCE=600 -DNDEBUG -D_WIN32_WINNT=0x602 -DGGML_USE_OPENMP  -std=c11   -fPIC -O3 -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wshadow -Wstrict-prototypes -Wpointer-arith -Wmissing-prototypes -Werror=implicit-int -Werror=implicit-function-declaration -march=native -mtune=native -Xassembler -muse-unaligned-vector-move -fopenmp -Wdouble-promotion 
I CXXFLAGS:  -std=c++11 -fPIC -O3 -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wmissing-declarations -Wmissing-noreturn -Xassembler -muse-unaligned-vector-move -fopenmp  -march=native -mtune=native -Wno-array-bounds -Wno-format-truncation -Wextra-semi -Iggml/include -Iggml/src -Iinclude -Isrc -Iexamples -D_XOPEN_SOURCE=600 -DNDEBUG -D_WIN32_WINNT=0x602 -DGGML_USE_OPENMP 
I NVCCFLAGS: -std=c++11 -O3 
I LDFLAGS:    
I CC:        cc.exe (Rev2, Built by MSYS2 project) 14.2.0
I CXX:       c++.exe (Rev2, Built by MSYS2 project) 14.2.0
make[2]: *** No rule to make target 'libwhisper.a'.  Stop.
make[2]: Leaving directory '/d/a/skyeye/skyeye/third_party/whisper.cpp'
make[1]: *** [Makefile:33: whisper] Error 2
make[1]: Leaving directory '/d/a/skyeye/skyeye/third_party/whisper.cpp/bindings/go'
make: *** [Makefile:125: third_party/whisper.cpp/whisper.a] Error 2

Problematic line

dharmab commented 21 hours ago

Workaround: https://github.com/ggerganov/whisper.cpp/commit/810260fb2bae3ae7f5be54a95bc8c66b6d19a474

It's kind of fragile, it'll probably break if the Makefile target changes again. I ended up having to rename the file back to libwhisper.a afterwards to make it play nice with ld on MSYS2 🙃