whisper.cpp
whisper.cpp copied to clipboard
make stream failing on M1 mac
whisper.cpp git:(master) make stream
c++ -I. -I./examples -O3 -std=c++11 -pthread examples/stream/stream.cpp ggml.o whisper.o -o stream `sdl2-config --cflags --libs` -framework Accelerate
In file included from examples/stream/stream.cpp:12:
In file included from /usr/local/include/SDL2/SDL.h:38:
In file included from /usr/local/include/SDL2/SDL_cpuinfo.h:110:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/immintrin.h:14:2: error: "This header is only meant to be used on x86 and x64 architecture"
#error "This header is only meant to be used on x86 and x64 architecture"
^
In file included from examples/stream/stream.cpp:12:
In file included from /usr/local/include/SDL2/SDL.h:38:
In file included from /usr/local/include/SDL2/SDL_cpuinfo.h:110:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/immintrin.h:17:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/x86gprintrin.h:15:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/hresetintrin.h:42:27: error: invalid input constraint 'a' in asm
__asm__ ("hreset $0" :: "a"(__eax));
Seems like an improper include is getting set for immintrin.h?
Weird - can you show output of:
make clean
make
It should look something like this:
$ make
cc -I. -O3 -std=c11 -pthread -DGGML_USE_ACCELERATE -c ggml.c -o ggml.o
c++ -I. -I./examples -O3 -std=c++11 -pthread -c whisper.cpp -o whisper.o
c++ -I. -I./examples -O3 -std=c++11 -pthread examples/main/main.cpp whisper.o ggml.o -o main -framework Accelerate
...
> make clean
rm -f *.o main stream bench libwhisper.a
> make
cc -I. -O3 -std=c11 -pthread -DGGML_USE_ACCELERATE -c ggml.c -o ggml.o
c++ -I. -I./examples -O3 -std=c++11 -pthread -c whisper.cpp -o whisper.o
c++ -I. -I./examples -O3 -std=c++11 -pthread examples/main/main.cpp whisper.o ggml.o -o main -framework Accelerate
./main -h
Hmm, looks good.
Seems like an improper include is getting set for immintrin.h?
The compiler should never reach this header if __ARM_NEON is defined - which is the case for M1.
Well I am 100% sure I am on an M1...
On Sat, Nov 12, 2022, 1:35 AM Georgi Gerganov @.***> wrote:
Hmm, looks good.
Seems like an improper include is getting set for immintrin.h?
The compiler should never reach this header if __ARM_NEON is defined - which is the case for M1.
— Reply to this email directly, view it on GitHub https://github.com/ggerganov/whisper.cpp/issues/139#issuecomment-1312386500, or unsubscribe https://github.com/notifications/unsubscribe-auth/AH4PQADR67ECREOZOZPGVQLWH43D3ANCNFSM6AAAAAAR5VNHKE . You are receiving this because you authored the thread.Message ID: @.***>
I just noticed the error is in SDL_cpuinfo.h - I initially assumed it is in ggml.c.
This likely means that the SDL2 library is somehow not properly configured - try reinstalling it.
I personally use brew on Mac OS:
brew install sdl2
brew reinstall sdl2
==> Downloading https://ghcr.io/v2/homebrew/core/sdl2/manifests/2.24.2
Already downloaded:
/Users/jmill/Library/Caches/Homebrew/downloads/b765d8f9450921c486fa1d8e3d11a4a48eb50b0f3a1d1a20d4f5778d1d46bb13--sdl2-2.24.2.bottle_manifest.json
==> Downloading
https://ghcr.io/v2/homebrew/core/sdl2/blobs/sha256:439ba2cf4becefadda6c9b06f3fa4b520d5b883afb65beca19985932
Already downloaded:
/Users/jmill/Library/Caches/Homebrew/downloads/a5b55587add71274ffdcf9c8da582f150b0c9bfab9471f51a1812d108064f14e--sdl2--2.24.2.monterey.bottle.tar.gz
==> Reinstalling sdl2
==> Pouring sdl2--2.24.2.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/sdl2/2.24.2: 93 files, 6.0MB
==> Running `brew cleanup sdl2`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Still the same.
On Sat, Nov 12, 2022 at 10:15 AM Georgi Gerganov @.***> wrote:
I just noticed the error is in SDL_cpuinfo.h - I initially assumed it is in ggml.c. This likely means that the SDL2 library is somehow not properly configured
- try reinstalling it.
I personally use brew on Mac OS:
brew install sdl2
— Reply to this email directly, view it on GitHub https://github.com/ggerganov/whisper.cpp/issues/139#issuecomment-1312503306, or unsubscribe https://github.com/notifications/unsubscribe-auth/AH4PQAD4P7474EQZPCOCTFTWH6X7HANCNFSM6AAAAAAR5VNHKE . You are receiving this because you authored the thread.Message ID: @.***>
hmm, from looking at some other issues related, it seems like i am not using the best brew prefix for an M1
which brew returns /usr/local... and not /opt/homebrew as expected
TL;DR
you probably botched your brew install
# run homebrew install script (copy it from there don't run code from Internet blah blah blah)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# run their "next steps" REPLACE WITH YOUR USERNAME
echo '# Set PATH, MANPATH, etc., for Homebrew.' >> /Users/laptop/.zprofile
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/laptop/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
# install sdl2
brew install sdl2
make stream
# profit
Explanation / Rambling
I bought my M1 early and at that point, I don't recall Homebrew working nicely with ARM64, so I had a basterdized setup with iTerm Rosetta and iTerm.
I ran into the error stated at the beginning of this issue, as well as an issue installing sdl2 using brew install sdl2.
Running the Homebrew install script as well as their recommended "Next Steps" after the install script had run resolved this issue for me.
I was then able to brew install sdl2 and make stream with no errors. I am very excited about possibly being able to run this script. Frozen, with excitement, perhaps - and that is why I am writing these detailed instructions for anyone else that might run into this.
uninstall sdl2
brew uninstall sdl2
then install sdl2 from source code....
git clone https://github.com/libsdl-org/SDL.git -b SDL2 cd SDL mkdir build cd build ../configure make sudo make install