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

NvInferVersion.h - TensorRT-variables not found because of name change #5560

Open
2 of 3 tasks
vollkornholztuer opened this issue Dec 12, 2024 · 3 comments
Open
2 of 3 tasks
Assignees
Labels
component:perception Advanced sensor data processing and environment understanding.

Comments

@vollkornholztuer
Copy link

vollkornholztuer commented Dec 12, 2024

Checklist

  • I've read the contribution guidelines.
  • I've searched other issues and no duplicate issues were found.
  • I'm convinced that this is not my fault but a bug.

Description

The package autoware_tensorrt_common doesn't build, because it expects old #define-variables from NvInferVersion.h. That also may apply to other packages dependent on TensorRT.

Expected behavior

The package builds without any error.

Actual behavior

The package autoware_tensorrt_common doesn't build and returns these errors to the terminal:

--- stderr: autoware_tensorrt_common                                                                                                                                                                    
In file included from /home/dekor-x/autoware/src/universe/autoware.universe/perception/autoware_tensorrt_common/src/tensorrt_common.cpp:15:
/home/dekor-x/autoware/src/universe/autoware.universe/perception/autoware_tensorrt_common/include/autoware/tensorrt_common/tensorrt_common.hpp:118:28: error: operator '>=' has no left operand
  118 | #if TENSORRT_VERSION_MAJOR >= 8
      |                            ^~
/home/dekor-x/autoware/src/universe/autoware.universe/perception/autoware_tensorrt_common/src/tensorrt_common.cpp:509:28: error: operator '>=' has no left operand
  509 | #if TENSORRT_VERSION_MAJOR >= 8
      |                            ^~
/home/dekor-x/autoware/src/universe/autoware.universe/perception/autoware_tensorrt_common/src/tensorrt_common.cpp:528:28: error: operator '<' has no left operand
  528 | #if TENSORRT_VERSION_MAJOR < 8
      |                            ^
/home/dekor-x/autoware/src/universe/autoware.universe/perception/autoware_tensorrt_common/src/tensorrt_common.cpp:536:28: error: operator '<' has no left operand
  536 | #if TENSORRT_VERSION_MAJOR < 8
      |                            ^
/home/dekor-x/autoware/src/universe/autoware.universe/perception/autoware_tensorrt_common/src/tensorrt_common.cpp: In member function ‘bool autoware::tensorrt_common::TrtCommon::buildEngineFromOnnx(const string&, const string&)’:
/home/dekor-x/autoware/src/universe/autoware.universe/perception/autoware_tensorrt_common/src/tensorrt_common.cpp:539:45: error: ‘plan’ was not declared in this scope
  539 |   file.write(reinterpret_cast<const char *>(plan->data()), plan->size());
      |                                             ^~~~
