Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

definition of GLsizeiptr is inconsistent with Khronos gl32.h on armel and armhf #403

Open
drew-parsons opened this issue Nov 30, 2023 · 1 comment

Comments

@drew-parsons
Copy link

glew defines GLsizeiptr as ptrdiff_t in /usr/include/GL/glew.h, from

typedef ptrdiff_t GLsizeiptr

This definition is inconsistent with the gles3.2 definition, which is

typedef khronos_ssize_t GLsizeiptr;

from https://gitlab.freedesktop.org/glvnd/libglvnd/-/blame/master/include/GLES3/gl32.h#L56

The discrepancy causes a build error on armel (gnueabi) and armhf. The problem was reported against debian packages at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=798408

It is triggered for instance by packages using QtOpenGL on armel or armhf while also accessing glew. For example, building avogadrolibs on armel gives the error

[ 97%] Building CXX object avogadro/qtplugins/cp2kinput/CMakeFiles/Cp2kInput.dir/Cp2kInputPlugin.cpp.o
cd /build/avogadrolibs-1.98.1/obj-arm-linux-gnueabi/avogadro/qtplugins/cp2kinput && /usr/bin/c++ -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_STATICPLUGIN -DQT_WIDGETS_LIB -I/build/avogadrolibs-1.98.1/obj-arm-linux-gnueabi/avogadro/qtplugins/cp2kinput -I/build/avogadrolibs-1.98.1/avogadro/qtplugins/cp2kinput -I/build/avogadrolibs-1.98.1/obj-arm-linux-gnueabi/avogadro/qtplugins/cp2kinput/Cp2kInput_autogen/include -I/build/avogadrolibs-1.98.1/avogadro -I/build/avogadrolibs-1.98.1/obj-arm-linux-gnueabi/avogadro -I/build/avogadrolibs-1.98.1 -I/build/avogadrolibs-1.98.1/obj-arm-linux-gnueabi -I/build/avogadrolibs-1.98.1/obj-arm-linux-gnueabi/avogadro/qtgui -I/buildavogadrolibs-1.98.1/obj-arm-linux-gnueabi/avogadro/io -I/build/avogadrolibs-1.98.1/obj-arm-linux-gnueabi/avogadro/core -I/build/avogadrolibs-1.98.1/obj-arm-linux-gnueabi/avogadro/molequeue -isystem /usr/include/eigen3 -isystem /usr/include/arm-linux-gnueabi/qt5 -isystem /usr/include/arm-linux-gnueabi/qt5/QtWidgets -isystem /usr/include/arm-linux-gnueabi/qt5/QtGui -isystem /usr/include/arm-linux-gnueabi/qt5/QtCore -isystem /usr/lib/arm-linux-gnueabi/qt5/mkspecs/linux-g++ -isystem /usr/include/arm-linux-gnueabi/qt5/QtNetwork -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -g -O2 -ffile-prefix-map=/build/avogadrolibs-1.98.1=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Wno-deprecated-declarations -std=c++17 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -fPIC -MD -MT avogadro/qtplugins/cp2kinput/CMakeFiles/Cp2kInput.dir/Cp2kInputPlugin.cpp.o -MF CMakeFiles/Cp2kInput.dir/Cp2kInputPlugin.cpp.o.d -o CMakeFiles/Cp2kInput.dir/Cp2kInputPlugin.cpp.o -c /build/avogadrolibs-1.98.1/obj-arm-linux-gnueabi/avogadro/qtplugins/cp2kinput/Cp2kInputPlugin.cpp
In file included from /usr/include/arm-linux-gnueabi/qt5/QtGui/qopengl.h:105,
                 from /usr/include/arm-linux-gnueabi/qt5/QtWidgets/qopenglwidget.h:49,
                 from /usr/include/arm-linux-gnueabi/qt5/QtWidgets/QOpenGLWidget:1,
                 from /build/avogadrolibs-1.98.1/avogadro/qtopengl/glwidget.h:16,
                 from /build/avogadrolibs-1.98.1/avogadro/qtplugins/overlayaxes/overlayaxes.cpp:14:
/usr/include/GLES3/gl32.h:56:25: error: conflicting declaration 'typedef khronos_ssize_t GLsizeiptr'
   56 | typedef khronos_ssize_t GLsizeiptr;
      |                         ^~~~~~~~~~
In file included from /build/avogadrolibs-1.98.1/avogadro/rendering/avogadrogl.h:15,
                 from /build/avogadrolibs-1.98.1/avogadro/qtplugins/overlayaxes/overlayaxes.cpp:8:
/usr/include/GL/glew.h:1694:19: note: previous declaration as 'typedef ptrdiff_t GLsizeiptr'
 1694 | typedef ptrdiff_t GLsizeiptr;
      |                   ^~~~~~~~~~
/usr/include/GLES3/gl32.h:57:26: error: conflicting declaration 'typedef khronos_intptr_t GLintptr'
   57 | typedef khronos_intptr_t GLintptr;
      |                          ^~~~~~~~
/usr/include/GL/glew.h:1693:19: note: previous declaration as 'typedef ptrdiff_t GLintptr'
 1693 | typedef ptrdiff_t GLintptr;
      |                   ^~~~~~~~
/usr/include/GLES3/gl32.h:507:60: error: 'void __glewActiveTexture(GLenum)' redeclared as different kind of entity
  507 | GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
      |                                                            ^
/usr/include/GL/glew.h:22286:40: note: previous declaration 'void (* __glewActiveTexture)(GLenum)'
22286 | GLEW_FUN_EXPORT PFNGLACTIVETEXTUREPROC __glewActiveTexture;
      |                                        ^~~~~~~~~~~~~~~~~~~
@nigels-com
Copy link
Owner

nigels-com commented Nov 30, 2023

Generally speaking it's not expected that both GLEW and OpenGL headers can both be included for a given compilation unit.

My first impression is that glew.h ought to be guarding with __gles2_gl32_h_ in the same manner as it is for __gl_h_.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants