Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building 1.2.1 for Windows using mingw yields error: Undefined reference to read_wav... #606

Closed
zorlack opened this issue Mar 13, 2023 · 6 comments

Comments

@zorlack
Copy link

zorlack commented Mar 13, 2023

I'm following the instructions in #168 but with version 1.2.1 I can no longer compile successfully:

I start in a fresh Debian container and I prep it by doing:

apt-get update -y
apt-get install git curl build-essential g++-mingw-w64-x86-64-posix gcc-mingw-w64-x86-64-posix -y
git clone -b v1.2.1  https://github.com/ggerganov/whisper.cpp.git

Now I go to do the build

root@3fc79d49a589:/# cd whisper.cpp
root@3fc79d49a589:/whisper.cpp# mkdir bin-windows
root@3fc79d49a589:/whisper.cpp# mkdir bin-windows/models
root@3fc79d49a589:/whisper.cpp# cp ./models/download-ggml-model.sh bin-windows/models
root@3fc79d49a589:/whisper.cpp# x86_64-w64-mingw32-gcc-posix -I. -O3 -std=c11 -mfma -mf16c -mavx -mavx2 -c ggml.c -o bin-windows/ggml.o
root@3fc79d49a589:/whisper.cpp# x86_64-w64-mingw32-g++-posix -I. -I./examples -O3 -std=c++11 -lwinpthread -c whisper.cpp -o bin-windows/whisper.o
root@3fc79d49a589:/whisper.cpp# x86_64-w64-mingw32-g++-posix -I. -I./examples -O3 -std=c++11 -static-libgcc -static-libstdc++ -lwinpthread examples/main/main.cpp bin-windows/ggml.o bin-windows/whisper.o -o bin-windows/main
/usr/bin/x86_64-w64-mingw32-ld: /tmp/ccaSbP9g.o:main.cpp:(.text.startup+0x6a4): undefined reference to `read_wav(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<float, std::allocator<float> >&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >&, bool)'
collect2: error: ld returned 1 exit status

I'm not sure what's happening here. Seems like it doesn't see a reference, but I'm not sure what's changed.

This process works just fine for v1.2.0

Thanks very much!

@lijihhh
Copy link

lijihhh commented Mar 17, 2023

There's a new file in "examples" named "common.cpp" in this version.
You need to build this file also.
x86_64-w64-mingw32-g++-posix -I. -I./examples -O3 -std=c++11 -lwinpthread -c examples/common.cpp -o common.o
And add the "common.o" to build "main.cpp".
x86_64-w64-mingw32-g++-posix -I. -I./examples -O3 -std=c++11 -static-libgcc -static-libstdc++ -lwinpthread examples/main/main.cpp common.o whisper.o ggml.o -o main

@zorlack zorlack closed this as completed Mar 17, 2023
@zorlack
Copy link
Author

zorlack commented Mar 17, 2023

Thank you! @lijihhh you're exactly right.

@abdoOmar01
Copy link

@lijihhh Running the main.exe after building it this way doesn't yield any results
I'm not sure what I'm doing wrong

@lijihhh
Copy link

lijihhh commented Apr 4, 2023

Which cpu are you using?My E5 cpu can't print any results either. But it works correctly on my i3 PC.

@abdoOmar01
Copy link

I'm using an i7-4700MQ

@jfariasf87
Copy link

jfariasf87 commented Dec 14, 2023

I'm getting the same error when building on Ubuntu 22.04 on WSL2, even after compiling common.cpp and adding it to main.cpp

 x86_64-w64-mingw32-g++-posix -I. -I./examples -O3 -std=c++11 -static-libgcc -static-libstdc++ -lwinpthread examples/main/main.cpp bin-windows/common.o bin-windows/whisper.o bin-windows/ggml.o -o bin-windows/main

..
/usr/bin/x86_64-w64-mingw32-ld: bin-windows/ggml.o:ggml.c:(.rdata+0x4988): undefined reference to `ggml_vec_dot_q6_K_q8_K'
/usr/bin/x86_64-w64-mingw32-ld: bin-windows/ggml.o:ggml.c:(.rdata+0x49c0): undefined reference to `quantize_row_q8_K'
collect2: error: ld returned 1 exit status

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants