Jetson-inference - linker error (github -dusty-nv)

Having below linker errors, not entirely sure what/which paths need to be added?

g++ -O2 -std=c++17 -I/usr/local/cuda-11.4/include -I/home/^^^/Desktop/jetson-inference/utils -I/home/^^^/Desktop/jetson-inference/utils/cuda goai.cpp -c

g++ -L/usr/local/cuda/lib64 -L/home/^^^/Desktop/jetson-inference/build/aarch64/lib -lcudart -ljetson-inference -ljetson-utils goai.o -o TestExecs

errors
/usr/bin/ld: /home/^^^/Desktop/jetson-inference/build/aarch64/lib/libjetson-inference.so: undefined reference to symbol ‘_ZNK11commandLine6GetIntEPKcib’
/usr/bin/ld: /home/^^^/Desktop/jetson-inference/build/aarch64/lib/libjetson-utils.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

Hi,

Are you building jetson-utils and jetson-inference on the Nano directly?
If yes, could you share the command you run with us?

The DSO missing error usually indicates that the file is compiled with a difference architecture (ex. ARM vs. AMD).

Thanks.

Yes on the Nano (Jetson nano orin)

Building it from source, following the steps provided here
[https://github.com/dusty-nv/jetson-inference/blob/master/docs/building-repo-2.md]

in /usr/local/lib the two static objects are there, post sudo make install
(i’m on the correct setup steps, right?)

i guess it was sudo ldconfig (which probably has went wrong?)

/usr/local/lib:
libjetson-utils.so → libjetson-utils.so
libjetson-inference.so → libjetson-inference.so
/opt/nvidia/vpi2/lib/aarch64-linux-gnu:
libnvvpi.so.2 → libnvvpi.so.2.3.9

/sbin/ldconfig.real: Can’t create temporary cache file /etc/ld.so.cache~: Permission denied

Hi @cedricyangks, not sure how you have CUDA 11.4 on JetPack 4 and if that will work or not, but here is an example CMakeLists project for linking to jetson-inference/jetson-utils externally:

the CMake and Makefile approach works (followed the guide on github), but on my own exploration i can’t get the linker to work.

By analogy, if i can link it with CMake if i set my paths correct in the linker it should work as well?

**g++ -O2 -std=c++17 -I/usr/local/cuda/include -I/home/xxx/Desktop/jetson-inference/build/aarch64/include -I/home/xxx/Desktop/jetson-inference/utils/cuda goai.cpp -c**

**g++ -L/usr/local/lib -L/usr/local/cuda/lib64 -L/home/xxx/Desktop/jetson-inference/build/aarch64/lib -lcudart -ljetson-inference -ljetson-utils goai.o -o TestExecs**

Using jetpack version 5.1.2

:~/Desktop$ apt show nvidia-jetpack
Package: nvidia-jetpack
Version: 5.1.2-b104

If I compile the my-recognition example on JetPack 5.1.2 with that CMakeLists, this is the command-line that gets run with VERBOSE=1 make

/usr/bin/c++   -I/usr/local/cuda-11.4/include -isystem /opt/nvidia/vpi2/include   -o CMakeFiles/my-recognition.dir/my-recognition.cpp.o -c /mnt/NVME/jetson-inference/examples/my-recognition/my-recognition.cpp
[100%] Linking CXX executable my-recognition
/usr/bin/cmake -E cmake_link_script CMakeFiles/my-recognition.dir/link.txt --verbose=1
/usr/bin/c++    -rdynamic CMakeFiles/my-recognition.dir/my-recognition.cpp.o  -o my-recognition   -L/usr/lib/aarch64-linux-gnu/tegra  -Wl,-rpath,/usr/lib/aarch64-linux-gnu/tegra:/usr/local/lib:/usr/local/cuda-11.4/lib64:/opt/nvidia/vpi2/lib/aarch64-linux-gnu /usr/local/cuda-11.4/lib64/libcudart_static.a -lpthread -ldl -lrt /usr/local/lib/libjetson-inference.so /usr/local/lib/libjetson-utils.so /usr/local/cuda-11.4/lib64/libcudart_static.a -lpthread -ldl -lrt -lGL -lGLU -lGLEW -lgstreamer-1.0 -lgstapp-1.0 -lgstpbutils-1.0 -lgstwebrtc-1.0 -lgstsdp-1.0 -lgstrtspserver-1.0 -ljson-glib-1.0 -lsoup-2.4 /usr/local/cuda-11.4/lib64/libnppicc.so -lnvinfer -lnvinfer_plugin -lnvcaffe_parser -lnvonnxparser -lopencv_core -lopencv_calib3d /opt/nvidia/vpi2/lib/aarch64-linux-gnu/libnvvpi.so.2.3.8

Since jetson-inference is installed under /usr/local , I don’t believe you should have to specify additional paths. As in the my-recognition sample though, headers do need to be included like:

#include <jetson-inference/imageNet.h>
#include <jetson-utils/loadImage.h>

tyvm - managed to have it resolved.

g++ -O2 -std=c++17 -I/usr/local/cuda/include -I/home/x3d/Desktop/jetson-inference/build/aarch64/include -I/home/x3d/Desktop/jetson-inference/utils/cuda goai.cpp -c

g++ goai.o -o my-imagnetExe3 -L/usr/lib/aarch64-linux-gnu/tegra -L/usr/local/lib -L/usr/local/cuda-11.4/lib64 -lpthread -ldl -lrt -ljetson-inference -ljetson-utils