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

Accelerate.h not found on mac m1

Open rozim opened this issue 1 year ago • 7 comments

(base) dave@macbook-pro llama.cpp % make
I llama.cpp build info:
I UNAME_S:  Darwin
I UNAME_P:  arm
I UNAME_M:  arm64
I CFLAGS:   -I.              -O3 -DNDEBUG -std=c11   -fPIC -pthread -DGGML_USE_ACCELERATE
I CXXFLAGS: -I. -I./examples -O3 -DNDEBUG -std=c++11 -fPIC -pthread
I LDFLAGS:   -framework Accelerate
I CC:       Apple clang version 12.0.5 (clang-1205.0.22.9)
I CXX:      Apple clang version 12.0.5 (clang-1205.0.22.9)

cc  -I.              -O3 -DNDEBUG -std=c11   -fPIC -pthread -DGGML_USE_ACCELERATE   -c ggml.c -o ggml.o
ggml.c:115:10: fatal error: 'Accelerate/Accelerate.h' file not found
#include <Accelerate/Accelerate.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [ggml.o] Error 1

(base) dave@macbook-pro llama.cpp % uname -a
Darwin macbook-pro.lan 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792\
.81.3~2/RELEASE_ARM64_T6000 arm64

About this Mac says "MacOS 13.2.1"

Do I need to install this?

rozim avatar Mar 19 '23 03:03 rozim

You may have to install the Command Line Tools (xcode-select --install)

j-f1 avatar Mar 19 '23 03:03 j-f1

Thanks Jed. Didn't seem to work:

(base) dave@macbook-pro ~ % xcode-select --install xcode-select: error: command line tools are already installed, use "Software Update" in System Settings to install updates

And Software Update has automated updates on & it checked and didn't see any new updates.

rozim avatar Mar 19 '23 03:03 rozim

No issue compiling here on a similar machine:

[soro:/Users … l/pytorch/llama.cpp] [pytorch-m1] master* 13d0h13m58s ± make
I llama.cpp build info: 
I UNAME_S:  Darwin
I UNAME_P:  arm
I UNAME_M:  arm64
I CFLAGS:   -I.              -O3 -DNDEBUG -std=c11   -fPIC -pthread -DGGML_USE_ACCELERATE
I CXXFLAGS: -I. -I./examples -O3 -DNDEBUG -std=c++11 -fPIC -pthread
I LDFLAGS:   -framework Accelerate
I CC:       Apple clang version 14.0.0 (clang-1400.0.29.202)
I CXX:      Apple clang version 14.0.0 (clang-1400.0.29.202)

cc  -I.              -O3 -DNDEBUG -std=c11   -fPIC -pthread -DGGML_USE_ACCELERATE   -c ggml.c -o ggml.o
c++ -I. -I./examples -O3 -DNDEBUG -std=c++11 -fPIC -pthread -c utils.cpp -o utils.o
c++ -I. -I./examples -O3 -DNDEBUG -std=c++11 -fPIC -pthread main.cpp ggml.o utils.o -o main  -framework Accelerate
./main -h
usage: ./main [options]

options:
  -h, --help            show this help message and exit
  -i, --interactive     run in interactive mode
  --interactive-start   run in interactive mode and poll user input at startup
  -r PROMPT, --reverse-prompt PROMPT
                        in interactive mode, poll user input upon seeing PROMPT
  --color               colorise output to distinguish prompt and user input from generations
  -s SEED, --seed SEED  RNG seed (default: -1)
  -t N, --threads N     number of threads to use during computation (default: 4)
  -p PROMPT, --prompt PROMPT
                        prompt to start generation with (default: random)
  -f FNAME, --file FNAME
                        prompt file to start generation.
  -n N, --n_predict N   number of tokens to predict (default: 128)
  --top_k N             top-k sampling (default: 40)
  --top_p N             top-p sampling (default: 0.9)
  --repeat_last_n N     last n tokens to consider for penalize (default: 64)
  --repeat_penalty N    penalize repeat sequence of tokens (default: 1.3)
  -c N, --ctx_size N    size of the prompt context (default: 512)
  --temp N              temperature (default: 0.8)
  -b N, --batch_size N  batch size for prompt processing (default: 8)
  -m FNAME, --model FNAME
                        model path (default: models/llama-7B/ggml-model.bin)

c++ -I. -I./examples -O3 -DNDEBUG -std=c++11 -fPIC -pthread quantize.cpp ggml.o utils.o -o quantize  -framework Accelerate
⌂70% [soro:/Users … l/pytorch/llama.cpp] [pytorch-m1] master* 13d0h15m19s ± uname -a
Darwin sora.local 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 arm64
⌂64% [soro:/Users … l/pytorch/llama.cpp] [pytorch-m1] master* 13d0h15m38s ± 

edwios avatar Mar 19 '23 08:03 edwios

Hi Dave, I had the same issue and it was caused by an outdated xcode command line tools version (an issue that is not caught by Software Update). Deleting and re-installing (with newest xcode tools) fixed the issue.

multispecies-lab avatar Mar 23 '23 03:03 multispecies-lab

afi@orchard ~/D/llama.cpp (master) [2]> make -j
I llama.cpp build info: 
I UNAME_S:  Darwin
I UNAME_P:  arm
I UNAME_M:  arm64
I CFLAGS:   -I.              -O3 -DNDEBUG -std=c11   -fPIC -Wall -Wextra -Wpedantic -Wcast-qual -Wdouble-promotion -Wshadow -Wstrict-prototypes -Wpointer-arith -Wno-unused-function -pthread -DGGML_USE_ACCELERATE
I CXXFLAGS: -I. -I./examples -O3 -DNDEBUG -std=c++11 -fPIC -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -pthread
I LDFLAGS:   -framework Accelerate
I CC:       gcc (GCC) 12.2.0
I CXX:      g++ (GCC) 12.2.0

cc  -I.              -O3 -DNDEBUG -std=c11   -fPIC -Wall -Wextra -Wpedantic -Wcast-qual -Wdouble-promotion -Wshadow -Wstrict-prototypes -Wpointer-arith -Wno-unused-function -pthread -DGGML_USE_ACCELERATE   -c ggml.c -o ggml.o
ggml.c:142:10: fatal error: Accelerate/Accelerate.h: No such file or directory
  142 | #include <Accelerate/Accelerate.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [ggml.o] Error 1

Same problem for me. I deleted and reinstalled Xcode command line tools, but still no luck.

aidenfoxivey avatar Apr 01 '23 20:04 aidenfoxivey

Confirmed: reinstalling xcode command line tools solves everything that 'main' builds.

rozim avatar May 02 '23 04:05 rozim

Confirmed: reinstalling xcode command line tools solves everything that 'main' builds.

Worked for me as well. I followed this guide: https://mac.install.guide/commandlinetools/6.html

reijin90 avatar Jun 04 '23 15:06 reijin90

Looks like this is resolved; closing

evanmiller avatar Jul 06 '23 21:07 evanmiller