Search code examples
c++opencvcudategra

Jetson TK1 / OpenCV4Tegra Linker errors


I've got a program that compiles / runs fine on my machine. I just picked up a Nvidia Jetson TK1 to try running it on that. I flashed to the latest version of linux4tegra, installed cuda and opencv per the instruction here and here. I'm getting linker errors whenever I try to run my make file:

(.text+0x94): undefined reference to `cv::VideoCapture::VideoCapture(std::string const&)'
(.text+0xb2): undefined reference to `cv::VideoCapture::isOpened() const'
(.text+0xcc): undefined reference to `cv::VideoCapture::~VideoCapture()'
(.text+0x108): undefined reference to `cv::namedWindow(std::string const&, int)'
(.text+0x146): undefined reference to `vtable for cv::VideoCapture'
(.text+0x14a): undefined reference to `vtable for cv::VideoCapture'

I already symlinked a few cuda SO's, but I can't figure out where these are coming from.

My makefile looks like:

g++ `pkg-config --libs opencv` ...

Package config returns:

$ pkg-config --libs opencv
/usr/lib/libopencv_calib3d.so /usr/lib/libopencv_contrib.so /usr/lib/libopencv_core.so /usr/lib/libopencv_features2d.so /usr/lib/libopencv_flann.so /usr/lib/libopencv_gpu.so /usr/lib/libopencv_highgui.so /usr/lib/libopencv_imgproc.so /usr/lib/libopencv_legacy.so /usr/lib/libopencv_ml.so /usr/lib/libopencv_objdetect.so /usr/lib/libopencv_photo.so /usr/lib/libopencv_stitching.so /usr/lib/libopencv_superres.so /usr/lib/libopencv_ts.a /usr/lib/libopencv_video.so /usr/lib/libopencv_videostab.so /usr/lib/libopencv_esm_panorama.so /usr/lib/libopencv_facedetect.so /usr/lib/libopencv_imuvstab.so /usr/lib/libopencv_tegra.so /usr/lib/libopencv_vstab.so -lcufft -lnpps -lnppi -lnppc -lcudart -lrt -lpthread -lm -ldl  

Any ideas? My initial though was header / SO mismatch but since these all came from nvidia in the same package I think that's unlikely.


Solution

  • Turns out I needed pkg-config --libs opencv after my files in the make file.