cyrusbehr / tensorrt-cpp-api

TensorRT C++ API Tutorial
MIT License
543 stars 66 forks source link

Building Can't find OpenCV-CUDA library #37

Closed DaveBGld closed 6 months ago

DaveBGld commented 6 months ago

I am building your code and get errors in linking:


[build] /usr/bin/ld: CMakeFiles/run_inference_benchmark.dir/src/main.cpp.o: in function `main':
[build] /mnt/DATA/MP/Software/Inference/cyrus-tensorrt-cpp-api/src/main.cpp:82: undefined reference to `cv::cuda::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int, cv::cuda::Stream&)'
[build] /usr/bin/ld: libtensorrt_cpp_api.so: undefined reference to `cv::cuda::split(cv::_InputArray const&, std::vector<cv::cuda::GpuMat, std::allocator<cv::cuda::GpuMat> >&, cv::cuda::Stream&)'
[build] /usr/bin/ld: libtensorrt_cpp_api.so: undefined reference to `cv::cuda::divide(cv::_InputArray const&, cv::_InputArray const&, cv::_OutputArray const&, double, int, cv::cuda::Stream&)'
[build] /usr/bin/ld: libtensorrt_cpp_api.so: undefined reference to `cv::cuda::subtract(cv::_InputArray const&, cv::_InputArray const&, cv::_OutputArray const&, cv::_InputArray const&, int, cv::cuda::Stream&)'
[build] /usr/bin/ld: libtensorrt_cpp_api.so: undefined reference to `cv::cuda::resize(cv::_InputArray const&, cv::_OutputArray const&, cv::Size_<int>, double, double, int, cv::cuda::Stream&)'

I made changes to your CMakeLists.txt to adapt to my installation. Attached here

Output of CMAKE Configure:

[main] Configuring project: cyrus-tensorrt-cpp-api 
[proc] Executing command: /usr/bin/cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++ -S/mnt/DATA/MP/Software/Inference/cyrus-tensorrt-cpp-api -B/mnt/DATA/MP/Software/Inference/cyrus-tensorrt-cpp-api/build -G "Unix Makefiles"
[cmake] Not searching for unused variables given on the command line.
[cmake] Cmake Version 3.16.3
[cmake] Cmake directory /mnt/DATA/MP/Software/Inference/cyrus-tensorrt-cpp-api/cmake
[cmake] -- OpenCV libraries OpenCV_LIBS: opencv_calib3d;opencv_core;opencv_dnn;opencv_features2d;opencv_flann;opencv_highgui;opencv_imgcodecs;opencv_imgproc;opencv_ml;opencv_objdetect;opencv_photo;opencv_stitching;opencv_video;opencv_videoio;opencv_aruco;opencv_bgsegm;opencv_bioinspired;opencv_ccalib;opencv_datasets;opencv_dnn_objdetect;opencv_dnn_superres;opencv_dpm;opencv_face;opencv_freetype;opencv_fuzzy;opencv_hdf;opencv_hfs;opencv_img_hash;opencv_line_descriptor;opencv_optflow;opencv_phase_unwrapping;opencv_plot;opencv_quality;opencv_reg;opencv_rgbd;opencv_saliency;opencv_shape;opencv_stereo;opencv_structured_light;opencv_superres;opencv_surface_matching;opencv_text;opencv_tracking;opencv_videostab;opencv_viz;opencv_ximgproc;opencv_xobjdetect;opencv_xphoto
[cmake] -- OpenCV include path OpenCV_INCLUDE_DIRS: /usr/include/opencv4
[cmake] -- OpenCV version: 4.2.0
[cmake] -- Configuring done
[cmake] -- Generating done
[cmake] -- Build files have been written to: /mnt/DATA/MP/Software/Inference/cyrus-tensorrt-cpp-api/build

OpenCV built from code, including cuda:

image

Thanks!

DaveBGld commented 6 months ago

Never mind. Multiple OpenCV Versions... A real mess. Cleaned up and its working...