Skip to content

Won't compile on a MacBook Pro M1 8 GB #123

New issue

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

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

Already on GitHub? # to your account

Closed
tjouneau opened this issue Mar 14, 2023 · 3 comments
Closed

Won't compile on a MacBook Pro M1 8 GB #123

tjouneau opened this issue Mar 14, 2023 · 3 comments
Labels
build Compilation issues

Comments

@tjouneau
Copy link

tjouneau commented Mar 14, 2023

Hi
I'm on a Macbook Pro M1 with 8GB RAM ; I use zsh (if that's of any importance).
I have no experience in C/C++ other than compiling stuff.
Cloning the repo and entering make gives this :

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:1364:25: error: implicit declaration of function 'vdotq_s32' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        int32x4_t p_0 = vdotq_s32(vdupq_n_s32(0), v0_0ls, v1_0ls);
                        ^
ggml.c:1364:19: error: initializing 'int32x4_t' (vector of 4 'int32_t' values) with an expression of incompatible type 'int'
        int32x4_t p_0 = vdotq_s32(vdupq_n_s32(0), v0_0ls, v1_0ls);
                  ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ggml.c:1365:19: error: initializing 'int32x4_t' (vector of 4 'int32_t' values) with an expression of incompatible type 'int'
        int32x4_t p_1 = vdotq_s32(vdupq_n_s32(0), v0_1ls, v1_1ls);
                  ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ggml.c:1367:13: error: assigning to 'int32x4_t' (vector of 4 'int32_t' values) from incompatible type 'int'
        p_0 = vdotq_s32(p_0, v0_0hs, v1_0hs);
            ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ggml.c:1368:13: error: assigning to 'int32x4_t' (vector of 4 'int32_t' values) from incompatible type 'int'
        p_1 = vdotq_s32(p_1, v0_1hs, v1_1hs);
            ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 errors generated.
make: *** [ggml.o] Error 1

What could I do to improve this? Thanks for any insight. I'm aware that gcc on MacOS is in fact Clang : should I switch to the Brew gcc-12 ?

@w3cdotorg
Copy link

Have you updated your macOS / Xcode? My MacBook Air M2 shows:

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)

And it compiles OK.

@tjouneau
Copy link
Author

@w3cdotorg It was exactly this. I re-downloaded the command line utilities from Apple's website. A pity this is not automatically updated.

@gjmulder gjmulder added the build Compilation issues label Mar 15, 2023
@flyingkisser
Copy link

it cannot work on gcc 14.1.0 macos m2
saying:
I ccache not found. Consider installing it for faster compilation.
I llama.cpp build info:
I UNAME_S: Darwin
I UNAME_P: arm
I UNAME_M: arm64
I CFLAGS: -I. -Icommon -D_XOPEN_SOURCE=600 -D_DARWIN_C_SOURCE -DNDEBUG -DGGML_USE_ACCELERATE -DACCELERATE_NEW_LAPACK -DACCELERATE_LAPACK_ILP64 -DGGML_USE_LLAMAFILE -DGGML_USE_METAL -std=c11 -fPIC -O3 -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wshadow -Wstrict-prototypes -Wpointer-arith -Wmissing-prototypes -Werror=implicit-int -Werror=implicit-function-declaration -pthread -Wdouble-promotion
I CXXFLAGS: -std=c++11 -fPIC -O3 -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wmissing-declarations -Wmissing-noreturn -pthread -Wno-array-bounds -Wno-format-truncation -Wextra-semi -I. -Icommon -D_XOPEN_SOURCE=600 -D_DARWIN_C_SOURCE -DNDEBUG -DGGML_USE_ACCELERATE -DACCELERATE_NEW_LAPACK -DACCELERATE_LAPACK_ILP64 -DGGML_USE_LLAMAFILE -DGGML_USE_METAL
I NVCCFLAGS: -std=c++11 -O3
I LDFLAGS: -framework Accelerate -framework Foundation -framework Metal -framework MetalKit
I CC: gcc-14 (Homebrew GCC 14.1.0) 14.1.0
I CXX: g++-14 (Homebrew GCC 14.1.0) 14.1.0

gcc-14 -I. -Icommon -D_XOPEN_SOURCE=600 -D_DARWIN_C_SOURCE -DNDEBUG -DGGML_USE_ACCELERATE -DACCELERATE_NEW_LAPACK -DACCELERATE_LAPACK_ILP64 -DGGML_USE_LLAMAFILE -DGGML_USE_METAL -std=c11 -fPIC -O3 -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wshadow -Wstrict-prototypes -Wpointer-arith -Wmissing-prototypes -Werror=implicit-int -Werror=implicit-function-declaration -pthread -Wdouble-promotion -c ggml.c -o ggml.o
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/System/Library/Frameworks/Accelerate.framework/Headers/../Frameworks/vecLib.framework/Headers/vecLib.h:25,
from /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.h:20,
from ggml.c:285:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/System/Library/Frameworks/vecLib.framework/Headers/vBasicOps.h: In function 'vU64Sub':
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/System/Library/Frameworks/vecLib.framework/Headers/vBasicOps.h:658:3: note: use '-flax-vector-conversions' to permit conversions between vectors with differing element types or numbers of subparts
658 | vUInt32 __vbasicops_vB) { return vsubq_u64( (uint64x2_t)__vbasicops_vA, (uint64x2_t)__vbasicops_vB); }
| ^~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/System/Library/Frameworks/vecLib.framework/Headers/vBasicOps.h:658:38: error: incompatible types when returning type 'uint64x2_t' but 'vUInt32' was expected
658 | vUInt32 __vbasicops_vB) { return vsubq_u64( (uint64x2_t)__vbasicops_vA, (uint64x2_t)__vbasicops_vB); }
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/System/Library/Frameworks/vecLib.framework/Headers/vBasicOps.h: In function 'vS64Sub':
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/System/Library/Frameworks/vecLib.framework/Headers/vBasicOps.h:733:38: error: incompatible types when returning type 'int64x2_t' but vUInt32' was expected
733 | vUInt32 __vbasicops_vB) { return vsubq_s64( (int64x2_t)__vbasicops_vA, (int64x2_t)__vbasicops_vB); }
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/System/Library/Frameworks/vecLib.framework/Headers/vBasicOps.h: In function 'vU64Add':
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/System/Library/Frameworks/vecLib.framework/Headers/vBasicOps.h:805:38: error: incompatible types when returning type 'uint64x2_t' but 'vUInt32' was expected
805 | vUInt32 __vbasicops_vB) { return vaddq_u64( (uint64x2_t)__vbasicops_vA, (uint64x2_t)__vbasicops_vB); }
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/System/Library/Frameworks/vecLib.framework/Headers/vBasicOps.h: In function 'vS64Add':
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/System/Library/Frameworks/vecLib.framework/Headers/vBasicOps.h:875:38: error: incompatible types when returning type 'int64x2_t' but vUInt32' was expected
875 | vSInt32 __vbasicops_vB) { return vaddq_s64( (int64x2_t)__vbasicops_vA, (int64x2_t)__vbasicops_vB); }
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [ggml.o] Error 1

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
build Compilation issues
Projects
None yet
Development

No branches or pull requests

4 participants