Skip to content
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

Bug: Failing to build using cmake on tag b3912 #9913

Closed
Martin-HZK opened this issue Oct 16, 2024 · 10 comments
Closed

Bug: Failing to build using cmake on tag b3912 #9913

Martin-HZK opened this issue Oct 16, 2024 · 10 comments
Labels
bug-unconfirmed medium severity Used to report medium severity bugs in llama.cpp (e.g. Malfunctioning Features but still useable) stale

Comments

@Martin-HZK
Copy link

What happened?

I can successfully build llama.cpp using make, but failing to do it using cmake. I tried this on Ubuntu 22.04 LTS and 24.04 LTS on my Intel Core Ultra 9 185H. It seems that is searching the glibc in the wrong path.

Name and Version

$ ./llama-cli --version
version: 3912 (edc2656)
built with cc (conda-forge gcc 14.2.0-1) 14.2.0 for x86_64-conda-linux-gnu

What operating system are you seeing the problem on?

Linux

Relevant log output

$ cmake --build build --config Release -j 22
[  0%] Generating build details from Git
[  1%] Built target sha1
[  1%] Built target sha256
-- Found Git: /usr/bin/git (found version "2.43.0") 
[  2%] Built target xxhash
[  3%] Building C object ggml/src/CMakeFiles/ggml.dir/ggml-alloc.c.o
[  4%] Building CXX object common/CMakeFiles/build_info.dir/build-info.cpp.o
[  4%] Built target build_info
[  5%] Linking CXX shared library libggml.so
/usr/bin/ld: cannot find /lib64/libpthread.so.0: No such file or directory
/usr/bin/ld: cannot find /usr/lib64/libpthread_nonshared.a: No such file or directory
collect2: error: ld returned 1 exit status
gmake[2]: *** [ggml/src/CMakeFiles/ggml.dir/build.make:179: ggml/src/libggml.so] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1591: ggml/src/CMakeFiles/ggml.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
@Martin-HZK Martin-HZK added bug-unconfirmed medium severity Used to report medium severity bugs in llama.cpp (e.g. Malfunctioning Features but still useable) labels Oct 16, 2024
@xiaoran007
Copy link

I had the same problem. In fact make works fine and cmake doesn't.

@JohannesGaessler
Copy link
Collaborator

Are you perhaps just missing packages?

@Martin-HZK
Copy link
Author

Are you perhaps just missing packages?
Actually, the related libc can be found elsewhere, but not in the lib64. I just installed the Ubuntu24.04 by default image. But in terms of the static library, like libpthread_nonshared.a, I didn't really find it in my GLibc 2.35 version for Ubuntu22.04

@rajesh-s
Copy link

rajesh-s commented Nov 8, 2024

Did anyone manage to resolve this? Same problem on RHEL!

@rajesh-s
Copy link

@Martin-HZK where is the glibc found in your case?

@mylovemyfun
Copy link

I met the same question.

