Tensorrt: Error on cmake, while building.

Created on 23 Aug 2019  路  8Comments  路  Source: NVIDIA/TensorRT

I was following the steps as that of README.md file.

I've installed all the dependencies.

cmake version 3.15.2
CUDA Version: 10.2
NVIDIA Driver Version: 430.26
cudnn version: 7.5.1
OS: ubuntu 18.04 bionic beaver
TensorRT version: 5.1.5.0

while running the command cmake .. -DTRT_LIB_DIR=$TRT_RELEASE/lib -DTRT_BIN_DIR=pwd/out
i encountered this error:

Building for TensorRT version: 5.1.5.0, library version: 5.1.5
CHECK for CUDA
-- Targeting TRT Platform: x86_64
-- CUDA version set to 10.1
-- cuDNN version set to 7.5
-- Protobuf version set to 3.0.0
-- Using libprotobuf /home/jugs/PycharmProjects/TensorRT/build/third_party.protobuf/lib/libprotobuf.a
-- ========================= Importing and creating target nvinfer ==========================
-- Looking for library nvinfer
-- Library that was found /home/jugs/Downloads/TensorRT-5.1.5.0/lib/libnvinfer.so
-- ==========================================================================================
-- ========================= Importing and creating target nvuffparser ==========================
-- Looking for library nvparsers
-- Library that was found /home/jugs/Downloads/TensorRT-5.1.5.0/lib/libnvparsers.so
-- ==========================================================================================
-- Protobuf proto/trtcaffe.proto -> proto/trtcaffe.pb.cc proto/trtcaffe.pb.h
-- /home/jugs/PycharmProjects/TensorRT/build/parsers/caffe
-- 
-- ******** Summary ********
--   CMake version         : 3.15.2
--   CMake command         : /usr/local/bin/cmake
--   System                : Linux
--   C++ compiler          : /usr/bin/g++
--   C++ compiler version  : 7.4.0
--   CXX flags             : -Wno-deprecated-declarations  -DBUILD_SYSTEM=cmake_oss -Wall -Wnon-virtual-dtor
--   Build type            : Release
--   Compile definitions   : _PROTOBUF_INSTALL_DIR=/home/jugs/PycharmProjects/TensorRT/build/third_party.protobuf;ONNX_NAMESPACE=onnx2trt_onnx
--   CMAKE_PREFIX_PATH     : 
--   CMAKE_INSTALL_PREFIX  : /home/jugs/Downloads/TensorRT-5.1.5.0/lib/..
--   CMAKE_MODULE_PATH     : 
-- 
--   ONNX version          : 1.3.0
--   ONNX NAMESPACE        : onnx2trt_onnx
--   ONNX_BUILD_TESTS      : OFF
--   ONNX_BUILD_BENCHMARKS : OFF
--   ONNX_USE_LITE_PROTO   : OFF
--   ONNXIFI_DUMMY_BACKEND : OFF
-- 
--   Protobuf compiler     : 
--   Protobuf includes     : 
--   Protobuf libraries    : 
--   BUILD_ONNX_PYTHON     : OFF
-- GPU_ARCH is not defined. Generating CUDA code for default SMs.
-- Found TensorRT headers at /home/jugs/PycharmProjects/TensorRT/include
-- Find TensorRT libs at /home/jugs/Downloads/TensorRT-5.1.5.0/lib/libnvinfer.so;/home/jugs/Downloads/TensorRT-5.1.5.0/lib/libnvinfer_plugin.so
-- Adding new sample: sample_char_rnn
--     - Parsers Used: none
--     - InferPlugin Used: OFF
--     - Licensing: opensource
-- Adding new sample: sample_fasterRCNN
--     - Parsers Used: caffe
--     - InferPlugin Used: ON
--     - Licensing: opensource
-- Adding new sample: sample_googlenet
--     - Parsers Used: caffe
--     - InferPlugin Used: OFF
--     - Licensing: opensource
-- Adding new sample: sample_int8
--     - Parsers Used: caffe
--     - InferPlugin Used: ON
--     - Licensing: opensource
-- Adding new sample: sample_int8_api
--     - Parsers Used: onnx
--     - InferPlugin Used: OFF
--     - Licensing: opensource
-- Adding new sample: sample_mlp
--     - Parsers Used: caffe
--     - InferPlugin Used: OFF
--     - Licensing: opensource
-- Adding new sample: sample_mnist
--     - Parsers Used: caffe
--     - InferPlugin Used: OFF
--     - Licensing: opensource
-- Adding new sample: sample_mnist_api
--     - Parsers Used: caffe
--     - InferPlugin Used: OFF
--     - Licensing: opensource
-- Adding new sample: sample_movielens
--     - Parsers Used: uff
--     - InferPlugin Used: OFF
--     - Licensing: opensource
-- Adding new sample: sample_onnx_mnist
--     - Parsers Used: onnx
--     - InferPlugin Used: OFF
--     - Licensing: opensource
-- Adding new sample: sample_plugin
--     - Parsers Used: caffe
--     - InferPlugin Used: ON
--     - Licensing: opensource
-- Adding new sample: sample_ssd
--     - Parsers Used: caffe
--     - InferPlugin Used: ON
--     - Licensing: opensource
-- Adding new sample: sample_uff_mnist
--     - Parsers Used: uff
--     - InferPlugin Used: OFF
--     - Licensing: opensource
-- Adding new sample: sample_uff_ssd
--     - Parsers Used: uff
--     - InferPlugin Used: ON
--     - Licensing: opensource
-- Adding new sample: trtexec
--     - Parsers Used: caffe;uff;onnx
--     - InferPlugin Used: ON
--     - Licensing: opensource
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CUDNN_LIB
    linked by target "sample_char_rnn" in directory /home/jugs/PycharmProjects/TensorRT/samples/opensource/sampleCharRNN
    linked by target "sample_fasterRCNN" in directory /home/jugs/PycharmProjects/TensorRT/samples/opensource/sampleFasterRCNN
    linked by target "sample_googlenet" in directory /home/jugs/PycharmProjects/TensorRT/samples/opensource/sampleGoogleNet
    linked by target "sample_int8" in directory /home/jugs/PycharmProjects/TensorRT/samples/opensource/sampleINT8
    linked by target "sample_int8_api" in directory /home/jugs/PycharmProjects/TensorRT/samples/opensource/sampleINT8API
    linked by target "sample_mlp" in directory /home/jugs/PycharmProjects/TensorRT/samples/opensource/sampleMLP
    linked by target "sample_mnist" in directory /home/jugs/PycharmProjects/TensorRT/samples/opensource/sampleMNIST
    linked by target "sample_mnist_api" in directory /home/jugs/PycharmProjects/TensorRT/samples/opensource/sampleMNISTAPI
    linked by target "sample_movielens" in directory /home/jugs/PycharmProjects/TensorRT/samples/opensource/sampleMovieLens
    linked by target "sample_onnx_mnist" in directory /home/jugs/PycharmProjects/TensorRT/samples/opensource/sampleOnnxMNIST
    linked by target "sample_plugin" in directory /home/jugs/PycharmProjects/TensorRT/samples/opensource/samplePlugin
    linked by target "sample_ssd" in directory /home/jugs/PycharmProjects/TensorRT/samples/opensource/sampleSSD
    linked by target "sample_uff_mnist" in directory /home/jugs/PycharmProjects/TensorRT/samples/opensource/sampleUffMNIST
    linked by target "sample_uff_ssd" in directory /home/jugs/PycharmProjects/TensorRT/samples/opensource/sampleUffSSD
    linked by target "trtexec" in directory /home/jugs/PycharmProjects/TensorRT/samples/opensource/trtexec

