在Ubuntu 16.04 上安装CUDA 9.0遇到的一个问题以及解决
在Ubuntu16.04的环境下,安装CUDA 9.0,使用时官方的run文件。
然后遇到的主要的问题如下:
Installing the CUDA Toolkit in /usr/local/cuda-9.0 ...
Missing recommended library: libGL.so
Installing the CUDA Samples in /home/dl ...
Copying samples to /home/dl/NVIDIA_CUDA-9.0_Samples now...
Finished copying samples.
===========
# = Summary =
Driver: Not Selected
Toolkit: Installed in /usr/local/cuda-9.0
Samples: Installed in /home/dl, but missing recommended libraries
Please make sure that
- PATH includes /usr/local/cuda-9.0/bin
- LD_LIBRARY_PATH includes /usr/local/cuda-9.0/lib64, or, add /usr/local/cuda-9.0/lib64 to /etc/ld.so.conf and run ldconfig as root
To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-9.0/bin
Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-9.0/doc/pdf for detailed information on setting up CUDA.
***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 384.00 is required for CUDA 9.0 functionality to work.
To install the driver using this installer, run the following command, replacing <CudaInstaller> with the name of this run file:
sudo <CudaInstaller>.run -silent -driver
提示中提到的主要问题:
Missing recommended library: libGL.so
根据这个问题,在网上解决了好久,有人说如下解决:
sudo apt-get install g++ freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev
没有效果。
然后我检索了一下:
sudo find / -name 'libGL*'
得到结果如下:
dl@dl-MS-7B18:/media/dl/down/download$ sudo find / -name 'libGL*'
/usr/local/cuda-9.0/samples/common/lib/linux/x86_64/libGLEW.a
/usr/local/cuda-9.0/samples/common/lib/linux/aarch64/libGLEW.a
/usr/local/cuda-9.0/samples/common/lib/linux/armv7l/libGLEW.a
/usr/lib/x86_64-linux-gnu/libGLX_nvidia.so.418.56
/usr/lib/x86_64-linux-gnu/libGLX.so
/usr/lib/x86_64-linux-gnu/libGLU.so.1.3.1
/usr/lib/x86_64-linux-gnu/libGLEW.so.1.13.0
/usr/lib/x86_64-linux-gnu/libGL.so.1.7.0
/usr/lib/x86_64-linux-gnu/libGL.so
/usr/lib/x86_64-linux-gnu/libGLESv1_CM.so.1.2.0
/usr/lib/x86_64-linux-gnu/mesa/libGL.so
/usr/lib/x86_64-linux-gnu/libGLEWmx.so.1.13
/usr/lib/x86_64-linux-gnu/libGLESv1_CM_nvidia.so.1
/usr/lib/x86_64-linux-gnu/libGLU.so
/usr/lib/x86_64-linux-gnu/libGLX_nvidia.so.0
/usr/lib/x86_64-linux-gnu/libGLESv1_CM_nvidia.so.418.56
/usr/lib/x86_64-linux-gnu/libGL.la
/usr/lib/x86_64-linux-gnu/libGLU.so.1
/usr/lib/x86_64-linux-gnu/libGL.so.1
/usr/lib/x86_64-linux-gnu/libGLESv2.so
/usr/lib/x86_64-linux-gnu/libGLX.so.0
/usr/lib/x86_64-linux-gnu/libGLEW.so.1.13
/usr/lib/x86_64-linux-gnu/libGLESv2.so.2.1.0
/usr/lib/x86_64-linux-gnu/libGLdispatch.so.0
/usr/lib/x86_64-linux-gnu/libGLESv2_nvidia.so.2
/usr/lib/x86_64-linux-gnu/libGLEWmx.so.1.13.0
/usr/lib/x86_64-linux-gnu/libGLU.a
/usr/lib/x86_64-linux-gnu/libGLESv2_nvidia.so.418.56
/usr/lib/x86_64-linux-gnu/libGLESv1_CM.so
/usr/lib/x86_64-linux-gnu/libGLESv1_CM.so.1
/usr/lib/x86_64-linux-gnu/libGLX_indirect.so.0
/usr/lib/x86_64-linux-gnu/libGLESv2.so.2
/usr/lib/libGL.so.1
/home/dl/NVIDIA_CUDA-9.0_Samples/common/lib/linux/x86_64/libGLEW.a
/home/dl/NVIDIA_CUDA-9.0_Samples/common/lib/linux/aarch64/libGLEW.a
/home/dl/NVIDIA_CUDA-9.0_Samples/common/lib/linux/armv7l/libGLEW.a
发现系统中是存在这个文件的:
/usr/lib/libGL.so.1
于是我建立软连接:
sudo ln -s /usr/bin/libGL.so.1 /usr/bin/libGL.so
然后,Evevring thing is OK~
记录下来,同样遭遇的你少走弯路。