whisper.cpp icon indicating copy to clipboard operation
whisper.cpp copied to clipboard

make stream failing on M1 mac

Open jmilldotdev opened this issue 1 year ago • 7 comments

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?

jmilldotdev avatar Nov 11 '22 14:11 jmilldotdev

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
...

ggerganov avatar Nov 11 '22 16:11 ggerganov

> 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

jmilldotdev avatar Nov 11 '22 23:11 jmilldotdev

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.

ggerganov avatar Nov 12 '22 06:11 ggerganov

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: @.***>

jmilldotdev avatar Nov 12 '22 14:11 jmilldotdev

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

ggerganov avatar Nov 12 '22 15:11 ggerganov

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: @.***>

jmilldotdev avatar Nov 12 '22 15:11 jmilldotdev

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

jmilldotdev avatar Nov 12 '22 16:11 jmilldotdev