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

Can't find path of CUDA, Msgpack, LibUUID and Jansson #44

Open
zyh4482 opened this issue Aug 23, 2024 · 1 comment
Open

Can't find path of CUDA, Msgpack, LibUUID and Jansson #44

zyh4482 opened this issue Aug 23, 2024 · 1 comment

Comments

@zyh4482
Copy link

zyh4482 commented Aug 23, 2024

Following is my environment setting.

System: Ubuntu 20.04

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Wed_Apr_17_19:19:55_PDT_2024
Cuda compilation tools, release 12.5, V12.5.40
Build cuda_12.5.r12.5/compiler.34177558_0

cmake version 3.16.3

I've successfully installed required packages and libraries as previously mentioned here: #31

The msgpack and jansson libraries and headers can be found under /usr/include and /usr/lib/x86_64-linux-gnu

But I met the first problem as shown below:

cmake .

-- The C compiler identification is GNU 13.3.0
-- The CXX compiler identification is GNU 13.3.0
-- Check for working C compiler: /home/zyh/software/miniforge3/bin/cc
-- Check for working C compiler: /home/zyh/software/miniforge3/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /home/zyh/software/miniforge3/bin/c++
-- Check for working CXX compiler: /home/zyh/software/miniforge3/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- MsgPack was not found. Make sure MSGPACK_LIBRARY and MSGPACK_INCLUDE_DIR are set.
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Could NOT find LibJansson (missing: JANSSON_LIBRARY) 
-- Could NOT find LibUUID (missing: UUID_LIBRARY) 
-- Found OpenMP_C: -fopenmp (found version "4.5") 
-- Found OpenMP_CXX: -fopenmp (found version "4.5") 
-- Found OpenMP: TRUE (found version "4.5")  
-- Looking for a CUDA compiler
-- Looking for a CUDA compiler - NOTFOUND
-- The CUDA compiler identification is unknown
CMake Error at CMakeLists.txt:115 (enable_language):
  No CMAKE_CUDA_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable "CUDACXX" or the CMake cache entry CMAKE_CUDA_COMPILER to the full
  path to the compiler, or to the compiler name if it is in the PATH.


-- Configuring incomplete, errors occurred!

The first problem is quite strange. I have set permanent environment variable for nvcc. But it cannot detect the correct compiler path. Neither did soft symlinks using sudo ln -s play the magic.

Therefore, I manually set the required variables myself as below:

cmake -D CMAKE_CUDA_COMPILER=/usr/local/cuda-12.5/bin/nvcc \
-D CURSES_CURSES_LIBRARY=/usr/lib/x86_64-linux-gnu/libncurses.so \
-D UUID_LIBRARY=/usr/lib/x86_64-linux-gnu/libuuid.so \
-D CURSES_NCURSES_LIBRARY=/usr/lib/x86_64-linux-gnu/libncurses.so \
-D JANSSON_LIBRARY=/usr/lib/x86_64-linux-gnu/libjansson.so \
-D MSGPACK_LIBRARY=/usr/lib/x86_64-linux-gnu/libmsgpackc.so \
-D CURSES_INCLUDE_PATH=/usr/include \
-D JANSSON_INCLUDE_DIR=/usr/include \
-D MSGPACK_INCLUDE_DIR=/usr/include \
-D OpenMP_pthread_LIBRARY=/usr/lib/x86_64-linux-gnu/libpthread.so \
-D OpenMP_gomp_LIBRARY=/usr/lib/x86_64-linux-gnu/libgomp.so \
-D CUDA_rt_LIBRARY=/usr/lib/x86_64-linux-gnu/librt.so .

Then, I restart the git clone step and execute cmake commands. The cmake seems to complete:

