pkg-config: could not find package 'openblas'
~/Desktop/llamacppBLAS/llama.cpp-master # make LLAMA_OPENBLAS=1 pkg-config: could not find package 'openblas' pkg-config: could not find package 'openblas' pkg-config: could not find package 'openblas' pkg-config: could not find package 'openblas' I llama.cpp build info: I UNAME_S: Windows_NT I UNAME_P: unknown I UNAME_M: x86_64 I CFLAGS: -I. -Icommon -D_XOPEN_SOURCE=600 -DNDEBUG -DGGML_USE_OPENBLAS -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 -Wdouble-promotion -march=native -mtune=native -Xassembler -muse-unaligned-vector-move I CXXFLAGS: -I. -Icommon -D_XOPEN_SOURCE=600 -DNDEBUG -DGGML_USE_OPENBLAS -std=c++11 -fPIC -O3 -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wmissing-declarations -Wmissing-noreturn -Xassembler -muse-unaligned-vector-move -Wno-array-bounds -Wno-format-truncation -Wextra-semi -march=native -mtune=native I NVCCFLAGS: -I. -Icommon -D_XOPEN_SOURCE=600 -DNDEBUG -DGGML_USE_OPENBLAS -std=c++11 -fPIC -O3 -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wmissing-declarations -Wmissing-noreturn -Xassembler -muse-unaligned-vector-move -Wno-pedantic -Xcompiler "-Wno-array-bounds -Wno-format-truncation -Wextra-semi -march=native -mtune=native " I LDFLAGS: I CC: cc (GCC) 13.2.0 I CXX: g++ (GCC) 13.2.0
g++ -I. -Icommon -D_XOPEN_SOURCE=600 -DNDEBUG -DGGML_USE_OPENBLAS -std=c++11 -fPIC -O3 -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wmissing-declarations -Wmissing-noreturn -Xassembler -muse-unaligned-vector-move -Wno-array-bounds -Wno-format-truncation -Wextra-semi -march=native -mtune=native examples/main/main.cpp ggml.o llama.o common.o sampling.o grammar-parser.o build-info.o console.o ggml-alloc.o ggml-backend.o ggml-quants.o -o main
C:/Users/admin/Desktop/llamacppBLAS/w64devkit-fortran-1.20.0/w64devkit/bin/ld.exe: ggml.o:ggml.c:(.text+0x181b8): undefined reference to cblas_sgemm' C:/Users/admin/Desktop/llamacppBLAS/w64devkit-fortran-1.20.0/w64devkit/bin/ld.exe: ggml.o:ggml.c:(.text+0x1ea04): undefined reference to cblas_sgemm'
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:586: main] Error 1
what is your GPU? Have you tried using cublas? make clean && LLAMA_CUBLAS=1 make
Solved: see #4409
As an alternative to the solution suggested in #4409, I was able to build this project by doing the following.
Firstly, create a pkg-config file for OpenBLAS, named openblas.pc. For example,
prefix=
exec_prefix=
libdir=/usr/lib64
includedir=/usr/include/openblas
Name: OpenBLAS
Description: OpenBLAS libraries
Version: 0.3.21
Libs: -L${libdir} -lopenblas -lpthread -lgfortran
Cflags: -I${includedir}
Be sure to change the libdir and includedir variables in that file to point to your installation of the OpenBLAS libraries and include files, respectively.
Then, during the build, point the PKG_CONFIG_PATH environment variable to the directory containing openblas.pc. For example, if that file is in the current directory,
make LLAMA_OPENBLAS=1 PKG_CONFIG_PATH=.
The advantage of this method is that you don't modify the project. So it should still work if the Makefile is updated in a future commit.
That's the most sensible solution: maybe @ggerganov should mention it in the README file at https://github.com/ggerganov/llama.cpp?tab=readme-ov-file#openblas
This issue was closed because it has been inactive for 14 days since being marked as stale.