Skip to content

Commit 57d5da5

Browse files
committed
cmake: don't force -mcpu=native on aarch64
It's currently not possible to cross-compile llama.cpp for aarch64 because CMakeLists.txt forces -mcpu=native for that target. -mcpu=native doesn't make sense if your build host is not the target architecture, and clang rejects it for that reason, aborting the build. This can be easily reproduced using the current Android NDK to build for aarch64 on an x86_64 host. If there is not a specific CPU-tuning target for aarch64 then -mcpu should be omitted completely. I think that makes sense, there is not enough variance in the aarch64 instruction set to warrant a fixed -mcpu optimization at this point. Fixes #495.
1 parent b8c8dda commit 57d5da5

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

CMakeLists.txt

-5
Original file line numberDiff line numberDiff line change
@@ -386,11 +386,6 @@ if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm" OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES
386386
if (MSVC)
387387
# TODO: arm msvc?
388388
else()
389-
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
390-
# Apple M1, M2, etc.
391-
# Raspberry Pi 3, 4, Zero 2 (64-bit)
392-
add_compile_options(-mcpu=native)
393-
endif()
394389
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "armv6")
395390
# Raspberry Pi 1, Zero
396391
add_compile_options(-mfpu=neon-fp-armv8 -mfp16-format=ieee -mno-unaligned-access)

0 commit comments

Comments
 (0)