source build.sh -clblast -debug          
fatal: 目标路径 'CLBlast' 已经存在,并且不是一个空目录。
CMake Deprecation Warning at CMakeLists.txt:12 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- Building CLBlast with OpenCL API (default)
-- Configuring done (0.0s)
-- Generating done (0.0s)
-- Build files have been written to: /home/xusisheng/repo/llama.cpp/CLBlast/build
[100%] Built target clblast
-- Install configuration: ""
-- Up-to-date: /home/xusisheng/repo/llama.cpp/CLBlast/./CLBlast_DIR/lib/libclblast.a
-- Up-to-date: /home/xusisheng/repo/llama.cpp/CLBlast/./CLBlast_DIR/include/clblast_half.h
-- Up-to-date: /home/xusisheng/repo/llama.cpp/CLBlast/./CLBlast_DIR/include/clblast.h
-- Up-to-date: /home/xusisheng/repo/llama.cpp/CLBlast/./CLBlast_DIR/include/clblast_c.h
-- Up-to-date: /home/xusisheng/repo/llama.cpp/CLBlast/./CLBlast_DIR/lib/cmake/CLBlast/CLBlastConfig.cmake
-- Up-to-date: /home/xusisheng/repo/llama.cpp/CLBlast/./CLBlast_DIR/lib/cmake/CLBlast/CLBlastConfig-noconfig.cmake
-- Up-to-date: /home/xusisheng/repo/llama.cpp/CLBlast/./CLBlast_DIR/lib/pkgconfig/clblast.pc
-- CLBlast found
-- ccache found, compilation results will be cached. Disable with LLAMA_CCACHE=OFF.
-- CMAKE_SYSTEM_PROCESSOR: x86_64
-- x86 detected
-- Configuring done (0.3s)
-- Generating done (0.1s)
-- Build files have been written to: /home/xusisheng/repo/llama.cpp/build
[  4%] Built target ggml
[  4%] Built target ggml_static
[  7%] Built target llama
[  9%] Built target build_info
[ 14%] Built target common
[ 15%] Linking CXX executable ../bin/test-tokenizer-0
/usr/bin/ld: 找不到 /lib64/libpthread.so.0: 没有那个文件或目录
/usr/bin/ld: 找不到 /usr/lib64/libpthread_nonshared.a: 没有那个文件或目录
collect2: error: ld returned 1 exit status
make[2]: *** [tests/CMakeFiles/test-tokenizer-0.dir/build.make:101:bin/test-tokenizer-0] 错误 1
make[1]: *** [CMakeFiles/Makefile2:1683:tests/CMakeFiles/test-tokenizer-0.dir/all] 错误 2
make: *** [Makefile:146:all] 错误 2

@mylovemyfun
Copy link

Problem solved after creating a new conda env

conda deactivate
conda remove --name myenv --all
conda create -n myenv python=3.11
conda activate myenv

@ChienKaiMa
Copy link

ChienKaiMa commented Dec 10, 2024

I created links to make it work. Rebuilding the environment didn't work for me (I was trying to build bitnet-cpp).

sudo ln -s /usr/lib/x86_64-linux-gnu/libpthread.so.0 /lib64/libpthread.so.0
sudo ln -s /usr/lib/x86_64-linux-gnu/libc_nonshared.a /usr/lib64/libpthread_nonshared.a
sudo ln -s /usr/lib/x86_64-linux-gnu/libc_nonshared.a /usr/lib64/libc_nonshared.a
sudo ln -s /usr/lib/x86_64-linux-gnu/libc.so /lib64/libc.so.6

References
https://stackoverflow.com/questions/78217727/error-cannot-find-usr-lib-libc-nonshared-a-when-installing-cmake

@Martin-HZK
Copy link
Author

I created links to make it work. Rebuilding the environment didn't work for me (I was trying to build bitnet-cpp).

sudo ln -s /usr/lib/x86_64-linux-gnu/libpthread.so.0 /lib64/libpthread.so.0
sudo ln -s /usr/lib/x86_64-linux-gnu/libc_nonshared.a /usr/lib64/libpthread_nonshared.a
sudo ln -s /usr/lib/x86_64-linux-gnu/libc_nonshared.a /usr/lib64/libc_nonshared.a
sudo ln -s /usr/lib/x86_64-linux-gnu/libc.so /lib64/libc.so.6

References https://stackoverflow.com/questions/78217727/error-cannot-find-usr-lib-libc-nonshared-a-when-installing-cmake

Maybe it is something to do with the the glib version that is connected with the kernel version

@github-actions github-actions bot added the stale label Jan 11, 2025
Copy link
Contributor

This issue was closed because it has been inactive for 14 days since being marked as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-unconfirmed medium severity Used to report medium severity bugs in llama.cpp (e.g. Malfunctioning Features but still useable) stale
Projects
None yet
Development

No branches or pull requests

6 participants