TX1 OpenCV Lib Problems


So I was trying to run a cpp program on the TX1, but when I make the file, the following error pops:

ubuntu@tegra-ubuntu:~/Pedestrian_Tracking/build$ make
Scanning dependencies of target cv_Tracking
[ 50%] Building CXX object CMakeFiles/cv_Tracking.dir/main.cpp.o
/home/ubuntu/Pedestrian_Tracking/main.cpp:1:33: fatal error: opencv2\core\core.hpp: No such file or directory
compilation terminated.
CMakeFiles/cv_Tracking.dir/build.make:62: recipe for target 'CMakeFiles/cv_Tracking.dir/main.cpp.o' failed
make[2]: *** [CMakeFiles/cv_Tracking.dir/main.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/cv_Tracking.dir/all' failed
make[1]: *** [CMakeFiles/cv_Tracking.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

And Here is the headings I’m using,

#include <opencv2\core\core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include <opencv2\objdetect\objdetect.hpp>
#include <opencv2\opencv.hpp>

using namespace std;
using namespace cv;

const static int SENSITIVITY_VALUE = 20;
const static int BLUR_SIZE = 10;
int theObject[2] = {0,0};

Does anyone know why is this happening? My host laptop is a Ubuntu 16.04, so I did not check OpenCV when I was flashing the Jetpack to the board. Is that the problem?


Hi nothingworkswithme,
Please check your makefile to see if there is correct path included. Looks like it is missing.

I did not check OpenCV when I was flashing the Jetpack to the board.
I guess you should have “/usr/include/opencv2/core/core.hpp” if you have installed opencv.

Are you talking about the CMakeList.txt?

cmake_minimum_required (VERSION 2.8)


project (Tracking)

find_package (OpenCV REQUIRED)

include_directories (${OpenCV_INCLUDE_DIRS})

add_executable(cv_Tracking main.cpp)

target_link_libraries(cv_Tracking ${OpenCV_LIBS})

Not sure where I did wrong.

I did not OpenCV bc as I said my host run 16.04 which Jetpack doesn’t support.

This may not be specific to your case (I’m not an “OpenCV guy”), but generally you need the base version of a library such as OpenCV in order to run code or to link against it. Since you are running on a Jetson, only the Jetson would need this to run OpenCV. To compile against OpenCV you’d also need the dev package (which provides headers). If you compile on the Jetson, then this is where you need it.

As soon as you go to cross compile, then you need cross compiler tools on the host. For a user space application (basically anything other than kernel or boot loader), you also need support (cross) tools to do linking. What the linking works with implies your host will have to have a cross-architecture install of OpenCV…this isn’t really installed on your host for your host to run, all it does is make the files visible for the cross-linker and cross-compiler to see…these are called foreign architecture because the native host cannot use those files directly, only cross-architecture tools understanding the foreign architecture would know what to do with them (those files if placed on the Jetson become native architecture instead of foreign).

Basically you need to either compile on Jetson with dev packages plus base libraries, or you need to cross-compile with a copy of those same files set up as a foreign architecture on your host. Native compile on the Jetson simplifies life, but if you use nsight, then you have to set it up for remote build instead of cross-compile…eclipse works with both types of work flow.