ariym / whisper-node

Node.js bindings for OpenAI's Whisper. (C++ CPU version by ggerganov)
https://npmjs.com/whisper-node
MIT License
223 stars 36 forks source link

Problem: whisper.cpp not initialized in nextjs project #45

Open MatheusAntonioF opened 6 months ago

MatheusAntonioF commented 6 months ago

Problem

When using this library in a Nextjs project v14, and executing it in a server component I'm receiving this error I already follow the README.md and executed the command: bunx whisper-node download

Error

cd: no such file or directory: project/.next/server/lib/whisper.cpp
[whisper-node] Problem. whisper.cpp not initialized. Current shelljs directory: project/.next/server/vendor-chunks
[whisper-node] Attempting to run 'make' command in /whisper directory...
[whisper-node] Problem. 'make' command failed. Please run 'make' command in /whisper directory. Current shelljs directory:  project/.next/server/vendor-chunks

Any thoughts about this? Does this library support running with nextjs?

Thanks!

Versions

loudar commented 4 months ago

Same issue here on Windows.

Tried running the make myself within the directory where whisper.cpp lies, but no success:

Got as far as using cygwin to resolve errors that couldn't find cc, g++ and head (and then adding those dirs to path), but still getting errors I can't really wrap my head around to:

g++ -I. -I./examples -O3 -DNDEBUG -std=c++11 -fPIC -D_XOPEN_SOURCE=600 examples/bench/bench.cpp ggml.o ggml-alloc.o ggml-backend.o ggml-quants.o whisper.o -o bench
g++ -I. -I./examples -O3 -DNDEBUG -std=c++11 -fPIC -D_XOPEN_SOURCE=600 examples/quantize/quantize.cpp examples/common.cpp examples/common-ggml.cpp ggml.o ggml-alloc.o ggml-backend.o ggml-quants.o whisper.o -o quantize
g++ -I. -I./examples -O3 -DNDEBUG -std=c++11 -fPIC -D_XOPEN_SOURCE=600 examples/server/server.cpp examples/common.cpp examples/common-ggml.cpp ggml.o ggml-alloc.o ggml-backend.o ggml-quants.o whisper.o -o server
C:/ghcup/ghc/8.10.7/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\user\AppData\Local\Temp\cciwJ6to.o:server.cpp:(.text+0x45a): undefined reference to `__imp_WSACleanup'
C:/ghcup/ghc/8.10.7/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\user\AppData\Local\Temp\cciwJ6to.o:server.cpp:(.text+0xab4): undefined reference to `__imp_select'
C:/ghcup/ghc/8.10.7/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\user\AppData\Local\Temp\cciwJ6to.o:server.cpp:(.text$_ZN7httplib22default_socket_optionsEy[_ZN7httplib22default_socket_optionsEy]+0xb): undefined reference to `__imp_setsockopt'
C:/ghcup/ghc/8.10.7/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\user\AppData\Local\Temp\cciwJ6to.o:server.cpp:(.text$_ZN7httplib6detail12SocketStream4readEPcy[_ZN7httplib6detail12SocketStream4readEPcy]+0xe1): undefined reference to `__imp_select'
[etc...]