-- The C compiler identification is GNU 13.3.0
-- The CXX compiler identification is GNU 13.3.0
-- Check for working C compiler: /home/zyh/software/miniforge3/bin/cc
-- Check for working C compiler: /home/zyh/software/miniforge3/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /home/zyh/software/miniforge3/bin/c++
-- Check for working CXX compiler: /home/zyh/software/miniforge3/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found these msgpack libs: /usr/lib/x86_64-linux-gnu/libmsgpackc.so
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Found LibJansson: /usr/lib/x86_64-linux-gnu/libjansson.so  
-- Found LibUUID: /usr/lib/x86_64-linux-gnu/libuuid.so  
-- Found OpenMP_C: -fopenmp (found version "4.5") 
-- Found OpenMP_CXX: -fopenmp (found version "4.5") 
-- Found OpenMP: TRUE (found version "4.5")  
-- The CUDA compiler identification is NVIDIA 12.5.40
-- Check for working CUDA compiler: /usr/local/cuda-12.5/bin/nvcc
-- Check for working CUDA compiler: /usr/local/cuda-12.5/bin/nvcc -- works
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Found Curses: /usr/lib/x86_64-linux-gnu/libncurses.so  
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
CMake Deprecation Warning at lib/libconjugrad/CMakeLists.txt:11 (cmake_policy):
  The OLD behavior for policy CMP0022 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


-- Found CUDA: /usr/local/cuda-12.5 (found version "12.5") 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/zyh/software/IDR_predictor/CCMpred

But I met the second problem when doing make:

Scanning dependencies of target conjugrad
[  5%] Building C object lib/libconjugrad/CMakeFiles/conjugrad.dir/src/conjugrad.c.o
[ 10%] Building C object lib/libconjugrad/CMakeFiles/conjugrad.dir/src/debug.c.o
[ 15%] Building C object lib/libconjugrad/CMakeFiles/conjugrad.dir/src/arithmetic_ansi.c.o
[ 21%] Building C object lib/libconjugrad/CMakeFiles/conjugrad.dir/src/conjugrad_cuda.c.o
[ 26%] Building CUDA object lib/libconjugrad/CMakeFiles/conjugrad.dir/src/conjugrad_kernels.cu.o
[ 31%] Linking CUDA static library libconjugrad.a
[ 31%] Built target conjugrad
Scanning dependencies of target ccmpred
[ 36%] Building C object CMakeFiles/ccmpred.dir/src/ccmpred.c.o
In file included from /home/zyh/software/IDR_predictor/CCMpred/src/ccmpred.c:17:
/home/zyh/software/IDR_predictor/CCMpred/include/meta.h:2:10: fatal error: jansson.h: No such file or directory
    2 | #include "jansson.h"
      |          ^~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/ccmpred.dir/build.make:63: CMakeFiles/ccmpred.dir/src/ccmpred.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:99: CMakeFiles/ccmpred.dir/all] Error 2
make: *** [Makefile:152: all] Error 2

I don't understand why the compiler keeps unaware of the right directories for CUDA, Jansson, Msgpack etc... After passing the right directory, it still cannot recognize the path.

The following is part of my .bashrc:

export PATH=/usr/local/cuda-12.5/bin:$PATH
export CPATH=/usr/local/cuda-12.5/targets/x86_64-linux/include:$CPATH
export LD_LIBRARY_PATH=/usr/local/cuda-12.5/targets/x86_64-linux/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/local/cuda-12.5/lib64:$LD_LIBRARY_PATH
export CUDACXX=$CUDACXX:/usr/local/cuda-12.5

I made many tests but still get this error. Would you mind helping me with this issue?

Thank you very much!

@zyh4482
Copy link
Author

zyh4482 commented Aug 23, 2024

The reason I set -D CUDA_rt_LIBRARY=/usr/lib/x86_64-linux-gnu/librt.so is because cmake does not recognize the librt for me either.

I did a small test for cuda following @daidedou under this issue

It reports similar error message:

-- The C compiler identification is GNU 13.3.0
-- The CXX compiler identification is GNU 13.3.0
-- Check for working C compiler: /home/zyh/software/miniforge3/bin/cc
-- Check for working C compiler: /home/zyh/software/miniforge3/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /home/zyh/software/miniforge3/bin/c++
-- Check for working CXX compiler: /home/zyh/software/miniforge3/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
CMake Warning at /usr/share/cmake-3.16/Modules/FindCUDA.cmake:900 (message):
  Expecting to find librt for libcudart_static, but didn't find it.
Call Stack (most recent call first):
  CMakeLists.txt:5 (find_package)


CMake Error at CMakeLists.txt:10 (MESSAGE):
  CUDA_PATH Environment variable is not set.

It seems my cuda path is not set correctly. But after many rounds of tests, I still don't know why the error occurs. The environment variables should have been set as required...

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

No branches or pull requests

1 participant