Nvidia Drive Software 10.0(Linux) : /usr/bin/ld: cannot find -lGL

[ 1%] Dependencies for /home/yongshengchen/nvidia/dw_samples/build-x86/src/imageprocessing/stereo/stereo/CMakeFiles/sample_stereo_disparity.dir//gen_utils.cu.o.depend.stamp
[ 2%] Dependencies for /home/yongshengchen/nvidia/dw_samples/build-x86/src/image/image_common/CMakeFiles/dw_samples_image_common.dir//gen_utils.cu.o.depend.stamp
[ 2%] Built target update_cuda_deps
[ 2%] Building CXX object 3rdparty/src/lodepng/CMakeFiles/lodepng-src.dir/src/lodepng.cpp.o
[ 3%] Linking CXX static library liblodepng-src.a
[ 3%] Built target lodepng-src
[ 4%] Building C object 3rdparty/src/glfw/CMakeFiles/glfw-x11.dir/3.2-screen/src/context.c.o
[ 4%] Building C object 3rdparty/src/glfw/CMakeFiles/glfw-x11.dir/3.2-screen/src/init.c.o
[ 5%] Building C object 3rdparty/src/glfw/CMakeFiles/glfw-x11.dir/3.2-screen/src/input.c.o
[ 5%] Building C object 3rdparty/src/glfw/CMakeFiles/glfw-x11.dir/3.2-screen/src/monitor.c.o
[ 6%] Building C object 3rdparty/src/glfw/CMakeFiles/glfw-x11.dir/3.2-screen/src/vulkan.c.o
[ 6%] Building C object 3rdparty/src/glfw/CMakeFiles/glfw-x11.dir/3.2-screen/src/window.c.o
[ 7%] Building C object 3rdparty/src/glfw/CMakeFiles/glfw-x11.dir/3.2-screen/src/x11_init.c.o
[ 7%] Building C object 3rdparty/src/glfw/CMakeFiles/glfw-x11.dir/3.2-screen/src/x11_monitor.c.o
[ 8%] Building C object 3rdparty/src/glfw/CMakeFiles/glfw-x11.dir/3.2-screen/src/x11_window.c.o
[ 8%] Building C object 3rdparty/src/glfw/CMakeFiles/glfw-x11.dir/3.2-screen/src/xkb_unicode.c.o
[ 9%] Building C object 3rdparty/src/glfw/CMakeFiles/glfw-x11.dir/3.2-screen/src/linux_joystick.c.o
[ 9%] Building C object 3rdparty/src/glfw/CMakeFiles/glfw-x11.dir/3.2-screen/src/posix_time.c.o
[ 10%] Building C object 3rdparty/src/glfw/CMakeFiles/glfw-x11.dir/3.2-screen/src/posix_tls.c.o
[ 10%] Building C object 3rdparty/src/glfw/CMakeFiles/glfw-x11.dir/3.2-screen/src/glx_context.c.o
[ 11%] Building C object 3rdparty/src/glfw/CMakeFiles/glfw-x11.dir/3.2-screen/src/egl_context.c.o
[ 11%] Built target glfw-x11
[ 11%] Linking C static library libglfw-src.a
[ 11%] Built target glfw-src
[ 11%] Building C object 3rdparty/src/glew/CMakeFiles/glew-src.dir/src/glew.c.o
[ 12%] Linking C static library libglew-src.a
[ 12%] Built target glew-src
[ 13%] Building CXX object src/framework/CMakeFiles/samples_allocator.dir/Allocator.cpp.o
[ 13%] Linking CXX static library libsamples_allocator.a
[ 13%] Built target samples_allocator
[ 14%] Building CXX object src/framework/CMakeFiles/samples_framework.dir/SampleFramework.cpp.o
[ 14%] Building CXX object src/framework/CMakeFiles/samples_framework.dir/DriveWorksSample.cpp.o
[ 15%] Building CXX object src/framework/CMakeFiles/samples_framework.dir/ProgramArguments.cpp.o
[ 15%] Building CXX object src/framework/CMakeFiles/samples_framework.dir/Window.cpp.o
[ 16%] Building CXX object src/framework/CMakeFiles/samples_framework.dir/Grid.cpp.o
[ 16%] Building CXX object src/framework/CMakeFiles/samples_framework.dir/WindowGLFW.cpp.o
[ 17%] Building CXX object src/framework/CMakeFiles/samples_framework.dir/MathUtils.cpp.o
[ 17%] Building CXX object src/framework/CMakeFiles/samples_framework.dir/MouseView3D.cpp.o
[ 18%] Building CXX object src/framework/CMakeFiles/samples_framework.dir/Log.cpp.o
[ 18%] Building CXX object src/framework/CMakeFiles/samples_framework.dir/ProfilerCUDA.cpp.o
[ 19%] Building CXX object src/framework/CMakeFiles/samples_framework.dir/CameraFramePipeline.cpp.o
[ 19%] Building CXX object src/framework/CMakeFiles/samples_framework.dir/SimpleCamera.cpp.o
[ 20%] Building CXX object src/framework/CMakeFiles/samples_framework.dir/SimpleRenderer.cpp.o
[ 20%] Building CXX object src/framework/CMakeFiles/samples_framework.dir/SimpleRecordingPlayer.cpp.o
[ 21%] Building CXX object src/framework/CMakeFiles/samples_framework.dir/ScreenshotHelper.cpp.o
[ 21%] Building CXX object src/framework/CMakeFiles/samples_framework.dir/RenderUtils.cpp.o
[ 22%] Linking CXX static library libsamples_framework.a
[ 22%] Built target samples_framework
[ 22%] Building CXX object src/egomotion/CMakeFiles/sample_egomotion.dir/main.cpp.o
[ 23%] Linking CXX executable sample_egomotion
/usr/bin/ld: cannot find -lGL
collect2: error: ld returned 1 exit status
src/egomotion/CMakeFiles/sample_egomotion.dir/build.make:112: recipe for target ‘src/egomotion/sample_egomotion’ failed
make[2]: *** [src/egomotion/sample_egomotion] Error 1
CMakeFiles/Makefile2:446: recipe for target ‘src/egomotion/CMakeFiles/sample_egomotion.dir/all’ failed
make[1]: *** [src/egomotion/CMakeFiles/sample_egomotion.dir/all] Error 2
Makefile:129: recipe for target ‘all’ failed
make: *** [all] Error 2

