Skip to content

Instantly share code, notes, and snippets.

@ivanocj
Forked from lkwatson/god_save_me.md
Created August 20, 2019 13:47
Show Gist options
  • Save ivanocj/b6c3cd6510efdfb9906f0b4fee315db2 to your computer and use it in GitHub Desktop.
Save ivanocj/b6c3cd6510efdfb9906f0b4fee315db2 to your computer and use it in GitHub Desktop.
Compiling OpenCV 4.1.0 on NVIDIA Jetson Nano

sudo vi /usr/local/cuda/include/cuda_gl_interop.h

# Comment the following lines, near the top
//#if defined(__arm__) || defined(__aarch64__)
//#ifndef GL_VERSION
//#error Please include the appropriate gl headers before including cuda_gl_interop.h
//#endif
//#else
 #include <GL/gl.h>
//#endif

Symlink GL

cd /usr/lib/aarch64-linux-gnu/
sudo ln -sf tegra/libGLX_nvidia.so.0 libGL.so

Compile

git clone --depth=1 -b 4.1.0 git@github.com:opencv/opencv.git git clone --depth=1 -b 4.1.0 git@github.com:opencv/opencv_contrib.git

mkdir -p opencv/build cd build

cmake -D ENABLE_FAST_MATH=ON
-D WITH_CUDA=ON -D BUILD_CUDA_STUBS=ON -D CUDA_FAST_MATH=ON -D WITH_CUBLAS=ON
-D WITH_LIBREALSENSE=ON -D WITH_V4L=ON -D WITH_GSTREAMER=ON
-D BUILD_JAVA=OFF -D BUILD_TESTS=OFF
-D WITH_VTK=OFF -D WITH_QT=ON -D WITH_OPENGL=ON
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules ..

optionally add flag -D BUILD_opencv_apps=OFF

make -j4 sudo make install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment