2

ソースから OpenCV 3.4.0 をコンパイルしようとしていますが、QT と OpenGL の間で競合する宣言の問題が発生しています。QT4 から QT5 にアップグレードすると、一部の問題は解決しましたが、すべてではありませんでした。GLsizeiptr と GLintptr が OpenGL ヘッダーと QT ヘッダーの両方で宣言されているようです。

交換してみました

#include <GL/glx.h>

#include <GLES3/gl3.h>

window_QT.cpp にありましたが、宣言の問題がさらに発生しました。

それを修正する方法についてのアイデアはありますか?

(私のマシンは、Ubuntu 16.04.3 LTS を実行している armv7l (Odroid XU4) です)

私が実行しているcmakeコマンド:

cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -DWITH_QT=5 -DWITH_OPENGLES=ON -DWITH_V4L=ON -DWITH_TBB=ON -DBUILD_TBB=ON -DENABLE_VFPV3=ON -DENABLE_NEON=ON ..

make -j8

私が得ているエラー:

[ 62%] Built target opencv_videoio
[ 63%] Built target opencv_superres
[ 63%] Building CXX object 

modules/highgui/CMakeFiles/opencv_highgui.dir/src/window_QT.cpp.o
cc1plus: warning: /home/odroid/temporary_cmake_binary_dir/opencv-3.4.0/release/modules/highgui/precomp.hpp.gch/opencv_highgui_RELEASE.gch: not used because `TBB_USE_GCC_BUILTINS' is defined [-Winvalid-pch]
In file included from /usr/include/GL/gl.h:2055:0,
                 from /usr/include/GL/glx.h:32,
                 from /home/odroid/temporary_cmake_binary_dir/opencv-3.4.0/modules/highgui/src/window_QT.cpp:59:
/usr/include/GL/glext.h:466:19: error: conflicting declaration ‘typedef ptrdiff_t GLsizeiptr’
 typedef ptrdiff_t GLsizeiptr;
                   ^
In file included from /usr/include/arm-linux-gnueabihf/qt5/QtGui/qopengl.h:95:0,
                 from /usr/include/arm-linux-gnueabihf/qt5/QtGui/qopenglcontext.h:54,
                 from /usr/include/arm-linux-gnueabihf/qt5/QtGui/QtGui:32,
                 from /usr/include/arm-linux-gnueabihf/qt5/QtOpenGL/QtOpenGLDepends:4,
                 from /usr/include/arm-linux-gnueabihf/qt5/QtOpenGL/QtOpenGL:3,
                 from /home/odroid/temporary_cmake_binary_dir/opencv-3.4.0/modules/highgui/src/window_QT.h:50,
                 from /home/odroid/temporary_cmake_binary_dir/opencv-3.4.0/modules/highgui/src/window_QT.cpp:47:
/usr/include/GLES3/gl31.h:77:25: note: previous declaration as ‘typedef khronos_ssize_t GLsizeiptr’
 typedef khronos_ssize_t GLsizeiptr;
                         ^
In file included from /usr/include/GL/gl.h:2055:0,
                 from /usr/include/GL/glx.h:32,
                 from /home/odroid/temporary_cmake_binary_dir/opencv-3.4.0/modules/highgui/src/window_QT.cpp:59:
/usr/include/GL/glext.h:467:19: error: conflicting declaration ‘typedef ptrdiff_t GLintptr’
 typedef ptrdiff_t GLintptr;
                   ^
In file included from /usr/include/arm-linux-gnueabihf/qt5/QtGui/qopengl.h:95:0,
                 from /usr/include/arm-linux-gnueabihf/qt5/QtGui/qopenglcontext.h:54,
                 from /usr/include/arm-linux-gnueabihf/qt5/QtGui/QtGui:32,
                 from /usr/include/arm-linux-gnueabihf/qt5/QtOpenGL/QtOpenGLDepends:4,
                 from /usr/include/arm-linux-gnueabihf/qt5/QtOpenGL/QtOpenGL:3,
                 from /home/odroid/temporary_cmake_binary_dir/opencv-3.4.0/modules/highgui/src/window_QT.h:50,
                 from /home/odroid/temporary_cmake_binary_dir/opencv-3.4.0/modules/highgui/src/window_QT.cpp:47:
/usr/include/GLES3/gl31.h:78:26: note: previous declaration as ‘typedef khronos_intptr_t GLintptr’
 typedef khronos_intptr_t GLintptr;
                          ^
[ 63%] Built target gen_opencv_python_source
modules/highgui/CMakeFiles/opencv_highgui.dir/build.make:129: recipe for target 'modules/highgui/CMakeFiles/opencv_highgui.dir/src/window_QT.cpp.o' failed
make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/window_QT.cpp.o] Error 1
CMakeFiles/Makefile2:5307: recipe for target 'modules/highgui/CMakeFiles/opencv_highgui.dir/all' failed
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2

助けてくれてありがとう!

4

1 に答える 1