gmake[2]: *** [CMakeFiles/autoware_tensorrt_common.dir/build.make:76: CMakeFiles/autoware_tensorrt_common.dir/src/tensorrt_common.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:137: CMakeFiles/autoware_tensorrt_common.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
---
Failed   <<< autoware_tensorrt_common [21.0s, exited with code 2]

Steps to reproduce

  1. Install TensorRT 8.6 GA from Nvidia (it shoudln't make lots of difference from the installation tutorial, if at all.)
  2. Add the TensorRT-paths to the .bashrc (.so-files)
# TensorRT 8.6.1.6 Paths
export TENSORRT_INCLUDE_DIR=/usr/include
export TENSORRT_LIB_DIR=/usr/lib/x86_64-linux-gnu
  1. Create symbolic links to the .so-files of TensorRT, so cmake can find the files and headers.
  2. Try and build autoware according to the source installation tutorial

If i need to go more into detail, please let me know.

Versions

  • OS: Ubuntu 22.04.5 LTS
  • ROS2: humble
  • Autoware: main-branch (as of 2024.12.12)

Possible causes

TensorRT defines the variables for the version numbers with a different name than Autoware/Cmake expects. Compare the NvInferVersion.h to the error output at Actual Behavior.

NvInferVersion.h:

/*
 * SPDX-FileCopyrightText: Copyright (c) 1993-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
 *
 * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
 * property and proprietary rights in and to this material, related
 * documentation and any modifications thereto. Any use, reproduction,
 * disclosure or distribution of this material and related documentation
 * without an express license agreement from NVIDIA CORPORATION or
 * its affiliates is strictly prohibited.
 */

//!
//! \file NvInferVersion.h
//!
//! Defines the TensorRT version
//!
#ifndef NV_INFER_VERSION_H
#define NV_INFER_VERSION_H

#define NV_TENSORRT_MAJOR 8 //!< TensorRT major version.
#define NV_TENSORRT_MINOR 6 //!< TensorRT minor version.
#define NV_TENSORRT_PATCH 1 //!< TensorRT patch version.
#define NV_TENSORRT_BUILD 6 //!< TensorRT build number.

#define NV_TENSORRT_LWS_MAJOR 0 //!< TensorRT LWS major version.
#define NV_TENSORRT_LWS_MINOR 0 //!< TensorRT LWS minor version.
#define NV_TENSORRT_LWS_PATCH 0 //!< TensorRT LWS patch version.

// This #define is deprecated in TensorRT 8.6 and will be removed in 10.0. Use NV_TENSORRT_MAJOR.
#define NV_TENSORRT_SONAME_MAJOR 8 //!< Shared object library major version number.
// This #define is deprecated in TensorRT 8.6 and will be removed in 10.0. Use NV_TENSORRT_MINOR.
#define NV_TENSORRT_SONAME_MINOR 6 //!< Shared object library minor version number.
// This #define is deprecated in TensorRT 8.6 and will be removed in 10.0. Use NV_TENSORRT_PATCH.
#define NV_TENSORRT_SONAME_PATCH 1 //!< Shared object library patch version number.

#define NV_TENSORRT_RELEASE_TYPE_EARLY_ACCESS 0         //!< An early access release
#define NV_TENSORRT_RELEASE_TYPE_RELEASE_CANDIDATE 1    //!< A release candidate
#define NV_TENSORRT_RELEASE_TYPE_GENERAL_AVAILABILITY 2 //!< A final release

#define NV_TENSORRT_RELEASE_TYPE NV_TENSORRT_RELEASE_TYPE_GENERAL_AVAILABILITY //!< TensorRT release type

#endif // NV_INFER_VERSION_H

Additional context

No response

@amadeuszsz amadeuszsz self-assigned this Dec 12, 2024
@amadeuszsz amadeuszsz added the component:perception Advanced sensor data processing and environment understanding. label Dec 12, 2024
@amadeuszsz
Copy link
Contributor

amadeuszsz commented Dec 12, 2024

Macros are placed somewhere else. Please, remove install & build dirs, use rosdep and build package once again.

@vollkornholztuer
Copy link
Author

vollkornholztuer commented Dec 13, 2024

Am i supposed to change something in my .bashrc or anywhere else? From reading the linked CMakeLists.txt, I think I have to define TENSORRT_ROOT=/usr in my .bashrc, is that correct? - I'm sorry for not knowing better.

As of now, i managed to build it correctly by changing the names of the macros inside the condition-checks, even if it's not the intended way. - I can revert these changes and try to rebuild it, because I'd also rather have the package build from the source code.

@amadeuszsz
Copy link
Contributor

amadeuszsz commented Dec 15, 2024

This is default path where TRT is located. If it's same for you, you don't need to define this environment variable. It seems TENSORRT_INCLUDE_DIR is not set in makefile and I don't know why. Possibly because of your custom environment. You can try one of this:

  1. Install TensorRT via apt CLI sudo apt install libnvinfer8. It is recommended way and it is automatically triggered if you follow our installation instruction (setup-dev-env.sh script).
  2. Use our docker images.
  3. Troubleshoot the source of issue:
  • Create CMakeLists.txt with content:
cmake_minimum_required(VERSION 3.14)
project(trt_test)

find_package(tensorrt_cmake_module REQUIRED)
find_package(TENSORRT)
  • Build it with cmake . --trace-expand &> log.txt
  • Follow the logs and understand the problem. In my case, I can see in line 970 of log
-- Found TensorRT headers at /usr/include/x86_64-linux-gnu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:perception Advanced sensor data processing and environment understanding.
Projects
None yet
Development

No branches or pull requests

2 participants