Skip to content

Instantly share code, notes, and snippets.

@lkwatson
Last active August 21, 2019 01:47
Show Gist options
  • Save lkwatson/7e1742a563707649bc83f715bfcb130b to your computer and use it in GitHub Desktop.
Save lkwatson/7e1742a563707649bc83f715bfcb130b 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

Finally

make -j4
sudo make install
@ivanocj
Copy link

ivanocj commented Aug 20, 2019

Thanks man! saved me!

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