llama.cpp
llama.cpp copied to clipboard
libopenblas, OpenBlas, cblas.h unavailable to link during make
Hi, I want to compile llama.cpp with blas in termux.
Expected Behavior
Currently, I use make LLAMA_OPENBLAS=1, and it fails to make. I expect it to locate one of the libraries for blas:
libopenblas/stable,now 0.3.23 aarch64 [installed],
or
openblas-static/termux,now 0.3.7 aarch64 [installed].
Alternatively, I also have: $HOME/OpenBLAS-0.3.23
Current Behavior
'make LLAMA_OPENBLAS=1 I llama.cpp build info: I UNAME_S: Linux I UNAME_P: unknown I UNAME_M: aarch64 I CFLAGS: -I. -O3 -DNDEBUG -std=c11 -fPIC -Wall -Wextra -Wpedantic -Wcast-qual -Wdouble-promotion -Wshadow -Wstrict-prototypes -Wpointer-arith -pthread -DGGML_USE_OPENBLAS -I/usr/local/include/openblas -mcpu=native I CXXFLAGS: -I. -I./examples -O3 -DNDEBUG -std=c++11 -fPIC -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wno-multichar -pthread -mcpu=native I LDFLAGS: -lopenblas I CC: clang version 16.0.2 I CXX: clang version 16.0.2
cc -I. -O3 -DNDEBUG -std=c11 -fPIC -Wall -Wextra -Wpedantic -Wcast-qual -Wdouble-promotion -Wshadow -Wstrict-prototypes -Wpointer-arith -pthread -DGGML_USE_OPENBLAS -I/usr/local/include/openblas -mcpu=native -c ggml.c -o ggml.o ggml.c:149:10: fatal error: 'cblas.h' file not found #include <cblas.h> ^~~~~~~~~ 1 error generated. make: *** [Makefile:161: ggml.o] Error 1'
Environment and Context
Please provide detailed information about your computer setup. This is important in case the issue is not reproducible except for under certain specific conditions.
- Physical (or virtual) hardware you are using, e.g. for Linux:
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: - Model: 14 Thread(s) per core: 1 Core(s) per socket: 4 Socket(s): 1 Stepping: 0xd CPU(s) scaling MHz: 100% CPU max MHz: 1785.6000 CPU min MHz: 300.0000 BogoMIPS: 38.40 Flags: fp asimd evtstrm aes pm ull sha1 sha2 crc32 ato mics fphp asimdhp cpuid asimdrdm lrcpc dcpop a simddp Model name: - Model: 14 Thread(s) per core: 1 Core(s) per socket: 2 Socket(s): 2 Stepping: 0xd CPU(s) scaling MHz: 100% CPU max MHz: 2841.6001 CPU min MHz: 710.4000 BogoMIPS: 38.40 Flags: fp asimd evtstrm aes pm ull sha1 sha2 crc32 ato mics fphp asimdhp cpuid asimdrdm lrcpc dcpop a simddp
- Operating System, e.g. for Linux:
Linux localhost 4.14.190-23725627-abG975WVLS8IWA1 #2 SMP PREEMPT Mon Jan 16 15:43:02 KST 2023 aarch64 Android
Steps to Reproduce
- Use termux to move llama.cpp to $HOME
- Cd then cd llama.cpp
- make LLAMA_OPENBLAS =1
You can use cmake for better detection of the OpenBLAS location. If you insist on using make, just modify the Makefile to point it to the right location.
You can use cmake for better detection of the OpenBLAS location. If you insist on using make, just modify the Makefile to point it to the right location.
Thanks for your response. My apologies, I accidentally closed the issue while figuring out how to use github ui.
I compiled with cmake LLAMA_OPENBLAS=1 llama.cpp. It appeared to work, but it doesn't create a main file, so I dunno how to run it to test if blas is working. Please excuse my ignorance!
I edit the MAKEFILE line 104 to 'CFLAGS += -DGGML_USE_OPENBLAS /data/data/com.termux/files/usr/lib/'
Also tried 'CFLAGS += -DGGML_USE_OPENBLAS /data/data/com.termux/files/usr/lib/libopenblas_armv8p-r0.3.7.a'
And 'CFLAGS += -DGGML_USE_OPENBLAS /data/data/com.termux/files/home/OpenBLAS-0.3.23'
But I'm still receiving the same error message during make.
'clang-16: warning: /data/data/com.termux/files/home/OpenBLAS-0.3.23: 'linker' input unused [-Wunused-command-line-argument] ggml.c:149:10: fatal error: 'cblas.h' file not found'
Thanks for any direction.
Hi,
editing the MAKEFILE line 104 to CFLAGS += -DGGML_USE_OPENBLAS -I/data/data/com.termux/files/usr/include/openblas
Allowed me to compile and now BLAS is working as expected. Thanks!