opencv 3.1 sample error on TX1 JetPack 3.1 on Ubuntu 16.04

Hi,

I installed JetPack3.1 and opencv3.1. When I run the opencv sample code, I got error,

nvidia@tegra-ubuntu:/media/nvidia/SD32G/sw/opencv-3.1.0/samples/build/cpp$ ./cpp-example-image …/…/data/lena.jpg
OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvNamedWindow, file /media/nvidia/SD32G/sw/opencv-3.1.0/modules/highgui/src/window.cpp, line 527
terminate called after throwing an instance of ‘cv::Exception’
what(): /media/nvidia/SD32G/sw/opencv-3.1.0/modules/highgui/src/window.cpp:527: error: (-2) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function cvNamedWindow

Aborted
nvidia@tegra-ubuntu:/media/nvidia/SD32G/sw/opencv-3.1.0/samples/build/cpp$

I already installed both libgtk2.0-dev and pkg-config. I rebuilt opencv 3.1 a few times already but still ran into this issue.

Looking at opencv3.1 “cmake …” output, it seems QT and openGL are not installed.
– GUI:
– QT: NO
– GTK+ 2.x: YES (ver 2.24.30)
– GThread : YES (ver 2.48.1)
– GtkGlExt: NO
– OpenGL support: NO
– VTK support: NO

But actually I have both installed…
nvidia@tegra-ubuntu:/usr$ ff openGL.so
./lib/libreoffice/program/opengl/solidFragmentShader.glsl
./lib/aarch64-linux-gnu/libQt5OpenGL.so.5
./lib/aarch64-linux-gnu/libQt5OpenGL.so
./lib/aarch64-linux-gnu/libQt5OpenGL.so.5.5.1
./lib/aarch64-linux-gnu/tegra/libOpenGL.so.0
./lib/aarch64-linux-gnu/compiz/libopengl.so
./lib/aarch64-linux-gnu/libQt5OpenGL.so.5.5
nvidia@tegra-ubuntu:/usr$
./include/aarch64-linux-gnu/qt5/QtPrintSupport/qpagesetupdialog.h
./include/aarch64-linux-gnu/qt5/QtPrintSupport/QtPrintSupport
./include/aarch64-linux-gnu/qt5/QtPrintSupport/QPrintEngine
nvidia@tegra-ubuntu:/usr$

Can anyone help?

thanks,

Steve

Please try

# OpenGL development libraries (to allow creating graphical windows)
sudo apt-get -y install libglew1.6-dev
# GTK development libraries (to allow creating graphical windows)
sudo apt-get -y install libgtk2.0-dev

#re-run cmake configuration

Thanks, WayneWWW. I actually already installed everything you mentioned above.

I followed this wiki, OpenCV: Building OpenCV for Tegra with CUDA, and reinstalled opencv 3.1. Now everything is working. cheers,