Bug 133550

Summary: [GTK] GLContextEGL.cpp: conflicting declaration 'typedef ptrdiff_t GLintptr'
Product: WebKit Reporter: Andrius Štikonas <andrius>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: berto, cgarcia, commit-queue, gnome, pachoramos1, vjaquez, zan
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Other   
OS: Linux   
URL: https://bugs.gentoo.org/show_bug.cgi?id=512224
Attachments:
Description Flags
build.log.xz
none
Patch
none
Patch none

Description Andrius Štikonas 2014-06-05 09:51:22 PDT
Created attachment 232558 [details]
build.log.xz

WebKit-gtk 2.4.3 fails to build on Gentoo Linux (ARM architecture, GCC 4.7.3 was used to compile it).

The error message is:

In file included from /usr/include/GL/gl.h:2085:0,
                 from /usr/include/GL/glx.h:32,
                 from /usr/include/cairo/cairo-gl.h:96,
                 from Source/WebCore/platform/graphics/egl/GLContextEGL.cpp:39:
/usr/include/GL/glext.h:6152:19: error: conflicting declaration 'typedef ptrdiff_t GLintptr'
In file included from Source/WebCore/platform/graphics/egl/GLContextEGL.cpp:32:0:
./Source/ThirdParty/ANGLE/include/GLES2/gl2.h:38:26: error: 'GLintptr' has a previous declaration as 'typedef khronos_intptr_t GLintptr'
In file included from /usr/include/GL/gl.h:2085:0,
                 from /usr/include/GL/glx.h:32,
                 from /usr/include/cairo/cairo-gl.h:96,
                 from Source/WebCore/platform/graphics/egl/GLContextEGL.cpp:39:
/usr/include/GL/glext.h:6153:19: error: conflicting declaration 'typedef ptrdiff_t GLsizeiptr'
In file included from Source/WebCore/platform/graphics/egl/GLContextEGL.cpp:32:0:
./Source/ThirdParty/ANGLE/include/GLES2/gl2.h:39:26: error: 'GLsizeiptr' has a previous declaration as 'typedef khronos_ssize_t GLsizeiptr'

The following features were enabled by the standard Gentoo ebuild
[ebuild  r  U  ] net-libs/webkit-gtk-2.2.6:3/29 [1.10.2-r300:3/3] USE="egl%* geoloc gles2%* gstreamer introspection jit spell webgl (-aqua) -coverage -debug -libsecret% -opengl% {-test}" 0 kB
So it is compiled with EGL and OpenGL ES 2.0 support.
Comment 1 Víctor M. Jáquez L. 2014-06-09 06:25:00 PDT
AFAIK it is not --disable-glx but --enable-glx=no
Comment 2 Alberto Garcia 2014-06-09 06:28:04 PDT
(In reply to comment #1)
> AFAIK it is not --disable-glx but --enable-glx=no

Isn't it equivalent? From the build log:

checking GL/glx.h usability... yes
checking GL/glx.h presence... yes
checking for GL/glx.h... yes
checking whether to enable GLX support... no

checking EGL/egl.h usability... yes
checking EGL/egl.h presence... yes
checking for EGL/egl.h... yes
checking whether to enable EGL support... yes

checking GLES2/gl2.h usability... yes
checking GLES2/gl2.h presence... yes
checking for GLES2/gl2.h... yes
checking whether to use OpenGL ES 2 support... yes
Comment 3 Víctor M. Jáquez L. 2014-06-09 06:31:17 PDT
I spoke too fast:

glx.h is included by cairo-gl.h

Is cairo compiled with glx? What about recompile it only with egl support?
Comment 4 Andrius Štikonas 2014-06-09 06:38:08 PDT
Yes, cairo was compiled with opengl. I think dependencies are incorrectly specified in Gentoo ebuild but I have to double check and recompile.
Comment 5 Andrius Štikonas 2014-06-09 15:44:50 PDT
Ok, I can confirm that webkit-gtk builds if cairo is compiled with egl/gles2 support.
Comment 6 Alberto Garcia 2014-06-11 05:02:39 PDT
(In reply to comment #5)
> Ok, I can confirm that webkit-gtk builds if cairo is compiled with egl/gles2 support.

Thanks, I think we're having the same problem in Debian. We'll investigate and come back here.
Comment 7 Alberto Garcia 2014-06-11 06:07:44 PDT
(In reply to comment #0)

> /usr/include/GL/glext.h:6152:19: error: conflicting declaration 'typedef ptrdiff_t GLintptr'
> ./Source/ThirdParty/ANGLE/include/GLES2/gl2.h:38:26: error: 'GLintptr' has a previous declaration as 'typedef khronos_intptr_t GLintptr'

So the problem is that we are using these two definitions of GLintptr if GLES 2 is enabled.

khronos_intptr_t is a signed long int (Source/ThirdParty/ANGLE/include/KHR/khrplatform.h)

In amd64 there's no problem because ptrdiff_t is also a long int.

However in arm it's a regular int, hence the conflict.
Comment 8 Alberto Garcia 2014-06-11 07:20:20 PDT
Created attachment 232863 [details]
Patch

(In reply to comment #4)
> Yes, cairo was compiled with opengl. I think dependencies are incorrectly specified in Gentoo ebuild but I have to double check and recompile.

Can you try this patch?
Comment 9 Andrius Štikonas 2014-06-11 12:09:58 PDT
ok, this patch works. Just finished compiling.
Comment 10 Alberto Garcia 2014-06-13 05:11:27 PDT
Updating bug title for clarity
Comment 11 Alberto Garcia 2014-06-13 05:21:15 PDT
Created attachment 233042 [details]
Patch

The problem comes because we include cairo-gl.h for the definition of
cairo_egl_device_create().

However that file also includes some definitions from the GLX headers
that conflict with the ones provided by the WebKit GLES2 headers.

Since we don't need any GLX code in that source file we can disable
the inclusion of those functions.
Comment 12 Gustavo Noronha (kov) 2014-06-13 05:35:59 PDT
Comment on attachment 233042 [details]
Patch

Nice.
Comment 13 WebKit Commit Bot 2014-06-13 06:34:09 PDT
Comment on attachment 233042 [details]
Patch

Clearing flags on attachment: 233042

Committed r169935: <http://trac.webkit.org/changeset/169935>
Comment 14 WebKit Commit Bot 2014-06-13 06:34:12 PDT
All reviewed patches have been landed.  Closing bug.
Comment 15 Pacho Ramos 2014-06-16 02:59:45 PDT
Will this fix be included in 2.4.x too?
Comment 16 Víctor M. Jáquez L. 2014-06-16 03:42:18 PDT
(In reply to comment #15)
> Will this fix be included in 2.4.x too?

It is very likely: http://trac.webkit.org/wiki/WebKitGTK/2.4.x
Comment 17 Pacho Ramos 2014-06-16 23:55:32 PDT
Thanks!