I’d recommend not changing system libraries, as that will impact all source, not just the broken sample code. The sample writers should fix this issue in the sample code, with a better way to depend on the driver libraries.
The “lazy fix” is the right fix, in my opinion.
I use nvidia-docker to setup a CUDA develop environment, also encounter the same issue. So I try to solve this issue and writing down a Dockerfile. Also adding some useful comments, hope it’ll be helpful.
Here is my Dockerfile:
https://github.com/allenyllee/server_setup/blob/master/nvidia_docker/Dockerfile
Also answered in there:
https://stackoverflow.com/a/46362272/1851492
# CUDA 8.0
#
# VERSION 0.0.1
FROM nvidia/cuda:8.0-devel-ubuntu16.04
LABEL maintainer="allen7575@gmail.com"
##
## Ubuntu - Packages - Search
## https://packages.ubuntu.com/search?suite=xenial§ion=all&arch=amd64&searchon=contents&keywords=Search
##
###
### solve for
### >>> WARNING - libGL.so not found, refer to CUDA Getting Started Guide for how to find and install them. <<<
### >>> WARNING - libX11.so not found, refer to CUDA Getting Started Guide for how to find and install them. <<<
### >>> WARNING - Xlib.h not found, refer to CUDA Getting Started Guide for how to find and install them. <<<
### >>> WARNING - gl.h not found, refer to CUDA Getting Started Guide for how to find and install them. <<<
###
### 2_Graphics/volumeFiltering
### 2_Graphics/simpleGL
### 2_Graphics/bindlessTexture
### 2_Graphics/volumeRender
### 2_Graphics/Mandelbrot
### 2_Graphics/marchingCubes
### 2_Graphics/simpleTexture3D
### 3_Imaging/imageDenoising
### 3_Imaging/recursiveGaussian
### 3_Imaging/simpleCUDA2GL
### 3_Imaging/postProcessGL
### 3_Imaging/bicubicTexture
### 3_Imaging/boxFilter
### 3_Imaging/SobelFilter
### 3_Imaging/cudaDecodeGL
### 3_Imaging/bilateralFilter
### 5_Simulations/particles
### 5_Simulations/smokeParticles
### 5_Simulations/oceanFFT
### 5_Simulations/fluidsGL
### 5_Simulations/nbody
### 6_Advanced/FunctionPointers
### 7_CUDALibraries/randomFog
###
RUN apt update && apt -y install libgl1-mesa-dev
###
### solve for
### >>> WARNING - libGLU.so not found, refer to CUDA Getting Started Guide for how to find and install them. <<<
### >>> WARNING - glu.h not found, refer to CUDA Getting Started Guide for how to find and install them. <<<
###
RUN apt update && apt -y install libglu1-mesa-dev
###
### solve for
### /usr/bin/ld: cannot find -lglut
### https://stackoverflow.com/questions/15064159/usr-bin-ld-cannot-find-lglut
###
RUN apt update && apt -y install freeglut3-dev
###
### solve for
### >>> WARNING - egl.h not found, please install egl.h <<<
### >>> WARNING - eglext.h not found, please install eglext.h <<<
### >>> WARNING - gl31.h not found, please install gl31.h <<<
###
### 2_Graphics/simpleGLES_EGLOutput
### 2_Graphics/simpleGLES
### 2_Graphics/simpleGLES_screen
### 5_Simulations/nbody_opengles
### 5_Simulations/fluidsGLES
### 5_Simulations/nbody_screen
###
RUN apt update && apt -y install libgles2-mesa-dev
###
### You should also search 'UBUNTU_PKG_NAME = "nvidia-367"' and replace it to 'UBUNTU_PKG_NAME = "nvidia"'
### for all matched files in the NVIDIA_CUDA-8.0_Samples folder to make it works.
###
RUN mkdir /usr/lib/nvidia && \
### solve for /usr/bin/ld: cannot find -lnvcuvid \
### 3_Imaging/cudaDecodeGL \
ln -s /usr/local/nvidia/lib64/libnvcuvid.so.1 /usr/lib/nvidia/libnvcuvid.so && \
### solve for >>> WARNING - libEGL.so not found, please install libEGL.so <<< \
### 3_Imaging/EGLStreams_CUDA_Interop \
ln -s /usr/local/nvidia/lib64/libEGL.so.1 /usr/lib/nvidia/libEGL.so && \
### solve for >>> WARNING - libGLES.so not found, please install libGLES.so <<< \
### 2_Graphics/simpleGLES_EGLOutput \
### 2_Graphics/simpleGLES \
### 2_Graphics/simpleGLES_screen \
### 5_Simulations/nbody_opengles \
### 5_Simulations/fluidsGLES \
### 5_Simulations/nbody_screen \
ln -s /usr/local/nvidia/lib64/libGLESv2_nvidia.so.2 /usr/lib/nvidia/libGLESv2.so
CMD ["bash"]
I just did LIBRARY_PATH=/usr/lib/nvidia-384:$LIBRARY_PATH make
and the problem goes away. Thanks whoever suggested it
I confirm that BostonBuddy’s fix works at 11/April/ 2018 with UBUNTU_PKG_NAME = “nvidia-390” and the ln statements apropriately modified.
You may need to update LD_LIBRARY_PATH and LIBRARY_PATH too.
I had a same issue and this resolved the problem:
- Run gksu nautilus (you may need to install gksu first)
- This gives access to root folders.
- Simply copy /usr/lib32/nvidia-367/libnvcuvid.so.* files and paste them in usr/local/Cuda/lib64 (As set in PATH file in .bashrc)
4.Run make again.