llama.cpp
llama.cpp copied to clipboard
add ptread link to fix cmake build under linux
Fix the CMake build on Linux to prevent it from failing with an error message.
/usr/bin/ld: libggml.a(ggml.c.o): in function `ggml_graph_compute':
ggml.c:(.text+0x16960): undefined reference to `pthread_create'
/usr/bin/ld: ggml.c:(.text+0x169c3): undefined reference to `pthread_join'
/usr/bin/ld: libggml.a(ggml.c.o): in function `ggml_graph_compute':
ggml.c:(.text+0x16960): undefined reference to `pthread_create'
/usr/bin/ld: ggml.c:(.text+0x169c3): undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/llama.dir/build.make:119: llama] Error 1
make[1]: *** [CMakeFiles/Makefile2:153: CMakeFiles/llama.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/quantize.dir/build.make:119: quantize] Error 1
make[1]: *** [CMakeFiles/Makefile2:126: CMakeFiles/quantize.dir/all] Error 2
make: *** [Makefile:103: all] Error 2
That's a good catch, I think we should also add to the CI the cmake builds of the other OSes...
@mmyjona Want to do what @etra0 suggests here, or we just merge it like this and do it later?
@mmyjona Want to do what @etra0 suggests here, or we just merge it like this and do it later?
Please merge it first, because I saw another major CMake overhaul PR in the queue. I just saw matrix multi-OS build config is commented out in https://github.com/ggerganov/llama.cpp/blob/master/.github/workflows/build.yml, and I don't know the reason behind it.
I personally think that the CMake run and the Make run should be different, as they're totally different build systems thus if cmake fails doesn't means the project won't build at all
i still have this error:
(base) jupyter@cuda-11-0-20230324-133223:~/llama.cpp/build$ cmake --build . --config Release
[ 5%] Built target ggml
[ 16%] Built target llama
[ 22%] Linking CXX executable ../bin/test-quantize
/usr/bin/ld: ../libllama.a(ggml.c.o): in function ggml_graph_compute': ggml.c:(.text+0x19793): undefined reference to
pthread_create'
/usr/bin/ld: ggml.c:(.text+0x1a653): undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
make[2]: *** [tests/CMakeFiles/test-quantize.dir/build.make:85: bin/test-quantize] Error 1
make[1]: *** [CMakeFiles/Makefile2:1064: tests/CMakeFiles/test-quantize.dir/all] Error 2
make: *** [Makefile:95: all] Error 2
@zachary62 relates to #1042