NVIDIA / NVIDIA/TensorRT

Linux env TRT_LIBPATH in wrong format when building TensorRT 10.6 OSS

Open
#4,251 1 comment 0 reactions 1 assignee View on GitHub

@kevinch-nv is already working on this.

Since Dec 2, 2024.

Module:OSS Build triaged
Dominant language
C++
Stars
13.4k
Forks
2.4k
Avg merge
5d 3h
Merged PRs (30d)
2

Description

Description

when I tried to build TensorRT 10.6 oss, i met the following errors:
========================= Importing and creating target nvinfer ==========================
-- Looking for library nvinfer
-- Library that was found nvinfer_LIB_PATH-NOTFOUND

these errors are related with file of https://github.com/NVIDIA/TensorRT/blob/release/10.6/cmake/modules/find_library_create_target.cmake

macro(find_library_create_target target_name lib libtype hints)
    message(STATUS "========================= Importing and creating target ${target_name} ==========================")
    message(STATUS "Looking for library ${lib}")
    if (CMAKE_BUILD_TYPE STREQUAL "Debug")
        find_library(${lib}_LIB_PATH ${lib}${TRT_DEBUG_POSTFIX} HINTS ${hints} NO_DEFAULT_PATH)
    endif()
    find_library(${lib}_LIB_PATH ${lib} HINTS ${hints} NO_DEFAULT_PATH)
    find_library(${lib}_LIB_PATH ${lib})
    message(STATUS "Library that was found ${${lib}_LIB_PATH}")
    add_library(${target_name} ${libtype} IMPORTED)
    set_property(TARGET ${target_name} PROPERTY IMPORTED_LOCATION ${${lib}_LIB_PATH})
    message(STATUS "==========================================================================================")
endmacro()

they means if fails to find the library of nvinfer in path of hints

after carefully debug, i find hints is the variable of TRT_LIB_DIR, and TRT_LIB_DIR is from the env variable TRT_LIBPATH which is mentioned in read_me:

 cd $TRT_OSSPATH
 mkdir -p build && cd build
 cmake .. -DTRT_LIB_DIR=$TRT_LIBPATH -DTRT_OUT_DIR=`pwd`/out
 make -j$(nproc)

the actual problem is TRT_LIBPATH is the env variable in linux(Ubuntu 24.04 for me), when export TRT_LIBPATH in cmake , TRT_LIB_DIR
will look like :path1:path2:path3. Different paths are separated by ":". But for list type in cmake they should like path1;path2;path3. This bug causes the function of find_library cant find lib we needed.

i fixed the bug by adding

string(SUBSTRING "${TRT_LIB_DIR}" 1 -1 TRT_LIB_DIR_without_colon)
string(REPLACE ":" ";" TRT_LIB_DIR "${TRT_LIB_DIR_without_colon}")

to del first ":" and replace all ":" with ";".

I'm not very familiar with cmake. Is this really a bug, or is there an issue with my installation process? Thank you very much for your help.

if you want to reproduce, remember to del cmake cache in build file

Environment

TensorRT Version: 10.6

NVIDIA GPU:

NVIDIA Driver Version:

CUDA Version: 12.4

CUDNN Version:

Operating System:

Python Version (if applicable):

Tensorflow Version (if applicable):

PyTorch Version (if applicable):

Baremetal or Container (if so, version):

Relevant Files

Model link:

Steps To Reproduce

Commands or scripts:

Have you tried the latest release?:

Can this model run on other frameworks? For example run ONNX model with ONNXRuntime (polygraphy run <model.onnx> --onnxrt):

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.