Ask Your Question

Building OpenCV 2.4.9 with CUDA Linking Problem

asked 2013-01-08 06:29:52 -0600

Foloex gravatar image

Hello world,

I've been trying to build OpenCV 2.4.9 (SVN) with CUDA support for a few days on Ubuntu 12.10 (x64).

During the linking I have the following error: Linking CXX executable ../../bin/opencv_perf_gpu ../../lib/ undefined reference to « cuCtxGetCurrent »

I have no idea on how to fix this and it doesn't seem to be a frequent problem.

I tried various methods in various (if not all) combinations:

  1. manually installing CUDA 5.0 using Nvidia's package for Ubuntu 11.10 x64
  2. building CUDA 5.0 and OpenCV using both gcc (and g++) 4.6 and 4.7
  3. installing the CUDA 4.2 dev and toolkit package provided by apt-get
  4. trying changing the display drivers: 304.48, 310, 304.54 (from the CUDA 5.0 package)

Each time I made sure to have all the cuda libs detected by ldconfig. Though I'm still not sure which lib file is supposed to contain the function cuCtxGetCurrent...

Thank you in advance.

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2013-03-21 22:14:09 -0600

This post is kind of old, so I'm not sure if it's still relevant, but I was having the same problem installing OpenCV 2.4.4 on Ubuntu 12.10 after having installed the CUDA 5.0 toolkit from (though with the NVIDIA driver that was installed from the nvidia-current package when I installed Bumblebee from the bumblebee PPA, version 304.84, I believe). I was able to successfully compile OpenCV by running cmake -i, saying yes to see the advanced options, and adding -L/usr/lib/nvidia-current -lcuda each time I was asked for linker flags (/usr/lib/nvidia-current/ is where the NVIDIA libraries were installed from the nvidia-current package).

edit flag offensive delete link more


Has anybody found a way to automate this workaround? thanks

Dani Pinyol gravatar imageDani Pinyol ( 2013-05-08 08:32:36 -0600 )edit

Question Tools


Asked: 2013-01-08 06:29:52 -0600

Seen: 1,802 times

Last updated: Mar 21 '13