-
Notifications
You must be signed in to change notification settings - Fork 11k
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
cmake : Link vulkan-shaders-gen with pthreads #8835
Conversation
When using CMake to build with Vulkan support, compiling vulkan-shaders-gen fails due to missing a CMakeLists.txt specification to link vulkan-shaders-gen with the threading library, resulting in the following error. [5/172] Linking CXX executable bin/vulkan-shaders-gen FAILED: bin/vulkan-shaders-gen : && /usr/bin/c++ ggml/src/vulkan-shaders/CMakeFiles/vulkan-shaders-gen.dir/vulkan-shaders-gen.cpp.o -o bin/vulkan-shaders-gen && : ld: error: undefined symbol: pthread_create >>> referenced by vulkan-shaders-gen.cpp >>> ggml/src/vulkan-shaders/CMakeFiles/vulkan-shaders-gen.dir/vulkan-shaders-gen.cpp.o:(std::__1::__libcpp_thread_create[abi:se180100](pthread**, >>> void* (*)(void*), void*)) c++: error: linker command failed with exit code 1 (use -v to see invocation) [6/172] Generating build details from Git -- Found Git: /usr/local/bin/git (found version "2.45.2") ninja: build stopped: subcommand failed. Add the CMakeLists.txt specification to link vulkan-shaders-gen with the threading library and fix the above error. Fixes ggml-org#8834
c86f6a9
to
9cdd1df
Compare
Is it a specific OS/distro/compiler setup that causes this? I have been using CMake to build Vulkan without issues on Linux. I'll test this later. Thank you for the submission. |
Yes, this is an issue on FreeBSD with clang. Here's the version which led me to discover the missing dependency:
Other toolchains may include the threading library by default, but the robust thing to do is to be explicit about what we depend on. In this case, |
You're right. Do you know if the same issue exists on FreeBSD with the Makefile? |
The issue does not exist with the Makefile. The Makefile correctly uses $ GGML_VULKAN=1 GGML_CURL=1 gmake -j
...
/usr/local/bin/ccache c++ -std=c++11 -fPIC -O3 -g -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wmissing-declarations -Wmissing-noreturn -pthread -f
openmp -march=native -mtune=native -Wunreachable-code-break -Wunreachable-code-return -Wmissing-prototypes -Wextra-semi -Iggml/include -Iggml/src -Iinclude -Isr
c -Icommon -D_XOPEN_SOURCE=600 -D__BSD_VISIBLE -DNDEBUG -DGGML_USE_OPENMP -DGGML_USE_LLAMAFILE -DGGML_USE_VULKAN -o vulkan-shaders-gen -L/usr/local/lib -lvulkan
ggml/src/vulkan-shaders/vulkan-shaders-gen.cpp
...
/usr/local/bin/ccache c++ -std=c++11 -fPIC -O3 -g -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wmissing-declarations -Wmissing-noreturn -pthread -f
openmp -march=native -mtune=native -Wunreachable-code-break -Wunreachable-code-return -Wmissing-prototypes -Wextra-semi -Iggml/include -Iggml/src -Iinclude -Isr
c -Icommon -D_XOPEN_SOURCE=600 -D__BSD_VISIBLE -DNDEBUG -DGGML_USE_OPENMP -DGGML_USE_LLAMAFILE -DGGML_USE_VULKAN -c common/build-info.cpp -o common/build-info.o
/code/github.com/ggerganov/llama.cpp/vulkan-shaders-gen \
--glslc glslc \
--input-dir ggml/src/vulkan-shaders \
--target-hpp ggml/src/ggml-vulkan-shaders.hpp \
--target-cpp ggml/src/ggml-vulkan-shaders.cpp
ggml_vulkan: Generating and compiling shaders to SPIR-V
... |
Thank you. |
When using CMake to build with Vulkan support, compiling vulkan-shaders-gen fails due to missing a CMakeLists.txt specification to link vulkan-shaders-gen with the threading library, resulting in the following error. [5/172] Linking CXX executable bin/vulkan-shaders-gen FAILED: bin/vulkan-shaders-gen : && /usr/bin/c++ ggml/src/vulkan-shaders/CMakeFiles/vulkan-shaders-gen.dir/vulkan-shaders-gen.cpp.o -o bin/vulkan-shaders-gen && : ld: error: undefined symbol: pthread_create >>> referenced by vulkan-shaders-gen.cpp >>> ggml/src/vulkan-shaders/CMakeFiles/vulkan-shaders-gen.dir/vulkan-shaders-gen.cpp.o:(std::__1::__libcpp_thread_create[abi:se180100](pthread**, >>> void* (*)(void*), void*)) c++: error: linker command failed with exit code 1 (use -v to see invocation) [6/172] Generating build details from Git -- Found Git: /usr/local/bin/git (found version "2.45.2") ninja: build stopped: subcommand failed. Add the CMakeLists.txt specification to link vulkan-shaders-gen with the threading library and fix the above error. Fixes ggml-org#8834
When using CMake to build with Vulkan support, compiling
vulkan-shaders-gen
fails due to missing aCMakeLists.txt
specification to linkvulkan-shaders-gen
with the threading library, resulting in the following error.Add the
CMakeLists.txt
specification to linkvulkan-shaders-gen
with the threading library and fix the above error.Fixes #8834