Error running openCV code with CUDA on Ubuntu 14.04

I’m trying to test some code for my Jetson (which I don’t have access to right now) on my desktop, which is running Ubuntu 14.04.5. I installed the CUDA 6.5 toolkit and OpenCV4Tegra, both the “for Ubuntu 14.04” versions, from https://developer.nvidia.com/linux-tegra-rel-21. I dpkg’d and installed both (CUDA then CV), with

sudo apt install cuda-toolkit-6-5
sudo usermod -a -G video $USER
echo "# Add CUDA bin & library paths:" >> ~/.bashrc
echo "export PATH=/usr/local/cuda/bin:$PATH" >> ~/.bashrc
echo "export LD_LIBRARY_PATH=/usr/local/cuda/lib:$LD_LIBRARY_PATH" >> ~/.bashrc
source ~/.bashrc

for CUDA and

sudo apt-get install libopencv4tegra libopencv4tegra-dev

for openCV. The libraries seem to be installed correctly because my code builds, but when I try to run it, I get

OpenCV Error: Gpu API call (CUDA driver version is insufficient for CUDA runtime version) in mallocPitch, file /hdd/buildbot/slaves/slave_ubuntu14/54-O4T-Ubuntu14/opencv/modules/dynamicuda/include/opencv2/dynamicuda/dynamicuda.hpp, line 1134
terminate called after throwing an instance of 'cv::Exception'
  what():  /hdd/buildbot/slaves/slave_ubuntu14/54-O4T-Ubuntu14/opencv/modules/dynamicuda/include/opencv2/dynamicuda/dynamicuda.hpp:1134: error: (-217) CUDA driver version is insufficient for CUDA runtime version in function mallocPitch

I tried to fix this by installing cuda-drivers, but it has nvidia-343 as an unmet dependency, which in turn has xorg-video-abi-15 as an unmet dependency, which in turn has libcheese-gtk23 and libcheese7 as unmet dependencies, despite the fact that apt tells me that both are installed with the most recent version. My GPU is a GTX 960, which is CUDA compatible. nvcc is release 6.5, V6.5.16.
Sorry if this is the wrong place for this.

Hi noah.gleason1,

Please try to use Jetpack to install cuda and opencv4tegra.

I uninstalled those packages and installed Jetpack 3.1, which went fine until it told me to plug in my Jetson to flash, so I clicked “cancel” because I don’t have one, assuming it would have already installed opencv4tegra and cuda locally. After rebooting, nvcc -V works and outputs V6.5.45, but CMake can’t find OpenCV. I ran the install script in my documents folder, did I need to put it somewhere special like /usr/local?

noah.gleason1,

OpenCV+CUDA in Jetpack3.1 should be able to use GPU function. Why do you need CMake? What are you trying to build? Sorry that I didn’t get clear in above comments.

I have a program to detect retroreflective tape and use solvePnP to find out where the camera is, which you can find here: GitHub - blair-robot-project/jetson-vision: Vision code for the Jetson TK1. . It’s eventually going to run on a Jetson TK1, but I want to test it out on my computer, or if that can’t be done because I’m on x86, at least set up cross-compilation. I’m using CMake because I’ve heard it’s the best build manager for c++ and it works nicely with CLion. My current problem, after going through the Jetpack install, is that the openCV library it installed can’t be found by CMake and doesn’t show up when I run pkg-config --list-all. Sorry for XY probleming!

Hi noah.gleason1,
How is your project? My suggestion is that please directly compile your project on TK1 (if you don’t insist on cross-compile) so that we can try to figure it out.