CUDA 6.5: cannot find -lnvcuvid

When I try to compile all the examples in CUDA 6.5 I get

/usr/bin/ld: cannot find -lnvcuvid

What is the missing library? I googled but could not find anything. I use CentOS 6.5.

The library should be in /lib64/libnvcuvid.so*.

I am getting this same error on Ubuntu 14.04

On CentOS 6.x, CUDA 6.5 (driver 340.29) should install the following:

find / -name libnvcuvid.*

/usr/lib/libnvcuvid.so.1
/usr/lib/libnvcuvid.so.340.29
/usr/lib/libnvcuvid.so
/usr/lib64/libnvcuvid.so.1
/usr/lib64/libnvcuvid.so.340.29
/usr/lib64/libnvcuvid.so

The above is based on using the .run file installer method (which bundles driver 340.29). If you use repos, things may be different.

I ran the command “find / -name libnvcuvid.*” and got the following results:

/usr/lib/nvidia-343/libnvcuvid.so.1
/usr/lib/nvidia-343/libnvcuvid.so
/usr/lib/nvidia-343/libnvcuvid.so.343.13
/usr/lib32/nvidia-343/libnvcuvid.so.1
/usr/lib32/nvidia-343/libnvcuvid.so
/usr/lib32/nvidia-343/libnvcuvid.so.343.13

As you can see I’m using the 343 drivers. Should I update the LD_LIBRARY_PATH to include lib32? (im on a 64 bit system)

I’m less familiar with Ubuntu than CentOS, but it seems to me you would want to make sure that /usr/lib/nvidia-343/ is in your LD_LIBRARY_PATH

HOWEVER, LD_LIBRARY_PATH has nothing to do with compilation. It is merely a runtime instruction to the Linux OS on where to look for dynamically loadable shared libraries.

If you are getting this error during compilation, it means that the makefile would have to be modified to include the appropriate library path for the linker specification (e.g. -L/usr/lib/nvidia-343/ somewhere in the makefile(s))

I assume you are building 64-bit binaries on that system. The samples makefile should be doing that. In that case, the path containing lib32 should not be necessary.

I don’t think the 343 drivers come with the Linux 64-bit runfile installer. So most likely this difficulty is being caused by using the repo method for installation of various pieces (e.g. Linux GPU driver). For simplicity of install, for CUDA 6.5, I would suggest using the .run file install method, as well as the driver that comes with that installer. You’re welcome to do whatever you wish, of course. The suggestion is merely aimed at trying to make things easier.

Thank you txbob for this help. I’m going to edit the make file.

The reason I have the 343 drivers installed is because the drivers that come with CUDA 6.5 are not supported by my graphics card (GeForce 710M).

What edits did you do to the make file?

On my machine:

find / -name libnvcuvid.*
/usr/lib32/nvidia-343/libnvcuvid.so.343.22
/usr/lib32/nvidia-343/libnvcuvid.so.1
/usr/lib32/nvidia-343/libnvcuvid.so
/usr/lib/nvidia-343/libnvcuvid.so.343.22
/usr/lib/nvidia-343/libnvcuvid.so.1
/usr/lib/nvidia-343/libnvcuvid.so

I am having the same issue when I try to compile the examples for a GTX 980.

In the samples folders, the file findglib.mk was hardcoded with this line:

UBUNTU_PKG_NAME = "nvidia-340"

… even though that driver is not compatible with the gtx 980. I changed 340 to 343, and the samples were made without error.

An alternative is to set LIBRARY_PATH to include /use/lib/nvidia-*/ like:

$ LIBRARY_PATH=/usr/lib/nvidia-343:$LIBRARY_PATH make

Hi,

I am getting the same error:

