GLEW + Qt6: Build error if qtbase has been configured with FEATURE_opengles2 enabled
So I am trying to move VTK 9.2.0 from Qt5 to Qt6 in vcpkg and see the following build error in Linux CI:
[7179/9612] /usr/bin/c++ -DGLEW_STATIC -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_KEYWORDS -DQT_OPENGLWIDGETS_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -Dkiss_fft_scalar=double -DvtkRenderingCore_AUTOINIT_INCLUDE=\"/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/CMakeFiles/vtkModuleAutoInit_be7301261a49b13d6a9b1d9e110eacd8.h\" -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/GUISupport/Qt/GUISupportQt_autogen/include -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/GUISupport/Qt -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/GUISupport/Qt -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Common/Core -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Common/Core -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Rendering/Core -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Rendering/Core -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Common/DataModel -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Common/DataModel -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Common/Math -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Common/Math -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/ThirdParty/kissfft/vtkkissfft -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/ThirdParty/kissfft/vtkkissfft -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Common/Transforms -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Common/Transforms -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Common/ExecutionModel -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Common/ExecutionModel -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Filters/Core -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Filters/Core -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Common/Misc -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Common/Misc -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Rendering/OpenGL2 -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Rendering/OpenGL2 -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Filters/General -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Filters/General -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/IO/Image -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/IO/Image -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Imaging/Core -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Imaging/Core -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Rendering/HyperTreeGrid -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Rendering/HyperTreeGrid -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Rendering/UI -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Rendering/UI -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Interaction/Widgets -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Interaction/Widgets -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Filters/Sources -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Filters/Sources -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Rendering/Context2D -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Rendering/Context2D -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Common/System -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Common/System -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Filters/Extraction -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Filters/Extraction -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Interaction/Style -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Interaction/Style -isystem /mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Utilities/KWIML -isystem /mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Utilities/KWIML -isystem /mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Utilities/KWSys -isystem /mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Utilities/KWSys -isystem /mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/ThirdParty/kissfft -isystem /mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/ThirdParty/kissfft -isystem /mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/ThirdParty/glew -isystem /mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/ThirdParty/glew -isystem /mnt/vcpkg-ci/installed/x64-linux/include -isystem /mnt/vcpkg-ci/installed/x64-linux/include/Qt6/QtOpenGL -isystem /mnt/vcpkg-ci/installed/x64-linux/include/Qt6 -isystem /mnt/vcpkg-ci/installed/x64-linux/include/Qt6/QtCore -isystem /mnt/vcpkg-ci/installed/x64-linux/share/Qt6/mkspecs/linux-g++ -isystem /mnt/vcpkg-ci/installed/x64-linux/include/Qt6/QtGui -isystem /mnt/vcpkg-ci/installed/x64-linux/include/Qt6/QtWidgets -isystem /mnt/vcpkg-ci/installed/x64-linux/include/Qt6/QtOpenGLWidgets -fPIC -g -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -fPIC -ffunction-sections -fdata-sections -std=c++17 -MD -MT GUISupport/Qt/CMakeFiles/GUISupportQt.dir/vtkQWidgetTexture.cxx.o -MF GUISupport/Qt/CMakeFiles/GUISupportQt.dir/vtkQWidgetTexture.cxx.o.d -o GUISupport/Qt/CMakeFiles/GUISupportQt.dir/vtkQWidgetTexture.cxx.o -c /mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/GUISupport/Qt/vtkQWidgetTexture.cxx
FAILED: GUISupport/Qt/CMakeFiles/GUISupportQt.dir/vtkQWidgetTexture.cxx.o
/usr/bin/c++ -DGLEW_STATIC -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_KEYWORDS -DQT_OPENGLWIDGETS_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -Dkiss_fft_scalar=double -DvtkRenderingCore_AUTOINIT_INCLUDE=\"/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/CMakeFiles/vtkModuleAutoInit_be7301261a49b13d6a9b1d9e110eacd8.h\" -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/GUISupport/Qt/GUISupportQt_autogen/include -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/GUISupport/Qt -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/GUISupport/Qt -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Common/Core -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Common/Core -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Rendering/Core -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Rendering/Core -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Common/DataModel -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Common/DataModel -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Common/Math -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Common/Math -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/ThirdParty/kissfft/vtkkissfft -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/ThirdParty/kissfft/vtkkissfft -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Common/Transforms -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Common/Transforms -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Common/ExecutionModel -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Common/ExecutionModel -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Filters/Core -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Filters/Core -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Common/Misc -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Common/Misc -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Rendering/OpenGL2 -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Rendering/OpenGL2 -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Filters/General -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Filters/General -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/IO/Image -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/IO/Image -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Imaging/Core -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Imaging/Core -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Rendering/HyperTreeGrid -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Rendering/HyperTreeGrid -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Rendering/UI -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Rendering/UI -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Interaction/Widgets -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Interaction/Widgets -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Filters/Sources -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Filters/Sources -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Rendering/Context2D -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Rendering/Context2D -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Common/System -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Common/System -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Filters/Extraction -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Filters/Extraction -I/mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Interaction/Style -I/mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Interaction/Style -isystem /mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Utilities/KWIML -isystem /mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Utilities/KWIML -isystem /mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Utilities/KWSys -isystem /mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/Utilities/KWSys -isystem /mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/ThirdParty/kissfft -isystem /mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/ThirdParty/kissfft -isystem /mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/ThirdParty/glew -isystem /mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/ThirdParty/glew -isystem /mnt/vcpkg-ci/installed/x64-linux/include -isystem /mnt/vcpkg-ci/installed/x64-linux/include/Qt6/QtOpenGL -isystem /mnt/vcpkg-ci/installed/x64-linux/include/Qt6 -isystem /mnt/vcpkg-ci/installed/x64-linux/include/Qt6/QtCore -isystem /mnt/vcpkg-ci/installed/x64-linux/share/Qt6/mkspecs/linux-g++ -isystem /mnt/vcpkg-ci/installed/x64-linux/include/Qt6/QtGui -isystem /mnt/vcpkg-ci/installed/x64-linux/include/Qt6/QtWidgets -isystem /mnt/vcpkg-ci/installed/x64-linux/include/Qt6/QtOpenGLWidgets -fPIC -g -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -fPIC -ffunction-sections -fdata-sections -std=c++17 -MD -MT GUISupport/Qt/CMakeFiles/GUISupportQt.dir/vtkQWidgetTexture.cxx.o -MF GUISupport/Qt/CMakeFiles/GUISupportQt.dir/vtkQWidgetTexture.cxx.o.d -o GUISupport/Qt/CMakeFiles/GUISupportQt.dir/vtkQWidgetTexture.cxx.o -c /mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/GUISupport/Qt/vtkQWidgetTexture.cxx
In file included from /mnt/vcpkg-ci/installed/x64-linux/include/Qt6/QtOpenGL/qopenglpaintdevice.h:13,
from /mnt/vcpkg-ci/installed/x64-linux/include/Qt6/QtOpenGL/QOpenGLPaintDevice:1,
from /mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/GUISupport/Qt/vtkQWidgetTexture.cxx:25:
/mnt/vcpkg-ci/installed/x64-linux/include/Qt6/QtGui/qopenglcontext.h:21:2: warning: #warning qopenglfunctions.h is not compatible with GLEW, GLEW defines will be undefined [-Wcpp]
21 | #warning qopenglfunctions.h is not compatible with GLEW, GLEW defines will be undefined
| ^~~~~~~
/mnt/vcpkg-ci/installed/x64-linux/include/Qt6/QtGui/qopenglcontext.h:22:2: warning: #warning To use GLEW with Qt, do not include <qopengl.h> or <QOpenGLFunctions> after glew.h [-Wcpp]
22 | #warning To use GLEW with Qt, do not include <qopengl.h> or <QOpenGLFunctions> after glew.h
| ^~~~~~~
In file included from /mnt/vcpkg-ci/installed/x64-linux/include/Qt6/QtGui/qopengl.h:75,
from /mnt/vcpkg-ci/installed/x64-linux/include/Qt6/QtOpenGL/qopenglpaintdevice.h:12,
from /mnt/vcpkg-ci/installed/x64-linux/include/Qt6/QtOpenGL/QOpenGLPaintDevice:1,
from /mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/GUISupport/Qt/vtkQWidgetTexture.cxx:25:
/mnt/vcpkg-ci/installed/x64-linux/include/GLES2/gl2.h:507:60: error: ‘void __glewActiveTexture(GLenum)’ redeclared as different kind of entity
507 | GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
| ^
In file included from /mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/ThirdParty/glew/vtk_glew.h:42,
from /mnt/vcpkg-ci/buildtrees/vtk/x64-linux-dbg/Rendering/OpenGL2/vtkOpenGLError.h:19,
from /mnt/vcpkg-ci/buildtrees/vtk/src/67209150f8-fa9af939fa.clean/GUISupport/Qt/vtkQWidgetTexture.cxx:21:
/mnt/vcpkg-ci/installed/x64-linux/include/GL/glew.h:22286:40: note: previous declaration ‘void (* __glewActiveTexture)(GLenum)’
22286 | GLEW_FUN_EXPORT PFNGLACTIVETEXTUREPROC __glewActiveTexture;
| ^~~~~~~~~~~~~~~~~~~
(PR https://github.com/microsoft/vcpkg/pull/29078)
Another issues seems to be missing defines of GL_BACK_LEFT
https://gitlab.kitware.com/vtk/vtk/-/blob/master/GUISupport/Qt/QVTKOpenGLWindow.cxx#L267 since nobody seems to pull in the required GL/gl.h header.
To see the error qtbase needs to be build with -DFEATURE_opengles2=ON -DINPUT_opengl='es2' -DFEATURE_opengl_desktop=OFF
Edited by Alexander Neumann