ggerganov / llama.cpp

LLM inference in C/C++
MIT License
65.07k stars 9.33k forks source link

Cmake build error in Termux #4340

Closed Jeximo closed 9 months ago

Jeximo commented 9 months ago

Prerequisites

Please answer the following questions for yourself before submitting an issue.

Expected Behavior

I expect cmake -B build is suffecient to build llama.cpp

Current Behavior

cmake -B build fails. make works as expected.

Environment and Context

$ lscpu

Architecture: aarch64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 8 On-line CPU(s) list: 0-7 Vendor ID: Qualcomm Model name: Kryo-4XX-Silver Model: 14 Thread(s) per core: 1 Core(s) per socket: 4 Socket(s): 1 Stepping: 0xd CPU(s) scaling MHz: 62% CPU max MHz: 1785.6000 CPU min MHz: 300.0000 BogoMIPS: 38.40 Flags: fp asimd evtstrm aes pmull sha1 sha 2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp Model name: Kryo-4XX-Gold Model: 14 Thread(s) per core: 1 Core(s) per socket: 2 Socket(s): 2 Stepping: 0xd CPU(s) scaling MHz: 71% CPU max MHz: 2841.6001 CPU min MHz: 710.4000 BogoMIPS: 38.40 Flags: fp asimd evtstrm aes pmull sha1 sha 2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp Vulnerabilities: Itlb multihit: Not affected L1tf: Not affected Mds: Not affected Meltdown: Vulnerable Spec store bypass: Vulnerable Spectre v1: Mitigation; __user pointer sanitiza tion Spectre v2: Mitigation; Branch predictor harden ing Srbds: Not affected Tsx async abort: Not affected

`$ uname -a Linux localhost 4.14.190-23725627-abG975WVLS8IWD1 #2 SMP PREEMPT Mon Apr 10 18:16:39 KST 2023 aarch64 Android

$ python3 --version
Python 3.11.6

$ make --version
GNU Make 4.4.1
Built for aarch64-unknown-linux-android

$ g++ --version
clang version 17.0.6
Target: aarch64-unknown-linux-android24
Thread model: posix
InstalledDir: /data/data/com.termux/files/usr/bin

Failure Information (for bugs)

cmake -B build
-- The C compiler identification is Clang 17.0.6
-- The CXX compiler identification is Clang 17.0.6
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /data/data/com.termux/files/usr/bin/cc
-- Check for working C compiler: /data/data/com.termux/files/usr/bin/cc - broken
CMake Error at /data/data/com.termux/files/usr/share/cmake-3.27/Modules/CMakeTestCCompiler.cmake:67 (message):
  The C compiler

    "/data/data/com.termux/files/usr/bin/cc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: '/data/data/com.termux/files/home/llamallama/build/CMakeFiles/CMakeScratch/TryCompile-HiIZPq'

    Run Build Command(s): /data/data/com.termux/files/usr/bin/cmake -E env VERBOSE=1 /data/data/com.termux/files/usr/bin/make -f Makefile cmTC_c7a8c/fast
    /data/data/com.termux/files/usr/bin/make  -f CMakeFiles/cmTC_c7a8c.dir/build.make CMakeFiles/cmTC_c7a8c.dir/build
    make[1]: Entering directory '/data/data/com.termux/files/home/llamallama/build/CMakeFiles/CMakeScratch/TryCompile-HiIZPq'
    Building C object CMakeFiles/cmTC_c7a8c.dir/testCCompiler.c.o
    /data/data/com.termux/files/usr/bin/cc   -march=armv7.1a  -O2 -g -DNDEBUG -MD -MT CMakeFiles/cmTC_c7a8c.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_c7a8c.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_c7a8c.dir/testCCompiler.c.o -c /data/data/com.termux/files/home/llamallama/build/CMakeFiles/CMakeScratch/TryCompile-HiIZPq/testCCompiler.c
    cc: error: unsupported argument 'armv7.1a' to option '-march='
    make[1]: *** [CMakeFiles/cmTC_c7a8c.dir/build.make:79: CMakeFiles/cmTC_c7a8c.dir/testCCompiler.c.o] Error 1
    make[1]: Leaving directory '/data/data/com.termux/files/home/llamallama/build/CMakeFiles/CMakeScratch/TryCompile-HiIZPq'
    make: *** [Makefile:127: cmTC_c7a8c/fast] Error 2

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:2 (project)

Steps to Reproduce

  1. In Termux then git clone the repo
  2. cd llama.cpp
  3. cmake -B build
BarfingLemurs commented 9 months ago

This works for me

cd llama.cpp
mkdir build
cd build
cmake ..
cmake --build . --config Release
Jeximo commented 9 months ago

Thanks for your response. It didn't work, so I cleared data/cache & reinstalled cmake which fixed it.