darknet_ros
darknet_ros copied to clipboard
cannot find -lcuda
I am facing this issue even after trying what was mentioned in #252 and #289
This is what I've done so far.
-
cd catkin_ws/src && git clone --recursive [email protected]:leggedrobotics/darknet_ros.git
-
cd ..
-
catkin build darknet_ros -DCMAKE_BUILD_TYPE=Release
Some other extra information:
- When run
nvidia-smi
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 465.19.01 Driver Version: 465.19.01 CUDA Version: 11.3 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA Quadro P... On | 00000000:01:00.0 On | N/A |
| N/A 37C P3 N/A / N/A | 297MiB / 4036MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
-
Using Ubuntu 18.04 LTS, ROS Melodic with GPU NVIDIA Quadro P1000
-
When I run
ls -l /usr/local/cuda-11.3/lib64/libcuda.so
I already have:lrwxrwxrwx 1 root root 46 Jul 12 15:10 libcuda.so -> /usr/lib/x86_64-linux-gnu/libcuda.so.465.19.01
So doesn't this mean that I have already have a symbolic link to the cuda lib?
The error output is:
Errors << darknet_ros:make /home/dylan/catkin_ws/logs/darknet_ros/build.make.012.log
/home/dylan/catkin_ws/src/darknet_ros/darknet_ros/src/image_interface.cpp: In function ‘image** load_alphabet_with_file(char*)’:
/home/dylan/catkin_ws/src/darknet_ros/darknet_ros/src/image_interface.cpp:20:18: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
char* labels = "/labels/%d_%d.png";
^~~~~~~~~~~~~~~~~~~
/home/dylan/catkin_ws/src/darknet_ros/darknet/src/image_opencv.cpp: In function ‘image load_image_cv(char*, int)’:
/home/dylan/catkin_ws/src/darknet_ros/darknet/src/image_opencv.cpp:89:15: warning: ignoring return value of ‘int system(const char*)’, declared with attribute warn_unused_result [-Wunused-result]
system(buff);
~~~~~~^~~~~~
/usr/bin/ld: cannot find -lcuda
collect2: error: ld returned 1 exit status
make[2]: *** [/home/dylan/catkin_ws/devel/.private/darknet_ros/lib/libdarknet_ros_lib.so] Error 1
make[1]: *** [CMakeFiles/darknet_ros_lib.dir/all] Error 2
make: *** [all] Error 2
Had that same issue while building a catkin env during the build of Docker image (but not when building the project from within the image), using nvidia-container-runtime. If that's your case too, I solved it by adding the library stubs among the directories linked in the darknet_ros CMake like so:
link_directories(
${CUDA_TOOLKIT_ROOT_DIR}/lib64
${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs
)
(line is around 145)
Had that same issue while building a catkin env during the build of Docker image (but not when building the project from within the image), using nvidia-container-runtime. If that's your case too, I solved it by adding the library stubs among the directories linked in the darknet_ros CMake like so:
link_directories( ${CUDA_TOOLKIT_ROOT_DIR}/lib64 ${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs )
(line is around 145)
This works!!