I followed Satish Salian’s guide at http://devblogs.nvidia.com/parallelforall/nvidia-nsight-eclipse-edition-for-jetson-tk1/ for Ubuntu 12.04 x 14.04 cross development and was able to successfully compile/run the boxfilter sample. However, I started running into issues when I tried running a personal project that utilizes OpenCV. I was able to compile and start the program eventually but was presented with a segmentation fault. Here are the steps I took:
- Added the following directory to NVCC Compiler -> Includes to point to OpenCV headers:
- Copied OpenCV libs from TK1 to Host:
sudo scp email@example.com:/usr/lib/libopencv* /usr/arm-linux-gnueabihf/lib/
- Added the following directory to NVCC Linker -> Libraries -> Library search path (-L):
- Added libraries (-l) needed by OpenCV headers (i.e. opencv_core, opencv_imgproc, etc.)
- Checked '-fPIC' in NVCC Compiler→Miscellaneous
- Checked '-shared' in NVCC Linker→Miscellaneous
- Built succesfully
This sequence is a result of addressing individual errors from the IDE as they arose, so I am sure some of these actions are incompatible. Here are a few things I postulate are leading to errors:
- I am not performing symbol linking after I copy the OpenCV libraries to the host. There are three different .so files for each lib, how do I determine which one to link to? For example, there exists a libopencv_core.so, libopencv_core.so.2.4, and libopencv_core.so.2.4.8.
- The include directory added in step 1, /usr/local/include, contains headers to the host machine's OpenCV files. These headers are then erroneously linked to the downloaded remote libraries in the added library search path, /usr/arm-linux-gnueabihf/lib. I noticed in this blog post the author mention the libopencv4tegra cmake configuration incorrectly sets the OpenCV include directories: http://namniart.com/jetson-tk1/ubuntu/2014/05/20/ROS-on-Jetson-part2.html
- Steps 5 and 6 are purely a result of googling/stackexchanging compiler errors, they don't feel right.
TL;DR: What is the proper way to cross-compile with the libopencv4tegra libraries?
Thanks for your time,