Unable to make jetson-inference on Ubuntu 18.04 host

Hi,

I had install JetPack 4.2 and TensorRT 5.1.5, as well as cuDNN 7.6.1 on Ubuntu 18.04 host. I followed the instruction of building the project from source from https://github.com/dusty-nv/jetson-inference/blob/master/docs/building-repo-2.md and completed the step of cmake …/. Now, when I run the next step of make command, error is shown as below:

nvidia@nvidia-host:~/jetson-inference/build$ make
[ 1%] Linking CXX shared library …/x86_64/lib/libjetson-utils.so
/usr/bin/ld: cannot find -lGL
collect2: error: ld returned 1 exit status
utils/CMakeFiles/jetson-utils.dir/build.make:2627: recipe for target ‘x86_64/lib/libjetson-utils.so’ failed
make[2]: *** [x86_64/lib/libjetson-utils.so] Error 1
CMakeFiles/Makefile2:927: recipe for target ‘utils/CMakeFiles/jetson-utils.dir/all’ failed
make[1]: *** [utils/CMakeFiles/jetson-utils.dir/all] Error 2
Makefile:129: recipe for target ‘all’ failed
make: *** [all] Error 2

I check libGl using command ‘dpkg -l | grep libgl’ and results are shown as below:

nvidia@nvidia-host:~/jetson-inference/build$ dpkg -l | grep ‘libgl’
ii libgl1:amd64 1.0.0-2ubuntu2.3 amd64 Vendor neutral GL dispatch library – legacy GL support
ii libgl1-mesa-dev:amd64 19.0.2-1ubuntu1.1~18.04.1 amd64 free implementation of the OpenGL API – GLX development files
ii libgl1-mesa-dri:amd64 19.0.2-1ubuntu1.1~18.04.1 amd64 free implementation of the OpenGL API – DRI modules
rc libgl1-mesa-dri:i386 18.2.8-0ubuntu0~18.04.2 i386 free implementation of the OpenGL API – DRI modules
ii libgl1-mesa-glx:amd64 19.0.2-1ubuntu1.1~18.04.1 amd64 transitional dummy package
ii libgl2ps1.4 1.4.0+dfsg1-1 amd64 Lib providing high quality vector output for OpenGL application
ii libglapi-mesa:amd64 19.0.2-1ubuntu1.1~18.04.1 amd64 free implementation of the GL API – shared library
ii libgles1:amd64 1.0.0-2ubuntu2.3 amd64 Vendor neutral GL dispatch library – GLESv1 support
ii libgles2:amd64 1.0.0-2ubuntu2.3 amd64 Vendor neutral GL dispatch library – GLESv2 support
ii libgles2-mesa-dev:amd64 19.0.2-1ubuntu1.1~18.04.1 amd64 free implementation of the OpenGL|ES 2.x API – development files
ii libglew-dev:amd64 2.0.0-5 amd64 OpenGL Extension Wrangler - development environment
ii libglew2.0:amd64 2.0.0-5 amd64 OpenGL Extension Wrangler - runtime environment
ii libglib-object-introspection-perl 0.044-2 amd64 Perl bindings for gobject-introspection libraries
ii libglib-perl 3:1.326-1build1 amd64 interface to the GLib and GObject libraries
ii libglib2.0-0:amd64 2.56.4-0ubuntu0.18.04.4 amd64 GLib library of C routines
ii libglib2.0-bin 2.56.4-0ubuntu0.18.04.4 amd64 Programs for the GLib library
ii libglib2.0-data 2.56.4-0ubuntu0.18.04.4 all Common files for GLib library
ii libglib2.0-dev:amd64 2.56.4-0ubuntu0.18.04.4 amd64 Development files for the GLib library
ii libglib2.0-dev-bin 2.56.4-0ubuntu0.18.04.4 amd64 Development utilities for the GLib library
ii libglu1-mesa:amd64 9.0.0-2.1build1 amd64 Mesa OpenGL utility library (GLU)
ii libglu1-mesa-dev:amd64 9.0.0-2.1build1 amd64 Mesa OpenGL utility library – development files
ii libglvnd-core-dev:amd64 1.0.0-2ubuntu2.3 amd64 Vendor neutral GL dispatch library – core development files
ii libglvnd-dev:amd64 1.0.0-2ubuntu2.3 amd64 Vendor neutral GL dispatch library – development files
ii libglvnd0:amd64 1.0.0-2ubuntu2.3 amd64 Vendor neutral GL dispatch library
ii libglx-mesa0:amd64 19.0.2-1ubuntu1.1~18.04.1 amd64 free implementation of the OpenGL API – GLX vendor library
ii libglx0:amd64 1.0.0-2ubuntu2.3 amd64 Vendor neutral GL dispatch library – GLX support

Finally, I check the libGL using command ‘ls -ll /usr/lib/aarch64-linux-gnu/libGL.so*’ and libGL.so* is missing:

ls: cannot access ‘/usr/lib/aarch64-linux-gnu/libGL.so*’: No such file or directory

Should I make symbolic link for them and where do I link to?
Please help me to solve this problem. Thanks!

Hi Raymond, jetson-inference isn’t tested against building on desktop, as it’s meant to be built on the Jetson. /usr/lib/aarch64-linux-gnu/ is the library path on aarch64 (arm64), so x64_64 will need another path. You can find the location of your libGL with this command:

$ find /usr -name "*libGL.so*"

Then you will want to add this path as a link_directory() in CMakeLists.txt

Thanks to dusty_nv.

However, it doesn’t work for me. I use find command and libGL.so are found in /usr/lib/x86_64-linux-gnu/. I add “link_directories(/usr/lib/x86_64-linux-gnu/)” in all CMakeLists.txt files in /home/user/jetson-inference/.

I have complete the building jetson-inference using the bellow symbolic link commands:

sudo ln -s /usr/lib/x86_64-linux-gnu/libGL.so.1 /usr/lib/x86_64-linux-gnu/libGL.so
sudo ln -s /usr/lib/x86_64-linux-gun/glib-2.0/include/glibconfig.h /usr/include/glibconfig.h

After make install, the x86_64 directory structure is built.