Jetson inference on TX2 failed; how to specify location of NvInfer.h?

Hi all,

I have been following the object detection portion of this tutorial: https://github.com/dusty-nv/jetson-inference and have successfully used both the detectnet-console and detectnet-camera scripts in the past.

However, I had to re-flash my Jetson TX2 a few weeks ago and am trying to redo the results. I’m able to run cmake without trouble, but then when I run make I get the following error:

[ 25%] Building CXX object CMakeFiles/jetson-inference.dir/segNet.cpp.o
In file included from /media/nvidia/SSD1TB/home/nvidia/nvidia_digits/jetson-inference/segNet.h:27:0,
                 from /media/nvidia/SSD1TB/home/nvidia/nvidia_digits/jetson-inference/segNet.cpp:23:
/media/nvidia/SSD1TB/home/nvidia/nvidia_digits/jetson-inference/tensorNet.h:27:21: fatal error: NvInfer.h: No such file or directory
 #include "NvInfer.h"
                     ^
compilation terminated.
CMakeFiles/jetson-inference.dir/build.make:125: recipe for target 'CMakeFiles/jetson-inference.dir/segNet.cpp.o' failed
make[2]: *** [CMakeFiles/jetson-inference.dir/segNet.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/jetson-inference.dir/all' failed
make[1]: *** [CMakeFiles/jetson-inference.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

On my Jetson TX2, NvInfer.h and NvCaffeParser.h are both located in this directory:
/media/nvidia/SSD1TB/usr/include/aarch64-linux-gnu/

How can I point the make command to these files so that it will finish compiling successfully?

Hi pineapple_flora, since you have a custom mount path, add this code underneath CMakeLists.txt:58

include_directories(/media/nvidia/SSD1TB/usr/include/aarch64-linux-gnu)

That got further; thanks! After adding the code snippet to CMakeLists.txt, I tried make again and got the following error:

[  2%] Building CXX object CMakeFiles/jetson-inference.dir/util/camera/gstUtility.cpp.o
/media/nvidia/SSD1TB/home/nvidia/nvidia_digits/jetson-inference/util/camera/gstUtility.cpp: In function ‘gboolean gst_message_print(GstBus*, GstMessage*, gpointer)’:
/media/nvidia/SSD1TB/home/nvidia/nvidia_digits/jetson-inference/util/camera/gstUtility.cpp:221:17: warning: ISO C++ forbids converting a string constant to ‘gchar* {aka char*}’ [-Wwrite-strings]
    gchar* txt = "missing gst_tag_list_to_string()";
                 ^
[  2%] Building CXX object CMakeFiles/jetson-inference.dir/util/display/glTexture.cpp.o
[  2%] Building CXX object CMakeFiles/jetson-inference.dir/util/display/glDisplay.cpp.o
[  2%] Linking CXX shared library aarch64/lib/libjetson-inference.so
/usr/bin/ld: cannot find -lnvcaffe_parser
/usr/bin/ld: cannot find -lnvinfer
collect2: error: ld returned 1 exit status
CMakeFiles/jetson-inference.dir/build.make:1687: recipe for target 'aarch64/lib/libjetson-inference.so' failed
make[2]: *** [aarch64/lib/libjetson-inference.so] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/jetson-inference.dir/all' failed
make[1]: *** [CMakeFiles/jetson-inference.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

Both libnvcaffe_parser.so.3 and libnvinfer.so.3 are in /media/nvidia/SSD1TB/usr/lib/aarch64-linux-gnu, so I tried also adding

include_directories(/media/nvidia/SSD1TB/usr/lib/aarch64-linux-gnu)

to CMakeLists.txt, but it didn’t seem to help?

Hi,

Try add this:

<b>link</b>_directories(/media/nvidia/SSD1TB/usr/lib/aarch64-linux-gnu)

Thanks.

That worked for me! The “make” command finished after implementing the suggestion above. Thank you both!

Can you give more details on the solution? I ran into the same problem.

Hi uersoy,

Please open a new topic for your issue. Thanks