cyrusbehr / tensorrt-cpp-api

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

Unable to build, 'no member getNbBindings' #54

Closed jonbang closed 3 months ago

jonbang commented 3 months ago

I am on arch linux, and cannot build the project. I have tried downgrading to cuda 12.1 but have had no luck. Is it a version issue/linking issue?

CUDA versions:

cuda 12.4.1-1
cuda-tools 12.4.1-1
opencv-cuda 4.9.0-3

TensorRt version: tensorrt-10.0.0.6

Error messages:

[realuser@al build]$ cmake ..
  -- The C compiler identification is GNU 13.2.1
  -- The CXX compiler identification is GNU 13.2.1
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /usr/bin/cc - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: /usr/bin/c++ - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- ccache: not found
  CMake Warning (dev) at /usr/lib/cmake/opencv4/OpenCVConfig.cmake:86 (find_package):
    Policy CMP0146 is not set: The FindCUDA module is removed.  Run "cmake
    --help-policy CMP0146" for policy details.  Use the cmake_policy command to
    set the policy and suppress this warning.

  Call Stack (most recent call first):
    /usr/lib/cmake/opencv4/OpenCVConfig.cmake:108 (find_host_package)
    CMakeLists.txt:17 (find_package)
  This warning is for project developers.  Use -Wno-dev to suppress it.

  -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
  -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
  -- Found Threads: TRUE
  -- Found CUDA: /opt/cuda (found suitable exact version "12.4")
  -- Found OpenCV: /usr (found version "4.9.0")
  -- ccache: not found
  -- Found TensorRT: /home/realuser/YOLOv8-TensorRT-CPP/src/TensorRT-8.6.1.6/lib/libnvinfer.so (found version "..")
  CMake Warning (dev) at libs/tensorrt-cpp-api/CMakeLists.txt:23 (find_package):
    Policy CMP0146 is not set: The FindCUDA module is removed.  Run "cmake
    --help-policy CMP0146" for policy details.  Use the cmake_policy command to
    set the policy and suppress this warning.

  This warning is for project developers.  Use -Wno-dev to suppress it.

  -- Found CUDA: /usr/local/cuda (found version "12.4")
  -- Configuring done (1.1s)
  -- Generating done (0.0s)
  -- Build files have been written to: /home/realuser/YOLOv8-TensorRT-CPP/build
  [realuser@al build]$ cd build
  bash: cd: build: No such file or directory
  [realuser@al build]$ make -j
  [  8%] Building CXX object libs/tensorrt-cpp-api/CMakeFiles/tensorrt_cpp_api.dir/src/engine.cpp.o
  In file included from /home/realuser/YOLOv8-TensorRT-CPP/libs/tensorrt-cpp-api/src/engine.cpp:1:
  /home/realuser/YOLOv8-TensorRT-CPP/libs/tensorrt-cpp-api/src/engine.h: In member function 'void Engine<T>::clearGpuBuffers()':
  /home/realuser/YOLOv8-TensorRT-CPP/libs/tensorrt-cpp-api/src/engine.h:218:75: error: 'class nvinfer1::ICudaEngine' has no member named 'getNbBindings'
    218 |         for (int32_t outputBinding = numInputs; outputBinding < m_engine->getNbBindings(); ++outputBinding) {
        |                                                                           ^~~~~~~~~~~~~
  /home/realuser/YOLOv8-TensorRT-CPP/libs/tensorrt-cpp-api/src/engine.h: In member function 'bool Engine<T>::runInference(const std::vector<std::vector<cv::cuda::GpuMat> >&, std::vector<std::vector<std::vector<_Tp> > >&)':
  /home/realuser/YOLOv8-TensorRT-CPP/libs/tensorrt-cpp-api/src/engine.h:662:75: error: 'class nvinfer1::ICudaEngine' has no member named 'getNbBindings'
    662 |         for (int32_t outputBinding = numInputs; outputBinding < m_engine->getNbBindings(); ++outputBinding) {
        |                                                                           ^~~~~~~~~~~~~
  make[2]: *** [libs/tensorrt-cpp-api/CMakeFiles/tensorrt_cpp_api.dir/build.make:76: libs/tensorrt-cpp-api/CMakeFiles/tensorrt_cpp_api.dir/src/engine.cpp.o] Error 1
  make[1]: *** [CMakeFiles/Makefile2:215: libs/tensorrt-cpp-api/CMakeFiles/tensorrt_cpp_api.dir/all] Error 2
  make: *** [Makefile:91: all] Error 2
cyrusbehr commented 3 months ago

Please see the Readme. As of right now, the project only supports TensorRT 8. I have yet to add support for TensorRT 10, it was only released last week.

cyrusbehr commented 3 months ago

Please see release V6.0 of the project. I've added support for TensorRT 10.0