Ask Your Question

opencv( compiled with cuda (5.5): can't compile cpu based codes

asked 2013-09-05 20:29:02 -0500

ludotw gravatar image

updated 2013-09-06 02:06:59 -0500

Hi, I'm on ubuntu 13.04, have successfully compiled opencv with the latest cuda 5.5. At least I thought it was a success. Because when I try to compile the examples in /opencv-, all I get is:

/usr/bin/ld: warning:, needed by /usr/local/cuda/lib64/, not found (try using -rpath or -rpath-link)

And all the consequences of the above:

/usr/local/cuda/lib64/ undefined reference to `nppGetMaxThreadsPerSM'
/usr/local/cuda/lib64/ undefined reference to `nppGetStream'
/usr/local/cuda/lib64/ undefined reference to `Stream'
/usr/local/cuda/lib64/ undefined reference to `nppGetGpuComputeCapability'
/usr/local/cuda/lib64/ undefined reference to `Event'
/usr/local/lib/ undefined reference to `nppSetStream'
/usr/local/cuda/lib64/ undefined reference to `nppGetGpuNumSMs'
/usr/local/cuda/lib64/ undefined reference to `nppGetPointerMemoryType'
collect2: error: ld returned 1 exit status

This being my first use of cuda and compilation with opencv, I don't know where to go from this. The only I have found was for linux suse. Is there any thing I didn't set up properly when installing cuda (did with the .deb packages from nvidia site)? Cuda examples compile properly, opencv compiled and installed without any error.

Edit: I've just tried to compile an example (houghlines.cpp) in the gpu section of the samples (opencv-, with:

g++ houghlines.cpp -o houghlines `pkg-config --cflags --libs opencv` -lopencv_gpu

and it compiled and I could run the program all right. The above problem with libnppc remains with cpu examples (such as those in samples/c and samples/cpp) and any other older program I wrote...

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-09-08 21:03:51 -0500

ludotw gravatar image

Solved. The only thing I did after posting the above (ad after a weekend away from it) was to search and locate all the libraries related to CUDA.

On my 64bits system and OS (linux ubuntu 13.04) they are in


So appending the above line to


followed by

sudo ldconfig

did the trick. Simply had omitted this (it actually wasn't explicit in the installation guide I had followed). Now CPU examples I could compile can be executed.

edit flag offensive delete link more

Question Tools


Asked: 2013-09-05 20:29:02 -0500

Seen: 2,298 times

Last updated: Sep 08 '13