Under Ubuntu, sometimes when the NVIDIA drivers are installed, CMake cannot properly find OpenGL (specifically libGL.so). As a result, linking issues may occur.
The easiest fix for this is to first create a symlink of
xxx is the version of the current NVIDIA driver installed (e.g.
nvidia-387) . Then create a symlink from
The command would be:
sudo ln -sfn /usr/lib/nvidia-xxx /usr/lib/nvidia-current
sudo ln -sfn /usr/lib/nvidia-current/libGL.so /usr/lib/libGL.so
Note that having
nvidia-current symlink is generally a good idea as it can prevent other linker errors when it comes to finding NVIDIA-specific libraries. Also, remember to update this symlink whenever NVIDIA drivers are also updated.