Issue building simple Tensorrt script on Xavier

Hy,

I am new to C++ programming and would really appreciate any tips. I made example of parsing uff model and predicting in tensorrt(not tf-trt) with python. But Xavier doesn’t support python tensorrt API so I need to doce in C++ in order to finish my home project :). I have finished fair amount of time learning c++, but I still don’t understand how to qrite Makefile. I will use openCV and tesnorrt. I tested sample Makefile for openCV(https://gist.github.com/kevinhughes27/5311609), but how do I add tensorrt In this? I get error “undefined reference to `createUffParser()’” for code like

#include "NvInfer.h"
#include "NvUffParser.h"

using namespace nvuffparser; 
using namespace nvinfer1;

int main(){
    auto var = createUffParser();
}

Creating network and builder seems to work fine, but how do I solve this error? I created network and builder with example openCV makefile mentioned above. I also look into(and tried different thing) with flags in makefile like “-I”, “-l”, “-L” but can’t solve this. I really appreciate any help!

EDIT
I also tried to make sense out of Makefile and Makefile.conf of samples(sampleUffMNIST seems to be perfect as it dos the thing I want to do). To me, it seems like it runs script with “g++ -Wall -std=c++11 -I/usr/local/cuda/include -I/usr/local/include -I…/include -I…/common -I/usr/local/cuda/include -I…/…/include -D_REENTRANT -c -o …/…/bin/chobj/sampleUffMNIST.o sampleUffMNIST.cpp” but I can’t include opencv which I need. So any help from this direction is also helpfull.

UPDATE:
This is on Jetson Xavier, Jetpack verision 4.1 with TensorRT 5.0.3.
This is my Makefile(some of it may be unnecessary as I tried may different things).

CC=g++

CFLAGS=-O2 -std=c++0x -I. -I/usr/local/cuda-10.0/include -I/usr/include/aarch64-linux-gnu -I/usr/src/tensorrt/samples/trtexec -I/usr/src/tensorrt/samples/common

LIBDIRS= -L/usr/local/cuda-10.0/lib64 -L/usr/include/aarch64-linux-gnu -L/usr/src/tensorrt/samples/trtexec -L/usr/src/tensorrt/samples/commo
LIBS = -lnvuff_parser -lnvinfer

LDFLAGS=$(LIBDIRS) -lm -lstdc++ $(CVLIBS) -lcuda -lcublas -lcurand -lcudart

test:
	gcc HelloWorld.cpp -o HelloWorld.o $(CFLAGS) $(LDFLAGS)

This is my code:

#include <NvUffParser.h>

int main(int argc, char *argv[]){
    auto var = nvuffparser::createUffParser();
    //nvuffparser::UffInputOrder::kNCHW;// THIS WORKS!!
    return 0;
}

My error:

/tmp/cc4x7k1Z.o: In function `main':
HelloWorld.cpp:(.text.startup+0x8): undefined reference to `nvuffparser::createUffParser()'
collect2: error: ld returned 1 exit status
Makefile:11: recipe for target 'test' failed
make: *** [test] Error 1

I have also looked into “/usr/include/aarch64-linux-gnu/NvUffParser.h” nad other header files which are included in sample, but can’t get to bottom of this. Any ideas?

Also, I can’ find documentation for TensorRT 5.0.3. I can find for newest version, but in archive links to documentations of many past versions are empty, meaning they lead you back to archive page where you started.

did you ever figure this out? i am encountering the same issue…