-- Configuring incomplete, errors occurred!
See also "/home/jugs/PycharmProjects/TensorRT/build/CMakeFiles/CMakeOutput.log".
See also "/home/jugs/PycharmProjects/TensorRT/build/CMakeFiles/CMakeError.log".

Also, i export the cudnn_path as:
export CUDNN_LIB=/usr/local/cuda/lib64

OSS Build 5.x

Most helpful comment

Okay I found the library and built the repository:

$ cd /
$ sudo find . -name "libcudnn*"
./pdk_files/cudnn/usr/lib/aarch64-linux-gnu/libcudnn.so.7
./pdk_files/cudnn/usr/lib/aarch64-linux-gnu/libcudnn_static_v7.a
./pdk_files/cudnn/usr/lib/aarch64-linux-gnu/libcudnn.so
./pdk_files/cudnn/usr/lib/aarch64-linux-gnu/libcudnn.so.7.6.3
$ cd /workspace/TensorRT/build
$ cmake .. -DTRT_LIB_DIR=$TRT_RELEASE/lib -DTRT_BIN_DIR=`pwd`/out -DCUDNN_LIB=../../../pdk_files/cudnn/usr/lib/aarch64-linux-gnu/libcudnn.so

All 8 comments

Ok, let's take a close look to the error message:
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CUDNN_LIB

