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

Cannot compile with openblas on Windows

Open dillfrescott opened this issue 1 year ago • 12 comments

C:/Users/cross/Downloads/w64devkit/bin/ld.exe: ggml.o:ggml.c:(.text+0x1a892): undefined reference to `cblas_sgemm'
C:/Users/cross/Downloads/w64devkit/bin/ld.exe: ggml.o:ggml.c:(.text+0x2189c): undefined reference to `cblas_sgemm'
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:596: main] Error 1

dillfrescott avatar Dec 11 '23 14:12 dillfrescott

Experiencing the exact same error under Ubuntu

alain40 avatar Dec 20 '23 16:12 alain40

I solved it changing in the Makefile the line: MK_LDFLAGS += $(shell pkg-config --libs openblas) to: MK_LDFLAGS += -lopenblas -L/usr/local/lib

I guess that the original Makefile assumes that OpenBLAS has been installed as a package, whereas the instructions tell how to stuff manually the library and the headers in the respective directories of w64devkit: so, pkg-config doesn't know where to find the library.

enzomich avatar Dec 22 '23 02:12 enzomich

I solved it changing in the Makefile the line: MK_LDFLAGS += $(shell pkg-config --libs openblas) to: MK_LDFLAGS += -lopenblas -L/usr/local/lib

I guess that the original Makefile assumes that OpenBLAS has been installed as a package, whereas the instructions tell how to stuff manually the library and the headers in the respective directories of w64devkit: so, pkg-config doesn't know where to find the library.

how to change the path in win?

dh12306 avatar Jan 02 '24 08:01 dh12306

@dh12306 I just changed it that way in Windows: the translation to the corresponding Windows path is done by the w64devkit. In fact, I think that on UNIX-like platforms that change isn't necessary because OpenBLAS is installed as a package, and pkg-config correctly returns the library path.

enzomich avatar Jan 02 '24 09:01 enzomich

This is not working for me on Windows 11, using w64devkit.

image

I ran 'make clean' directly before this.

bubbabug avatar Jan 08 '24 23:01 bubbabug

It can't find a header. Have you copied the OpenBlas include headers to the folder in w64devkit as specified in Georgi's instructions at https://github.com/ggerganov/llama.cpp?tab=readme-ov-file#openblas ?

e. From the same OpenBLAS zip copy the content of the include folder inside w64devkit\x86_64-w64-mingw32\include.

enzomich avatar Jan 09 '24 04:01 enzomich

I did, but I'll run through it one more time to be sure.

bubbabug avatar Jan 09 '24 20:01 bubbabug

I did get it working, however there was no impact on processing speed for the multimodal model I am using. Thank you for your help!

bubbabug avatar Jan 09 '24 21:01 bubbabug

I did get it working, however there was no impact on processing speed for the multimodal model I am using. Thank you for your help!

What did you do to get it to work? I'm having the exact same issue.

LakeYin avatar Feb 10 '24 22:02 LakeYin

https://github.com/ggerganov/llama.cpp/issues/4409#issuecomment-1867161895 @dh12306 For example for win:“-L/usr/local/lib” change to "-LC:\your w64devkit path\x86_64-w64-mingw32\lib". I tried it on Windows 11.It can solve the problem.

ZB052-A avatar Feb 14 '24 11:02 ZB052-A

I solved it changing in the Makefile the line: MK_LDFLAGS += $(shell pkg-config --libs openblas) to: MK_LDFLAGS += -lopenblas -L/usr/local/lib

I guess that the original Makefile assumes that OpenBLAS has been installed as a package, whereas the instructions tell how to stuff manually the library and the headers in the respective directories of w64devkit: so, pkg-config doesn't know where to find the library.

I'm writing to let u know I just followed your advise and it finally SUCCESSED on my win10 platform. Sinserely Appreciation!

GraysonWang0347ce avatar Feb 16 '24 12:02 GraysonWang0347ce

I solved it changing in the Makefile the line: MK_LDFLAGS += $(shell pkg-config --libs openblas) to: MK_LDFLAGS += -lopenblas -L/usr/local/lib I guess that the original Makefile assumes that OpenBLAS has been installed as a package, whereas the instructions tell how to stuff manually the library and the headers in the respective directories of w64devkit: so, pkg-config doesn't know where to find the library.

I'm writing to let u know I just followed your advise and it finally SUCCESSED on my win10 platform. Sinserely Appreciation!

Thank you!

enzomich avatar Feb 16 '24 13:02 enzomich

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Mar 18 '24 01:03 github-actions[bot]

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]

still an issue. (not stale)

micsthepick avatar Jul 01 '24 03:07 micsthepick