armv7l编译中的OpenCV“冲突声明”问题(Odroid XU4)

时间:2018-02-24 01:55:41

标签: c++ opencv compiler-errors arm odroid

我正在尝试从源代码编译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

感谢您的帮助!

1 个答案:

答案 0 :(得分:1)

问题解决了:我刚尝试使用最新版本的opencv直接从github克隆进行全新安装,安装完美无缺。