pgigioli / darknet_ros

YOLO integration with ROS for real-time object detection
50 stars 23 forks source link

cannot find -lopencv_dep_cudart #12

Open ferhatm opened 6 years ago

ferhatm commented 6 years ago

HEY! While I''m trying to compile your code with catkim_make, I'm taking this error :

Scanning dependencies of target single_image_test [ 9%] Linking CXX executable /home/nvidia/ip_ws/devel/lib/darknet_ros/yolo_ros [ 9%] Building CXX object darknet_ros/CMakeFiles/single_image_test.dir/src/single_image_test.cpp.o /usr/bin/ld: cannot find -lopencv_dep_cudart collect2: error: ld returned 1 exit status darknet_ros/CMakeFiles/yolo_ros.dir/build.make:4557: recipe for target '/home/nvidia/ip_ws/devel/lib/darknet_ros/yolo_ros' failed make[2]: [/home/nvidia/ip_ws/devel/lib/darknet_ros/yolo_ros] Error 1 CMakeFiles/Makefile2:1141: recipe for target 'darknet_ros/CMakeFiles/yolo_ros.dir/all' failed make[1]: [darknet_ros/CMakeFiles/yolo_ros.dir/all] Error 2 make[1]: Waiting for unfinished jobs.... /home/nvidia/ip_ws/src/darknet_ros/src/single_image_test.cpp:26:13: warning: deprecated conversion from string constant to ‘char’ [-Wwrite-strings] char cfg = "/home/catkin_ws/src/darknet_ros/cfg/tiny-yolo-voc.cfg"; ^ /home/nvidia/ip_ws/src/darknet_ros/src/single_image_test.cpp:27:17: warning: deprecated conversion from string constant to ‘char’ [-Wwrite-strings] char weights = "/home/catkin_ws/src/darknet_ros/weights/tiny-yolo-voc.weights"; ^ [ 9%] Linking CXX executable /home/nvidia/ip_ws/devel/lib/darknet_ros/single_image_test /usr/bin/ld: cannot find -lopencv_dep_cudart collect2: error: ld returned 1 exit status darknet_ros/CMakeFiles/single_image_test.dir/build.make:2900: recipe for target '/home/nvidia/ip_ws/devel/lib/darknet_ros/single_image_test' failed make[2]: [/home/nvidia/ip_ws/devel/lib/darknet_ros/single_image_test] Error 1 CMakeFiles/Makefile2:1609: recipe for target 'darknet_ros/CMakeFiles/single_image_test.dir/all' failed make[1]: [darknet_ros/CMakeFiles/single_image_test.dir/all] Error 2 Makefile:138: recipe for target 'all' failed make: [all] Error 2 Invoking "make -j4 -l4" failed

Any idea? Thanks

pgigioli commented 6 years ago

Do you have CUDA installed? Unfortunately, I haven't built CPU support yet. What OpenCV version do you have? Make sure its updated to version 3.

If you do have CUDA installed and OpenCV3, try adding set(CUDA_USE_STATIC_CUDA_RUNTIME OFF) to your CMakeLists.txt. This might be related to an issue with your OpenCV version similar to this.

ferhatm commented 6 years ago

Yes, I'm trying with CUDA and my OpenCV version is 3.3.1. Tried everything on the link, the best result is :

[ 65%] Building NVCC (Device) object darknet_ros/CMakeFiles/yolo_ros.dir/darknet/src/yolo_ros_generated_maxpool_layer_kernels.cu.o nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning). nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning). [ 67%] Linking CXX executable /home/nvidia/ip_ws/devel/lib/darknet_ros/yolo_ros CMakeFiles/yolo_ros.dir/src/yolo_ros.cpp.o: In function yoloObjectDetector::~yoloObjectDetector()': /home/nvidia/ip_ws/src/darknet_ros/src/yolo_ros.cpp:89: undefined reference tocv::destroyWindow(cv::String const&)' CMakeFiles/yolo_ros.dir/src/yolo_ros.cpp.o: In function yoloObjectDetector::runYOLO(cv::Mat&)': /home/nvidia/ip_ws/src/darknet_ros/src/yolo_ros.cpp:178: undefined reference tocv::imshow(cv::String const&, cv::_InputArray const&)' CMakeFiles/yolo_ros.dir/src/yolo_ros.cpp.o: In function yoloObjectDetector::yoloObjectDetector()': /home/nvidia/ip_ws/src/darknet_ros/src/yolo_ros.cpp:84: undefined reference tocv::namedWindow(cv::String const&, int)' collect2: error: ld returned 1 exit status darknet_ros/CMakeFiles/yolo_ros.dir/build.make:4557: recipe for target '/home/nvidia/ip_ws/devel/lib/darknet_ros/yolo_ros' failed make[2]: [/home/nvidia/ip_ws/devel/lib/darknet_ros/yolo_ros] Error 1 CMakeFiles/Makefile2:1141: recipe for target 'darknet_ros/CMakeFiles/yolo_ros.dir/all' failed make[1]: [darknet_ros/CMakeFiles/yolo_ros.dir/all] Error 2 Makefile:138: recipe for target 'all' failed make: *** [all] Error 2

while trying this cmake file :

set(CUDA_USE_STATIC_CUDA_RUNTIME OFF) set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}; -O3 -gencode arch=compute_20,code=[sm_20,sm_21] -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=[sm_50,compute_50] -gencode arch=compute_52,code=[sm_52,compute_52] -gencode arch=compute_53,code=sm_53 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_62,code=sm_62

)

-- after typing : sudo ln -s /usr/local/cuda/lib64/libcudart.so /usr/lib/libopencv_dep_cudart.so

Any idea again? Thanks

pgigioli commented 6 years ago

Might be an issue with opencv 3.3.1 similar to this. You may have to update kinetic or fiddle around with your opencv install.

You could try building the docker image as a sanity check. The docker image uses opencv 2.4.

Let me know if you figure it out.