“/usr/local/cuda-7.5”/bin/nvcc -ccbin g++ -m64 -gencode arch=compute_20,code=compute_20 -o cudaDecodeGL FrameQueue.o ImageGL.o VideoDecoder.o VideoParser.o VideoSource.o cudaModuleMgr.o cudaProcessFrame.o videoDecodeGL.o -L…/…/common/lib/linux/x86_64 -L/usr/lib/“nvidia-352” -lGL -lGLU -lX11 -lglut -lGLEW -lcuda -lcudart -lnvcuvid
/usr/bin/ld: cannot find -lnvcuvid
collect2: error: ld returned 1 exit status
make[1]: *** [cudaDecodeGL] Error 1
make[1]: Leaving directory `/home/audio-dnn/NVIDIA_CUDA-7.5_Samples/3_Imaging/cudaDecodeGL’
make: *** [3_Imaging/cudaDecodeGL/Makefile.ph_build] Error 2

I have nvidia-367 driver and I didn’t install the driver from the run file. Would you please help me how I can fix this?

Thanks

use a linux utility like find to locate whether libnvcuvid.so is on your machine anywhere. The actual location varies depending on linux distro and driver install method.

Once you have located it, make it so the linker can find it. Either modify the link command or else copy the libnvcuvid to a location that the linker can find it. The file itself is probably a symlink, so the “copying” needs to be done correctly. Start reading at comment #4 above and follow that sequence.

Thanks txbob for the reply.

This is the output of find / -name libnvcuvid.*

/usr/lib32/nvidia-367/libnvcuvid.so
/usr/lib32/nvidia-367/libnvcuvid.so.1
/usr/lib32/nvidia-367/libnvcuvid.so.367.35
/usr/lib/nvidia-367/libnvcuvid.so
/usr/lib/nvidia-367/libnvcuvid.so.1
/usr/lib/nvidia-367/libnvcuvid.so.367.35

Should I add a line to Makefile such as:

-L/usr/lib/nvidia-367/

Please let me know.
Thank you

I found the file findglib.mk in ~/NVIDIA_CUDA-7.5_Samples/common

and I edited the UBUNTU_PKG_NAME to

UBUNTU_PKG_NAME = "nvidia-367"

but the error still exists:

/usr/bin/ld: cannot find -lnvcuvid

Try repeating the command that is failing just from the command line, but add

-L/usr/lib/nvidia-367

before the -lnvcuvid switch. like so:

/usr/local/cuda-7.5/bin/nvcc -ccbin g++ -m64 -gencode arch=compute_20,code=compute_20 -o cudaDecodeGL FrameQueue.o ImageGL.o VideoDecoder.o VideoParser.o VideoSource.o cudaModuleMgr.o cudaProcessFrame.o videoDecodeGL.o -L…/…/common/lib/linux/x86_64 -L/usr/lib/nvidia-367 -lGL -lGLU -lX11 -lglut -lGLEW -lcuda -lcudart -lnvcuvid

You’ll need to be in the appropriate directory and maybe issue it with sudo, depending on where you are doing this.

Thanks txbob.

The following solved my problem for now and I am able to compile the cuda samples currently:

  1. edit file findglib.mk located at ~/NVIDIA_CUDA-7.5_Samples/common so that:
UBUNTU_PKG_NAME = "nvidia-367"
  1. make soft link such as:

sudo ln -s /usr/lib/nvidia-367/libnvcuvid.so /usr/lib/libnvcuvid.so
sudo ln -s /usr/lib/nvidia-367/libnvcuvid.so.1 /usr/lib/libnvcuvid.so.1

A lazy fix would be to run (for cuda 8.0):

find . -type f -execdir sed -i ‘s/UBUNTU_PKG_NAME = “nvidia-367”/UBUNTU_PKG_NAME = “nvidia-375”/g’ ‘{}’ ;

in ~/NVIDIA_CUDA-8.0_Samples/.

I confirm that this solution works.

A lazy fix would be to run (for cuda 8.0):

find . -type f -execdir sed -i ‘s/UBUNTU_PKG_NAME = “nvidia-367”/UBUNTU_PKG_NAME = “nvidia-375”/g’ ‘{}’ ;

in ~/NVIDIA_CUDA-8.0_Samples/.

Confirm this method work on my machine.

I can verify that this solution works
sudo ln -s /usr/lib/nvidia-367/libnvcuvid.so /usr/lib/libnvcuvid.so
sudo ln -s /usr/lib/nvidia-367/libnvcuvid.so.1 /usr/lib/libnvcuvid.so.1

I am running Ubuntu on Windows Subsystem for Linux with NVidia-375 and a GTX 1080.

Interestingly, I did not have this issue on my ‘real’ Linux box which was running Ubuntu 16.10