Menu

#28 conflicting types for 'GLsizeiptr' on 32-bit-architectures

POGL 0.xx
fixed-in-git
nobody
None
5
2025-05-11
2019-02-13
Florian
No

In Debian unstable, we've started to see build failures on 32-bit-architectures from December 2018, like so:

i686-linux-gnu-gcc -c  -I/usr/include -I/usr/include -I/usr/local/include -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -g -O2 -ffile-prefix-map=/build/libopengl-perl-0.7000+dfsg=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -DVERSION=\"0.70\" -DXS_VERSION=\"0.70\" -fPIC "-I/usr/lib/i386-linux-gnu/perl/5.28/CORE"  -DHAVE_VER -DHAVE_GL -DHAVE_GLU -DHAVE_GLUT -DHAVE_GLX -DHAVE_FREEGLUT -DHAVE_FREEGLUT_H -DGL_GLEXT_LEGACY OpenGL.c
In file included from glext_procs.h:3,
                 from gl_util.h:22,
                 from OpenGL.xs:60:
/usr/include/GL/glext.h:468:25: error: conflicting types for 'GLsizeiptr'
 typedef khronos_ssize_t GLsizeiptr;
                         ^~~~~~~~~~
In file included from gl_util.h:20,
                 from OpenGL.xs:60:
glext_types.h:67:19: note: previous declaration of 'GLsizeiptr' was here
 typedef ptrdiff_t GLsizeiptr;
                   ^~~~~~~~~~
In file included from glext_procs.h:3,
                 from gl_util.h:22,
                 from OpenGL.xs:60:
/usr/include/GL/glext.h:469:26: error: conflicting types for 'GLintptr'
 typedef khronos_intptr_t GLintptr;
                          ^~~~~~~~
In file included from gl_util.h:20,
                 from OpenGL.xs:60:
glext_types.h:68:19: note: previous declaration of 'GLintptr' was here
 typedef ptrdiff_t GLintptr;
                   ^~~~~~~~
In file included from glext_procs.h:3,
                 from gl_util.h:22,
                 from OpenGL.xs:60:
/usr/include/GL/glext.h:11115:18: error: conflicting types for 'GLvdpauSurfaceNV'
 typedef GLintptr GLvdpauSurfaceNV;
                  ^~~~~~~~~~~~~~~~
In file included from gl_util.h:20,
                 from OpenGL.xs:60:
glext_types.h:589:18: note: previous declaration of 'GLvdpauSurfaceNV' was here
 typedef GLintptr GLvdpauSurfaceNV;
                  ^~~~~~~~~~~~~~~~
make[1]: *** [Makefile:413: OpenGL.o] Error 1

In an attempt to fix this, we're now running utils/glext_procs.pl on the system /usr/include/GL/glext.h (from mesa 18.3.3) before the build, however this results in another error

In file included from gl_util.h:20,
                 from gl_util.c:2:
glext_types.h:65:9: error: unknown type name khronos_ssize_t
 typedef khronos_ssize_t GLsizeiptr;
         ^~~~~~~~~~~~~~~
glext_types.h:66:9: error: unknown type name khronos_intptr_t
 typedef khronos_intptr_t GLintptr;
         ^~~~~~~~~~~~~~~~

Apparently there's an #include <KHR/khrplatform.h> in glext.h that glext_procs.pl fails to copy to glext_types.h. This can be fixed with a small change:

--- a/utils/glext_procs.pl
+++ b/utils/glext_procs.pl
+@@ -123,7 +123,7 @@

+         print EXTS $line2;
+         $in_TYPES-- if $in_TYPES == 1 and $line2 !~ m|^typedef|;
+         print TYPE $line2 if $in_TYPES;
+-        print TYPE $line2 if !$in_TYPES and $line2 =~ m|^typedef \w+ \w+;|;
++        print TYPE $line2 if !$in_TYPES and ($line2 =~ m|^typedef \w+ \w+;| or $line2 =~ m|^#include|);
+ 
+         if ($line2 =~ m|APIENTRY (gl[^\s]+)|)
+         {

Discussion

  • gregor herrmann

    gregor herrmann - 2019-10-07

    This doesn't seem to work anymore with mesa 19.x; an updated patch is available at the Debian packaging repo.

     
  • mohawk

    mohawk - 2025-05-11
    • status: open --> fixed-in-git
     

Log in to post a comment.

MongoDB Logo MongoDB