GNOME Bugzilla – Bug 774891
Mutter master fails to compile with GLsizeiptr
Last modified: 2017-04-18 10:40:04 UTC
Hi It seems that when I compile Mutter master I get an error involving mesa I am compiling mutter with ./autogen.sh --prefix=$INSTALLDIR --libdir=$INSTALLDIR/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH) --enable-compile-warnings=yes --with-xwayland-path=$INSTALLDIR/bin/Xwayland --disable-Werror and then tried to add --enable-egl-device=yes CC driver/gl/cogl-buffer-gl.lo CC driver/gl/cogl-pipeline-opengl.lo CC driver/gl/cogl-pipeline-fragend-glsl.lo CC driver/gl/gl/cogl-pipeline-fragend-arbfp.lo In file included from driver/gl/cogl-texture-2d-gl.c:50:0: /opt/include/GLES2/gl2.h:73:25: error: conflicting types for ‘GLsizeiptr’ typedef khronos_ssize_t GLsizeiptr; ^ In file included from /opt/include/GL/gl.h:2055:0, from ./cogl-gl-header.h:41, from ./cogl-sampler-cache-private.h:35, from ./cogl-pipeline-layer-private.h:44, from ./cogl-pipeline-private.h:38, from ./cogl-texture-private.h:36, from driver/gl/cogl-texture-2d-gl.c:40: /opt/include/GL/glext.h:468:19: note: previous declaration of ‘GLsizeiptr’ was here typedef ptrdiff_t GLsizeiptr; ^ In file included from driver/gl/cogl-texture-2d-gl.c:50:0: /opt/include/GLES2/gl2.h:74:26: error: conflicting types for ‘GLintptr’ typedef khronos_intptr_t GLintptr; ^ In file included from /opt/include/GL/gl.h:2055:0, from ./cogl-gl-header.h:41, from ./cogl-sampler-cache-private.h:35, from ./cogl-pipeline-layer-private.h:44, from ./cogl-pipeline-private.h:38, from ./cogl-texture-private.h:36, from driver/gl/cogl-texture-2d-gl.c:40: /opt/include/GL/glext.h:469:19: note: previous declaration of ‘GLintptr’ was here typedef ptrdiff_t GLintptr; ^ In file included from driver/gl/cogl-texture-2d-gl.c:50:0: /opt/include/GLES2/gl2.h:393:28: error: conflicting types for ‘PFNGLBUFFERDATAPROC’ typedef void (GL_APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage); ^ In file included from /opt/include/GL/gl.h:2055:0, from ./cogl-gl-header.h:41, from ./cogl-sampler-cache-private.h:35, from ./cogl-pipeline-layer-private.h:44, from ./cogl-pipeline-private.h:38, from ./cogl-texture-private.h:36, from driver/gl/cogl-texture-2d-gl.c:40: /opt/include/GL/glext.h:532:25: note: previous declaration of ‘PFNGLBUFFERDATAPROC’ was here typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage); ^ In file included from driver/gl/cogl-texture-2d-gl.c:50:0: /opt/include/GLES2/gl2.h:394:28: error: conflicting types for ‘PFNGLBUFFERSUBDATAPROC’ typedef void (GL_APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data); ^ In file included from /opt/include/GL/gl.h:2055:0, from ./cogl-gl-header.h:41, from ./cogl-sampler-cache-private.h:35, from ./cogl-pipeline-layer-private.h:44, from ./cogl-pipeline-private.h:38, from ./cogl-texture-private.h:36, from driver/gl/cogl-texture-2d-gl.c:40: /opt/include/GL/glext.h:533:25: note: previous declaration of ‘PFNGLBUFFERSUBDATAPROC’ was here typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data); ^ Makefile:1346: recipe for target 'driver/gl/cogl-texture-2d-gl.lo' failed make[6]: *** [driver/gl/cogl-texture-2d-gl.lo] Error 1 make[6]: *** Waiting for unfinished jobs.... make[6]: Leaving directory '/srcbuild/mutter/cogl/cogl' Makefile:1519: recipe for target 'all-recursive' failed make[5]: *** [all-recursive] Error 1 make[5]: Leaving directory '/srcbuild/mutter/cogl/cogl' Makefile:999: recipe for target 'all' failed make[4]: *** [all] Error 2 make[4]: Leaving directory '/srcbuild/mutter/cogl/cogl' Makefile:510: recipe for target 'all-recursive' failed make[3]: *** [all-recursive] Error 1 make[3]: Leaving directory '/srcbuild/ Thanks
*** Bug 775084 has been marked as a duplicate of this bug. ***
Could I have a configuration problem? I am noticing more software I am trying to compile end up with errors involving these Mesa headers...
This is my mutter-cogl output mutter: Build libcogl-gles2 GLES 2.0 frontend api: no mutter: Image backend: gdk-pixbuf mutter: Cogl Pango: yes mutter: Cogl Path: yes mutter: mutter: • Build options: mutter: Debugging: yes mutter: Profiling: no mutter: Enable deprecated symbols: no mutter: Compiler flags: -Os -DCOGL_GL_DEBUG -DCOGL_OBJECT_DEBUG -DCOGL_ENABLE_DEBUG -Wall -Wcast-align -Wformat -Wformat-security -Werror=uninitialized -Werror=empty-body -Werror=init-self -Werror=undef -Werror=declaration-after-statement -Werror=vla -Werror=pointer-arith -Werror=missing-declarations -Werror=maybe-uninitialized -Wno-error=sign-compare -DG_DISABLE_DEPRECATED -DG_DISABLE_SINGLE_INCLUDES mutter: Linker flags: mutter: mutter: • Extra: mutter: Build introspection data: yes mutter: Build unit tests: yes and this is my mutter-clutter/mutter-mutter output mutter: mutter: Clutter - 1.26.1 (git) mutter: mutter: • Global: mutter: Prefix: /opt mutter: Libdir: /opt/lib/i386-linux-gnu mutter: Sysconfdir: ${prefix}/etc mutter: mutter: • Compiler options: mutter: Clutter debug level: minimum mutter: Compiler flags: -Os -Wall -Wcast-align -Wuninitialized -Wno-strict-aliasing -Wshadow mutter: Enable coverage tests: no mutter: Enable deprecated symbols: yes mutter: mutter: • Extra: mutter: Build introspection data: yes mutter: Build X11-specific tests: yes mutter: Build tests using GDK-Pixbuf: yes mutter: Install test suites: mutter: Build examples: no mutter: mutter: • Clutter Backends: mutter: Windowing systems: x11 egl mutter: Input backends: x11 evdev mutter: mutter: - X11 backend options: mutter: Enabled extensions: xext xdamage xcomposite xtst xge xi2.2 xkb mutter: mutter: - Wayland compositor support enabled mutter: mutter: mutter: mutter-3.23.2 mutter: mutter: prefix: /opt mutter: source code location: . mutter: compiler: gcc mutter: mutter: Startup notification: yes mutter: libcanberra: yes mutter: libwacom: yes mutter: gudev yes mutter: Introspection: yes mutter: Session management: yes mutter: Wayland: yes mutter: Native (KMS) backend: yes mutter: EGLDevice: no mutter: I hope this is helpful?
Created attachment 341251 [details] [review] cogl: Do not unconditionally include GLES2 headers when EGL is available EGL doesn't necessarily imply GLES2, so we may end up including both GL and GLES headers with conflicting type definitions, so be a bit more picky about what we include under which conditions. I checked that the attached patch fixes the build issue on 32 bit systems, but it may completely bork nvidia's snowflake driver ...
Review of attachment 341251 [details] [review]: I suspect this will break EGLDevice support, as we AFAIK don't enable GLES2 in cogl without adding some argument to ./configure. IIRC the EGLDevice path will still use OpenGL and not GLES2 but still use the GL_TEXTURE_EXTERNAL_OES which is defined by GLES/GLES2.
Created attachment 341268 [details] [review] cogl: Do not include both GLES2 and GL headers I feared as much. This is really really ugly, but hopefully will make both compilers and nvidia happy ...
Review of attachment 341268 [details] [review]: Yea, works for me. ::: cogl/cogl/driver/gl/cogl-texture-2d-gl.c @@ +54,3 @@ + */ +# define GL_TEXTURE_EXTERNAL_OES 0x8D65 +# endif Ugh, indented macros? :(
(In reply to Jonas Ådahl from comment #7) > Ugh, indented macros? :( Well, I can remove the indentation, but then we end up with nested macros :(
(In reply to Florian Müllner from comment #8) > (In reply to Jonas Ådahl from comment #7) > > Ugh, indented macros? :( > > Well, I can remove the indentation, but then we end up with nested macros :( Some quick greps shows we have three different styles regarding this, so.. oh well, I don't know :P
(In reply to Jonas Ådahl from comment #9) > Some quick greps shows we have three different styles regarding this, so.. > oh well, I don't know :P Oh, I may be able to come up with a fourth style?
Attachment 341268 [details] pushed as 71077d5 - cogl: Do not include both GLES2 and GL headers
That got it to compile!
Created attachment 341655 [details] [review] cogl: Just define the needed GLES2 extension ourself We need a GLES2 extension macro in cogl-texture-2d-gl.c, but we can't include GLES2/gl2ext.h because it will conflict with things in GL/glext.h. We can't rely on cogl including anything for us since it'd only include GLES2/gl2ext.h if OpenGL support was explicitly disabled.
Review of attachment 341655 [details] [review]: OK
Comment on attachment 341655 [details] [review] cogl: Just define the needed GLES2 extension ourself Attachment 341655 [details] pushed as 5a43cc5 - cogl: Just define the needed GLES2 extension ourself
I hit a similar problem today while building mutter 3.22 (the tip of the gnome-3-22 branch) with the internal cogl configured to use the GLES2 driver (I'm building against mesa 13 gles2 header files), using the following configuration parameters: ./configure \ --disable-option-checking \ --prefix=/usr \ --build=arm-linux-gnueabihf \ --includedir=/usr/include \ --mandir=/usr/share/man \ --infodir=/usr/share/info \ --sysconfdir=/etc \ --localstatedir=/var \ --disable-silent-rules \ --libdir=/usr/lib/arm-linux-gnueabihf \ --libexecdir=/usr/lib/arm-linux-gnueabihf \ --disable-maintainer-mode \ --disable-dependency-tracking \ --libexecdir=/usr/lib/mutter \ --enable-startup-notification \ --enable-compile-warnings \ --disable-native-backend \ --disable-wayland \ --disable-wayland-egl-server \ --disable-gl \ --enable-gles2=yes \ --enable-cogl-gles2=yes \ --with-default-driver=gles2 \ --enable-kms-egl-platform=yes The error I got was in compositor/meta-sync-ring.c, though, and looks like this: [...] /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -DCLUTTER_ENABLE_COMPOSITOR_API -DCLUTTER_ENABLE_EXPERIMENTAL_API -DCOGL_ENABLE_EXPERIMENTAL_API -DCOGL_ENABLE_EXPERIMENTAL_2_0_API -DCOGL_ENABLE_MUTTER_API -DCLUTTER_DISABLE_DEPRECATION_WARNINGS -DCOGL_DISABLE_DEPRECATION_WARNINGS -pthread -D_REENTRANT -pthread -I/usr/include/json-glib-1.0 -I/usr/include/libupower-glib -I/usr/include/gnome-desktop-3.0 -I/usr/include/uuid -I/usr/include/startup-notification-1.0 -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/arm-linux-gnueabihf/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/libdrm -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/libwacom-1.0 -I/usr/include/gudev-1.0 -I/usr/include/gobject-introspection-1.0 -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -I/usr/include/eosmetrics-0 -I/usr/include/gsettings-desktop-schemas -I. -I. -I./backends -I./core -I./ui -I./compositor -I../cogl -I../cogl/cogl -I../cogl/cogl/winsys -I../cogl/cogl -I../cogl -I../clutter -I../clutter/clutter -I../clutter -I../clutter/clutter -DMUTTER_LIBEXECDIR=\"/usr/lib/mutter\" -DMUTTER_LOCALEDIR=\"/usr/share/locale\" -DMUTTER_PKGDATADIR=\"/usr/share/mutter\" -DMUTTER_DATADIR=\"/usr/share\" -DG_LOG_DOMAIN=\"mutter\" -DSN_API_NOT_YET_FROZEN=1 -DMUTTER_PKGLIBDIR=\"/usr/lib/arm-linux-gnueabihf/mutter\" -DMUTTER_PLUGIN_DIR=\"/usr/lib/arm-linux-gnueabihf/mutter/plugins\" -DGETTEXT_PACKAGE=\"mutter\" -DXWAYLAND_PATH=\"/usr/bin/Xwayland\" -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wall -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wsign-compare -c -o compositor/meta-sync-ring.lo compositor/meta-sync-ring.c libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -DCLUTTER_ENABLE_COMPOSITOR_API -DCLUTTER_ENABLE_EXPERIMENTAL_API -DCOGL_ENABLE_EXPERIMENTAL_API -DCOGL_ENABLE_EXPERIMENTAL_2_0_API -DCOGL_ENABLE_MUTTER_API -DCLUTTER_DISABLE_DEPRECATION_WARNINGS -DCOGL_DISABLE_DEPRECATION_WARNINGS -pthread -D_REENTRANT -pthread -I/usr/include/json-glib-1.0 -I/usr/include/libupower-glib -I/usr/include/gnome-desktop-3.0 -I/usr/include/uuid -I/usr/include/startup-notification-1.0 -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/arm-linux-gnueabihf/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/libdrm -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/libwacom-1.0 -I/usr/include/gudev-1.0 -I/usr/include/gobject-introspection-1.0 -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -I/usr/include/eosmetrics-0 -I/usr/include/gsettings-desktop-schemas -I. -I. -I./backends -I./core -I./ui -I./compositor -I../cogl -I../cogl/cogl -I../cogl/cogl/winsys -I../cogl/cogl -I../cogl -I../clutter -I../clutter/clutter -I../clutter -I../clutter/clutter -DMUTTER_LIBEXECDIR=\"/usr/lib/mutter\" -DMUTTER_LOCALEDIR=\"/usr/share/locale\" -DMUTTER_PKGDATADIR=\"/usr/share/mutter\" -DMUTTER_DATADIR=\"/usr/share\" -DG_LOG_DOMAIN=\"mutter\" -DSN_API_NOT_YET_FROZEN=1 -DMUTTER_PKGLIBDIR=\"/usr/lib/arm-linux-gnueabihf/mutter\" -DMUTTER_PLUGIN_DIR=\"/usr/lib/arm-linux-gnueabihf/mutter/plugins\" -DGETTEXT_PACKAGE=\"mutter\" -DXWAYLAND_PATH=\"/usr/bin/Xwayland\" -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wall -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wsign-compare -c compositor/meta-sync-ring.c -fPIC -DPIC -o compositor/.libs/meta-sync-ring.o In file included from ../cogl/cogl/cogl-gl-header.h:41:0, from ../cogl/cogl/cogl-gles2.h:69, from ../cogl/cogl/winsys/cogl-winsys-private.h:36, from ../cogl/cogl/cogl-renderer-private.h:37, from ../cogl/cogl/cogl-mutter.h:41, from ../cogl/cogl/cogl.h:93, from compositor/meta-sync-ring.c:37: /usr/include/GLES2/gl2.h:73:25: error: conflicting types for 'GLsizeiptr' typedef khronos_ssize_t GLsizeiptr; ^ In file included from /usr/include/GL/gl.h:2055:0, from compositor/meta-sync-ring.c:33: /usr/include/GL/glext.h:468:19: note: previous declaration of 'GLsizeiptr' was here typedef ptrdiff_t GLsizeiptr; ^ In file included from ../cogl/cogl/cogl-gl-header.h:41:0, from ../cogl/cogl/cogl-gles2.h:69, from ../cogl/cogl/winsys/cogl-winsys-private.h:36, from ../cogl/cogl/cogl-renderer-private.h:37, from ../cogl/cogl/cogl-mutter.h:41, from ../cogl/cogl/cogl.h:93, from compositor/meta-sync-ring.c:37: /usr/include/GLES2/gl2.h:74:26: error: conflicting types for 'GLintptr' typedef khronos_intptr_t GLintptr; ^ In file included from /usr/include/GL/gl.h:2055:0, from compositor/meta-sync-ring.c:33: /usr/include/GL/glext.h:469:19: note: previous declaration of 'GLintptr' was here typedef ptrdiff_t GLintptr; ^ In file included from ../cogl/cogl/cogl-gl-header.h:41:0, from ../cogl/cogl/cogl-gles2.h:69, from ../cogl/cogl/winsys/cogl-winsys-private.h:36, from ../cogl/cogl/cogl-renderer-private.h:37, from ../cogl/cogl/cogl-mutter.h:41, from ../cogl/cogl/cogl.h:93, from compositor/meta-sync-ring.c:37: /usr/include/GLES2/gl2.h:393:28: error: conflicting types for 'PFNGLBUFFERDATAPROC' typedef void (GL_APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage); ^ In file included from /usr/include/GL/gl.h:2055:0, from compositor/meta-sync-ring.c:33: /usr/include/GL/glext.h:532:25: note: previous declaration of 'PFNGLBUFFERDATAPROC' was here typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage); ^ In file included from ../cogl/cogl/cogl-gl-header.h:41:0, from ../cogl/cogl/cogl-gles2.h:69, from ../cogl/cogl/winsys/cogl-winsys-private.h:36, from ../cogl/cogl/cogl-renderer-private.h:37, from ../cogl/cogl/cogl-mutter.h:41, from ../cogl/cogl/cogl.h:93, from compositor/meta-sync-ring.c:37: /usr/include/GLES2/gl2.h:394:28: error: conflicting types for 'PFNGLBUFFERSUBDATAPROC' typedef void (GL_APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data); ^ In file included from /usr/include/GL/gl.h:2055:0, from compositor/meta-sync-ring.c:33: /usr/include/GL/glext.h:533:25: note: previous declaration of 'PFNGLBUFFERSUBDATAPROC' was here typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data); ^ Makefile:2001: recipe for target 'compositor/meta-sync-ring.lo' failed make[4]: *** [compositor/meta-sync-ring.lo] Error 1 make[4]: Leaving directory '/home/mario/shell-rebase/mutter/src' I've investigated this for a while with Carlos Garnacho and I could not figure out yet how to fix it, as he seems not to be able to reproduce it in his local setup, which puzzles me a bit, as I can reproduce it both locally and in our (Endless) ARM build server all the time. I will continue investigating this tomorrow, but I'm posting this here for now, in case anyone might have some insight on why the GL and GLES2 are getting included at the same time for me but not for Carlos, and/or how I could fix this on top of gnome-3-22. Thanks in advance!
(In reply to Mario Sánchez Prada from comment #16) > > in case anyone might have some insight on why the GL and GLES2 are > getting included at the same time for me but not for Carlos Are you sure both don't get included for Carlos? Those compilation errors only showed up on 32bit systems, as the different type definitions are compatible on 64bit. (Given that last week's 3.22.4 built fine on all Fedora architectures suggests that the original issue of accidentally including GLES is fixed, and that you are now seeing the opposite case of accidental GL includes ...)
(In reply to Florian Müllner from comment #17) > (In reply to Mario Sánchez Prada from comment #16) > > > > in case anyone might have some insight on why the GL and GLES2 are > > getting included at the same time for me but not for Carlos > > Are you sure both don't get included for Carlos? Those compilation errors They do, meta-sync-ring.c includes both gl.h directly, and gles headers through cogl.h when compiled with GLES support. > only showed up on 32bit systems, as the different type definitions are > compatible on 64bit. This could well be.
Oh, that makes sense. I guess that explains the difference between Carlos's and my setup as I'm building on a 32-bit armv7l machine, and Carlos was probably building in his own laptop. I'll keep looking into this today then.