Onnx-tensorrt: NvOnnxParser.h:26:21: fatal error: NvInfer.h: No such file or directory compilation terminated.

Created on 29 Sep 2018  Â·  8Comments  Â·  Source: onnx/onnx-tensorrt

wang@ian:~/Downloads/onnx-tensorrt$ python setup.py build
running build
running build_py
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/onnx_tensorrt
copying onnx_tensorrt/__init__.py -> build/lib.linux-x86_64-2.7/onnx_tensorrt
copying onnx_tensorrt/tensorrt_engine.py -> build/lib.linux-x86_64-2.7/onnx_tensorrt
copying onnx_tensorrt/backend.py -> build/lib.linux-x86_64-2.7/onnx_tensorrt
creating build/lib.linux-x86_64-2.7/onnx_tensorrt/parser
copying onnx_tensorrt/parser/__init__.py -> build/lib.linux-x86_64-2.7/onnx_tensorrt/parser
creating build/lib.linux-x86_64-2.7/onnx_tensorrt/runtime
copying onnx_tensorrt/runtime/__init__.py -> build/lib.linux-x86_64-2.7/onnx_tensorrt/runtime
running build_ext
building 'onnx_tensorrt.parser._nv_onnx_parser_bindings' extension
swigging nv_onnx_parser_bindings.i to nv_onnx_parser_bindings_wrap.cpp
swig -python -c++ -modern -builtin -o nv_onnx_parser_bindings_wrap.cpp nv_onnx_parser_bindings.i
creating build/temp.linux-x86_64-2.7
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c nv_onnx_parser_bindings_wrap.cpp -o build/temp.linux-x86_64-2.7/nv_onnx_parser_bindings_wrap.o -std=c++11 -DUNIX -D__UNIX -m64 -fPIC -O2 -w -fmessage-length=0 -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -DNDEBUG -g -fwrapv -Wall -DSWIG
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from nv_onnx_parser_bindings_wrap.cpp:3580:0:
NvOnnxParser.h:26:21: fatal error: NvInfer.h: No such file or directory
compilation terminated.

Most helpful comment

Could you try

TENSORRT_ROOT=/home/wang/Downloads/TensorRT-4.0.1.6 python setup.py build

All 8 comments

@wangzilu Hi, where did you install your TensorRT lib?

@yinghai Hi, thank you for your replying. TensorRT lib is in /home/wang/Downloads/TensorRT-4.0.1.6/lib

where wang is my user name. Could you give some help please.

Could you try

TENSORRT_ROOT=/home/wang/Downloads/TensorRT-4.0.1.6 python setup.py build

@yinghai I had the same problem and tried TENSORRT_ROOT= ... python setup.py build,
It still fails with "NnInfer.h: No such file or directoty" error

@yinghai Hi,Sorry for bothering again, I would like to try install tensorrt by debian. and which TENSORRT_ROOT should be by this way?

Could you find where your NvInfer.h file is located? It should be in the include directory of the tensorrt lib you downloaded. For example, if it's /opt/tensorrt/include, you can use

INC_DIRS = ["/opt/tensorrt/include"]

in https://github.com/onnx/onnx-tensorrt/blob/master/setup.py#L25

Could you find where your NvInfer.h file is located? It should be in the include directory of the tensorrt lib you downloaded. For example, if it's /opt/tensorrt/include, you can use

INC_DIRS = ["-L/opt/tensorrt/include"]

in https://github.com/onnx/onnx-tensorrt/blob/master/setup.py#L25

Thanks, I added

INC_DIRS = ["MY/PATH/TO/tensorrt/include"]

This works! I think "-L" is not needed.

@xperzy Ah, right! Great that it works for you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cloudrivers picture cloudrivers  Â·  6Comments

RizhaoCai picture RizhaoCai  Â·  7Comments

qigtang picture qigtang  Â·  8Comments

andrew-yang0722 picture andrew-yang0722  Â·  3Comments

zhanghongruiupup picture zhanghongruiupup  Â·  8Comments