llama.cpp icon indicating copy to clipboard operation
llama.cpp copied to clipboard

pkg-config: could not find package 'openblas'

Open BingoZZBZZ opened this issue 2 years ago • 4 comments

~/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

BingoZZBZZ avatar Nov 22 '23 05:11 BingoZZBZZ

what is your GPU? Have you tried using cublas? make clean && LLAMA_CUBLAS=1 make

dspasyuk avatar Nov 25 '23 18:11 dspasyuk

Solved: see #4409

enzomich avatar Dec 22 '23 03:12 enzomich

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.

mygulamali avatar Feb 18 '24 09:02 mygulamali

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

enzomich avatar Feb 18 '24 10:02 enzomich

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Apr 03 '24 01:04 github-actions[bot]