The following is step to install sdk and build.

  1. install Ubuntu 18.0 release. It’s clear installation. The disk had been reformatted during installation.

  2. install sdk 10.4. there was no issue found during installation.

  3. build
    $mkdir dw_samples
    $mkdir nvidia/dw_samples
    $cd dw_samples/
    $ln -s /usr/local/driveworks/samples/cmake/ cmake
    $ln -s /usr/local/driveworks/samples/3rdparty/ 3rdparty
    $cp -r /usr/local/driveworks/samples/src/ .
    $cp /usr/local/driveworks/samples/CMakeLists.txt .
    $vi CMakeLists.txt
    $ls /usr/local/driveworks/data
    $set(DRIVEWORKS_DATAPATH “/usr/local/driveworks/data”)

~/nvidia/dw_samples mkdir build-x86
~/nvidia/dw_samples cd build-x86/
~/nvidia/dw_samples/build-x86 cmake -DCMAKE_BUILD_TYPE=Release …
~/nvidia/dw_samples/build-x86 make

The error info is showed:
/usr/bin/ld: cannot find -lGL
collect2: error: ld returned 1 exit status
src/egomotion/CMakeFiles/sample_egomotion.dir/build.make:112: recipe for target ‘src/egomotion/sample_egomotion’ failed
make[2]: *** [src/egomotion/sample_egomotion] Error 1
CMakeFiles/Makefile2:446: recipe for target ‘src/egomotion/CMakeFiles/sample_egomotion.dir/all’ failed
make[1]: *** [src/egomotion/CMakeFiles/sample_egomotion.dir/all] Error 2
Makefile:129: recipe for target ‘all’ failed
make: *** [all] Error 2

Dear yongsheng.chen,
Could you check if the prerequisites are taken care?(https://docs.nvidia.com/driveworks/dwx_devguide_getting_started.html)

Yes. I did.

I installed all these libraries and rebooted the Linux. The build error is still there.
libx11-dev
libxrandr-dev
libxcursor-dev
libxxf86vm-dev
libxinerama-dev
libxi-dev
libglu1-mesa-dev
libglew-dev
libgles2-mesa-dev

Dear yongsheng.chen,
Do you find libGL.so at /usr/lib/x86_64-linux-gnu/ ? If not please check https://stackoverflow.com/questions/33447653/usr-bin-ld-cannot-find-lgl-ubuntu-14-04. Also, Please install NVIDIA drivers on host to run DW samples. Please check https://www.linuxbabe.com/ubuntu/install-nvidia-driver-ubuntu-18-04 to install NVIDIA drivers.

Thank you!
The libGL.so is in /usr/lib/x86_64-linux-gnu/ folder.

I also checked the /etc/ld.so.conf.d/, the x86_64-linux-gnu.conf is there as following:

Multiarch support

/usr/local/lib/x86_64-linux-gnu
/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu

I checked the link error by following command, and found the libGL.so can’t be opened.
ld -lGL --verbose

attempt to open //lib/x86_64-linux-gnu/libGL.so failed
attempt to open //lib/x86_64-linux-gnu/libGL.a failed
attempt to open //usr/lib/x86_64-linux-gnu/libGL.so failed
attempt to open //usr/lib/x86_64-linux-gnu/libGL.a failed
attempt to open //usr/lib/x86_64-linux-gnu64/libGL.so failed
attempt to open //usr/lib/x86_64-linux-gnu64/libGL.a failed

And then found the link of libGL.so is to libGL.so.1.0.0 and the LibGL.so.1.0.0 doesn’t exist.
So remove the softlink of libGL.so and setup new softlink to libGL.so.1. It works now. Thank you very much!

sudo rm /usr/lib/x86_64-linux-gnu/libGL.so
sudo ln -s /usr/lib/libGL.so.1 /usr/lib/x86_64-linux-gnu/libGL.so

Didn’t you say build was passed in https://devtalk.nvidia.com/default/topic/1070061/nvidia-drive-software-10-0-linux-missing-libcuda-so-1-and-libnvcuvid-so-1/ ?

Could you try if installing again helps?

$ sudo apt-get install libgl1

Hello, VickNV:
The build was passed in https://devtalk.nvidia.com/default/topic/1070061/nvidia-drive-software-10-0-linux-missing-libcuda-so-1-and-libnvcuvid-so-1/.

Current, I’m trying to setup another Linux workstation.
Thank you!