LostRuins / koboldcpp

Run GGUF models easily with a KoboldAI UI. One File. Zero Install.
https://github.com/lostruins/koboldcpp
GNU Affero General Public License v3.0
4.81k stars 343 forks source link

Error compiling with -lcblas #95

Closed h3ndrik closed 1 year ago

h3ndrik commented 1 year ago

After the rewrite of the Makefile (i think in 346cd68), koboldcpp doesn't compile anymore with openblas.

$ make LLAMA_OPENBLAS=1

Error message:

g++ -I. -I./examples -Ofast -DNDEBUG -std=c++11 -fPIC -pthread -s -Wno-multichar -pthread        ggml_openblas.o ggml_rwkv.o ggml_v1.o expose.o common.o llama_adapter.o gpttype_adapter.o -lcblas -lopenblas -shared -o koboldcpp_openblas.so 
/usr/bin/ld: cannot find -lcblas
collect2: error: ld returned 1 exit status
make: *** [Makefile:247: koboldcpp_openblas] Error 1

Removing the -lcblas makes it compile.

I'm running Debian GNU/Linux 11 (bullseye)

I installed both libclblast-dev and libopenblas-dev (and the intel libmkl)

h3ndrik commented 1 year ago

Well. I also installed libatlas-base-dev and now it compiles with that flag. But i don't really know what i'm doing. I only searched for a package that provides a library with that name. ~In case that is a good choice: it could be appended to the Debian instructions in the README.~

horenbergerb commented 1 year ago

I hit the same issue, actually. I'll try installing that lib later and see if it fixes the problem for me as well.

LostRuins commented 1 year ago

@h3ndrik @horenbergerb

Okay so the main issue was that some linux distros seem to need it when they use -lopenblas and some break if they have it. It has to do with libopenblas actually containing different stuff in different distros, specifically arch linux requires -lcblas but that makes the debian build fail apparently.

anyway hopefully all that mess is out of the way. sorry for the troubles. Can you all please try pull the latest and build and see if its works?

Specifically, try run make LLAMA_CLBLAST=1 LLAMA_OPENBLAS=1 and then after that use the appropriate python flags (e.g. --useclblast) to run the desired functionality.

Please let me know if its still broken

h3ndrik commented 1 year ago

Seems to be fine now.

Now successfully compiles with make LLAMA_CLBLAST=1 LLAMA_OPENBLAS=1 I'm not using clblast, though... And I removed my extra atlas package before trying.

I think if this fixes it for everybody, we can close this. Thank you very much!

AllesMeins commented 1 year ago

I seem to have an issue that might be related: When compiling it fails with

g++ -I. -I./examples -I./include -I./include/CL -Ofast -DNDEBUG -std=c++11 -fPIC -pthread -s -Wno-multichar -pthread ggml_clblast.o ggml_rwkv.o ggml_v1.o expose.o common.o gpttype_adapter.o -lclblast -lOpenCL -lcblas -lopenblas -shared -o koboldcpp_clblast.so /usr/bin/ld: cannot find -lclblast: No such file or directory collect2: error: ld returned 1 exit status make: *** [Makefile:267: koboldcpp_clblast] Error 1

I'm running on Manjaro Linux (which is a variety of Arch) and have cblas and openblas packages installed. I gtried to compile the newest koboldcpp version (1.13.1) with "make LLAMA_OPENBLAS=1 LLAMA_CLBLAST=1"

But to be honest: I also somewhat lost track of what all the different blas/blast/cblas/openblas/closedblas/blasblast/blablabla are and do - so I might not be the most reliable witness :-)

LostRuins commented 1 year ago

Someone once mentioned that the clblast library has a different name on certain distros. Can't find the thread now but you can try messing with the name of -lclblast