Undefined reference to createInferBuilder

Hi,

I’m working on an SSD implementation in c++ using TensorRT. I’m working on

Tx2, Jetpack 3.3
Ubuntu 16.04
Cuda 9.0
TensorRT 4.0

The code is the following:

#include
#include “NvInferPlugin.h”
#include “NvInfer.h”

// Create global Logger object, gLogger

class Logger : public nvinfer1::ILogger
{
public:

void log(Severity severity, const char* msg) override
{
    // suppress info messages
    if (severity != Severity::kINFO)
        std::cout << msg << std::endl;
}

Severity reportableSeverity{Severity::kWARNING};

};

static Logger gLogger;

int main(){
nvinfer1::IBuilder* builder;
builder = nvinfer1::createInferBuilder(gLogger);
}

The error is the following

[100%] Linking CXX executable testFile
CMakeFiles/testFile.dir/src/testFile.cpp.o: In function nvinfer1::(anonymous namespace)::createInferBuilder(nvinfer1::ILogger&)': testFile.cpp:(.text+0x14): [b]undefined reference to createInferBuilder_INTERNAL’[/b]
collect2: error: ld returned 1 exit status
CMakeFiles/testFile.dir/build.make:94: recipe for target ‘testFile’ failed
make[2]: *** [testFile] Error 1
CMakeFiles/Makefile2:67: recipe for target ‘CMakeFiles/testFile.dir/all’ failed
make[1]: *** [CMakeFiles/testFile.dir/all] Error 2
Makefile:83: recipe for target ‘all’ failed
make: *** [all] Error 2

I have not encountered a viable solution yet on the forum, did someone manage to fix this?

Kind regards and many thanks,
Umit

Hello,

createInferBuilder_INTERNAL is defined in libnvinfer.so. Double check your link instructions, make sure you are linking the nvinfer libraries.

Maybe drop your code snippet in one of the c++ examples in TRT samples folder and see if it builds. Reference the sample makefile for link examples.

Hi @NVES, I’m running into the same issue.

CUDA 10.0, TensorRT 5, Ubuntu 16.04, GK107GLM [Quadro K1100M] laptop

Trying to write my own example for learning purposes to parse a caffe network, substitute custom plugin layers, etc. but I run into the following issue:

CMakeFiles/main.dir/trtNet.cpp.o: In function nvinfer1::(anonymous namespace)::createInferBuilder(nvinfer1::ILogger&)': trtNet.cpp:(.text+0x19): undefined reference to createInferBuilder_INTERNAL’
CMakeFiles/main.dir/trtNet.cpp.o: In function nvinfer1::(anonymous namespace)::createInferRuntime(nvinfer1::ILogger&)': trtNet.cpp:(.text+0x38): undefined reference to createInferRuntime_INTERNAL’
CMakeFiles/main.dir/trtNet.cpp.o: In function TRTNet::caffeToTRTModel(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, unsigned int)': trtNet.cpp:(.text+0xad): undefined reference to nvcaffeparser1::createCaffeParser()’
trtNet.cpp:(.text+0x349): undefined reference to `nvcaffeparser1::shutdownProtobufLibrary()’
collect2: error: ld returned 1 exit status
CMakeFiles/main.dir/build.make:148: recipe for target ‘main’ failed
make[2]: *** [main] Error 1
CMakeFiles/Makefile2:67: recipe for target ‘CMakeFiles/main.dir/all’ failed
make[1]: *** [CMakeFiles/main.dir/all] Error 2
Makefile:83: recipe for target ‘all’ failed
make: *** [all] Error 2

Could you please direct me as to how I may link all the nvinfer libraries correctly to my development folder located elsewhere?

Thanks

I am also getting this error when I update my makefile based on the .config file in the samples:
/usr/include/cudnn.h:63:26: fatal error: driver_types.h: No such file or directory
compilation terminated.
Makefile:24: recipe for target ‘main.o’ failed
make: *** [main.o] Error 1

I have the cudnn samples running correctly.

To solve the “fatal error: driver_types.h: No such file or directory”, you need to include in your ~/.bashrc like this

export C_INCLUDE_PATH="/usr/local/cuda-10.0/include/:$C_INCLUDE_PATH"
export CPLUS_INCLUDE_PATH="/usr/local/cuda-10.0/include/:$CPLUS_INCLUDE_PATH"

Add these lines at the bottom using gedit ~/.bashrc then source ~/.bashrc

Hi, you can do as follows:
add the libs:
/usr/lib/aarch64-linux-gnu/libnvparsers.so