Qt fatal error: GLES3/gl3.h: No such file or directory

Qt交叉编译应用后报错:

…/…/…/include/QtGui/…/…/src/gui/opengl/qopengl.h:109:26: fatal error: GLES3/gl3.h: No such file or directory

编译单个应用,我们可以直接填写对应路径来解决,但是这个其实是交叉编译系统配置问题,每一个应用都改会比较麻烦。最佳方式是交叉编译时,就通过统一的配置解决。

处理方法1:

A:platform\framework\qt\qt-everywhere-src-5.12.5\qtbase\mkspecs\linux-aarch64-gnu-g++\qmake.conf
添加OPENGL_ES2参数:

export QT_GPU_LIB=/platform/core/graphics/gpu_um_pub/mali-bifrost/fbdev/mali-g31/aarch64-linux-gnu/lib
export QT_GPU_INC=/platform/core/graphics/gpu_um_pub/mali-bifrost/include

# modifications to linux.conf
QMAKE_AR                = aarch64-linux-gnu-ar cqs
QMAKE_OBJCOPY           = aarch64-linux-gnu-objcopy
QMAKE_NM                = aarch64-linux-gnu-nm -P
QMAKE_STRIP             = aarch64-linux-gnu-strip
QMAKE_INCDIR_OPENGL_ES2 += $$QT_GPU_INC
QMAKE_LIBDIR_OPENGL_ES2 += $$QT_GPU_LIB
QMAKE_LIBS_OPENGL_ES2 += -lGLESv2

处理方法2:

不设置QMAKE_INCDIR_OPENGL_ES2 ,直接放入sysroot目录。
.configure配置时,导出sysroot:

export SYSROOT=out/buildroot/host/usr/aarch64-buildroot-linux-gnu/sysroot

./configure \
		-opensource \
		-confirm-license \
		-extprefix $QT_INSTALL_DIR \
		-sysroot $SYSROOT \
		-xplatform linux-aarch64-gnu-g++ \
		-device-option CROSS_COMPILE=$CROSS_COMPILE \
		...
		

编译时,直接拷贝头文件到sysroot的usr/include目录:

cp   ${MALI_INC_DIR}/*   out/buildroot/host/usr/aarch64-buildroot-linux-gnu/sysroot/usr/include -rf

你可能感兴趣的:(编译,Qt,C++,qt)