CMake tells you to set the variable. But it does NOT tell you to set an ENVIRONMENTAL variable. If it asks you to set such a variable, the error message would indicate that. It would sound something like "Variable ... could not be found. You can either set the environment variable or ....". Believe me, i had that error already.

So what can you do?
I would suggest to set that CUDNN_LIB either by appending it to your cmake command, so it should be something like this:

$ cmake .. -DCUDNN_LIB=/usr/local/cuda/lib64 -DTRT_LIB_DIR=$TRT_RELEASE/lib -DTRT_BIN_DIR=pwd/out

(i am not sure if the variable you need to append is written like "DCUDNN_LIB", but i think you get the idea. I have also another command for you. Take a look at https://github.com/BVLC/caffe/issues/5513 )

or by setting it directly somewhere in your CMake file, as the message recommends.

I have to admit that i did not test it yet.
I hope one of my proposed solutions solves your problem.
Good luck.

Ended up using a docker container.
Closing this issue.

@jageshmaharjan could you please expand on the answer? I am running into the same issue, however I am building within the docker container for cross-compilation.

Thank you,
James

Hi @jamesthesken,

Not sure if it applies but both the 19.12 (TRT 6) and 20.01 (TRT 7.0) TensorRT NGC containers come with a script /opt/TensorRT/install_opensource.sh.

You could probably use/tweak this for your needs.

docker run --gpus all -v `pwd`:/mnt nvcr.io/nvidia/TensorRT:19.12-py3
bash /opt/tensorrt/install_opensource.sh
cp <files> /mnt

You could also try https://github.com/rmccorm4/tensorrt-utils/tree/master/OSS if the shipped script doesn't work for you for some reason.

Thanks @rmccorm4 !! I've been banging my head on the desk for a couple days now. I just want a Docker container that spits out Jetson Nano compatible code for me.

I'll look into what you suggested.

Hopefully this will help as well for building on Jetson: https://github.com/NVIDIA/TensorRT/issues/9#issuecomment-575106079

And for Jetson-specific examples: https://github.com/dusty-nv/jetson-inference

Just curious, what do you need from the OSS repo that doesn't work with the TRT_RELEASE from Jetpack?

Sorry, I meant for cross compiling via Docker images, I've seen examples for cross compiling w/o Docker but it doesn't do for my use-case.

Specifically I'd like to build outside of my Jetson

Okay I found the library and built the repository:

$ cd /
$ sudo find . -name "libcudnn*"
./pdk_files/cudnn/usr/lib/aarch64-linux-gnu/libcudnn.so.7
./pdk_files/cudnn/usr/lib/aarch64-linux-gnu/libcudnn_static_v7.a
./pdk_files/cudnn/usr/lib/aarch64-linux-gnu/libcudnn.so
./pdk_files/cudnn/usr/lib/aarch64-linux-gnu/libcudnn.so.7.6.3
$ cd /workspace/TensorRT/build
$ cmake .. -DTRT_LIB_DIR=$TRT_RELEASE/lib -DTRT_BIN_DIR=`pwd`/out -DCUDNN_LIB=../../../pdk_files/cudnn/usr/lib/aarch64-linux-gnu/libcudnn.so
Was this page helpful?
0 / 5 - 0 ratings

Related issues

prathik-naidu picture prathik-naidu  路  3Comments

stengoes picture stengoes  路  6Comments

dhkim0225 picture dhkim0225  路  4Comments

float123 picture float123  路  6Comments

SyGoing picture SyGoing  路  4Comments