Skip to content

add ptread link to fix cmake build under linux #114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 17, 2023

Conversation

mmyjona
Copy link
Contributor

@mmyjona mmyjona commented Mar 14, 2023

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

@etra0
Copy link
Contributor

etra0 commented Mar 14, 2023

That's a good catch, I think we should also add to the CI the cmake builds of the other OSes...

@ggerganov
Copy link
Member

@mmyjona Want to do what @etra0 suggests here, or we just merge it like this and do it later?

@mmyjona
Copy link
Contributor Author

mmyjona commented Mar 16, 2023

@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.

@etra0
Copy link
Contributor

etra0 commented Mar 16, 2023

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

@etra0 etra0 merged commit 6b0df5c into ggml-org:master Mar 17, 2023
@zachary62
Copy link

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

@Green-Sky
Copy link
Collaborator

@zachary62 relates to #1042

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants