Bug 72085 - Impossible build WebKit with glib2-2.31.0
Summary: Impossible build WebKit with glib2-2.31.0
Status: RESOLVED DUPLICATE of bug 69840
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Linux
: P2 Critical
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-10 18:43 PST by Silouck
Modified: 2012-05-26 16:40 PDT (History)
9 users (show)

See Also:


Attachments
Build log from Gentoo (7.38 KB, application/octet-stream)
2012-01-30 21:36 PST, Sharkman
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Silouck 2011-11-10 18:43:52 PST
Hi,

Impossible build WebKit with glib2-2.31.0, please check the output (and i have disabled -Werror...):

In file included from /usr/include/glib-2.0/glib/gasyncqueue.h:34:0,
                 from /usr/include/glib-2.0/glib.h:34,
                 from /usr/include/glib-2.0/gobject/gbinding.h:30,
                 from /usr/include/glib-2.0/glib-object.h:25,
                 from /usr/include/glib-2.0/gio/gioenums.h:30,
                 from /usr/include/glib-2.0/gio/giotypes.h:30,
                 from /usr/include/glib-2.0/gio/gio.h:28,
                 from ../../../Source/JavaScriptCore/wtf/gobject/GOwnPtr.cpp:24:
/usr/include/glib-2.0/glib/gthread.h:51:16: error: 'union' tag used in naming 'struct _GMutex' [-fpermissive]
/usr/include/glib-2.0/glib/gthread.h:58:7: error: 'union' tag used in naming 'struct _GMutex' [-fpermissive]
../../../Source/JavaScriptCore/wtf/gobject/GOwnPtr.cpp: In function 'void WTF::freeOwnedGPtr(T*) [with T = _GCond]':
../../../Source/JavaScriptCore/wtf/gobject/GOwnPtr.cpp:43:9: warning: 'void g_cond_free(GCond*)' is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:277) [-Wdeprecated-declarations]
../../../Source/JavaScriptCore/wtf/gobject/GOwnPtr.cpp:43:24: warning: 'void g_cond_free(GCond*)' is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:277) [-Wdeprecated-declarations]
../../../Source/JavaScriptCore/wtf/gobject/GOwnPtr.cpp: In function 'void WTF::freeOwnedGPtr(T*) [with T = _GMutex]':
../../../Source/JavaScriptCore/wtf/gobject/GOwnPtr.cpp:49:9: warning: 'void g_mutex_free(GMutex*)' is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:273) [-Wdeprecated-declarations]
../../../Source/JavaScriptCore/wtf/gobject/GOwnPtr.cpp:49:25: warning: 'void g_mutex_free(GMutex*)' is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:273) [-Wdeprecated-declarations]
make[1]: *** [obj/release/GOwnPtr.o] Error 1
make[1]: *** Waiting for unfinished jobs....
Comment 1 Matthew Dawkins 2011-11-20 06:46:10 PST
I have this same error and looking at glib/gthread.h I noticed it had the some of the same code as webkit-1.6.1/Source/JavaScriptCore/wtf/gobject/GTypedefs.h
This patch gets me a little further in the build.

--- webkit-1.6.1/Source/JavaScriptCore/wtf/gobject/GTypedefs.h~	2011-09-26 14:54:57.000000000 -0600
+++ webkit-1.6.1/Source/JavaScriptCore/wtf/gobject/GTypedefs.h	2011-11-20 06:30:29.608190397 -0700
@@ -39,7 +39,6 @@
 typedef struct _GAsyncResult GAsyncResult;
 typedef struct _GCancellable GCancellable;
 typedef struct _GCharsetConverter GCharsetConverter;
-typedef struct _GCond GCond;
 typedef struct _GDir GDir;
 typedef struct _GdkAtom* GdkAtom;
 typedef struct _GdkCursor GdkCursor;
@@ -52,7 +51,6 @@
 typedef struct _GHashTable GHashTable;
 typedef struct _GInputStream GInputStream;
 typedef struct _GList GList;
-typedef struct _GMutex GMutex;
 typedef struct _GPatternSpec GPatternSpec;
 typedef struct _GPollableOutputStream GPollableOutputStream;
 typedef struct _GSocketClient GSocketClient;
Comment 2 Matthew Dawkins 2011-11-20 07:24:19 PST
ok to fix the next build error and this seems to be it, to me this makes since, you can only call glib/ headers thru glib.h now.

--- webkit-1.6.1/Source/JavaScriptCore/wtf/gobject/GOwnPtr.h~	2011-09-26 14:54:57.000000000 -0600
+++ webkit-1.6.1/Source/JavaScriptCore/wtf/gobject/GOwnPtr.h	2011-11-20 06:46:08.302440259 -0700
@@ -24,6 +24,7 @@
 
 #if ENABLE(GLIB_SUPPORT)
 
+#include <glib.h>
 #include <algorithm>
 #include <wtf/Assertions.h>
 #include <wtf/Noncopyable.h>
Comment 3 Alexander Færøy 2011-12-18 13:58:11 PST
(In reply to comment #2)

Hello Matthew,

Could you please have a look at our nice introduction on how to submit patches http://www.webkit.org/coding/contributing.html

It explains how to use some fairly nifty scripts for helping you through submitting your patch :)
Comment 4 Sharkman 2012-01-30 21:35:10 PST
I have exactly the same problem building package =x11-libs/qt-webkit-4.8.0 on Gentoo.
Comment 5 Sharkman 2012-01-30 21:36:28 PST
Created attachment 124668 [details]
Build log from Gentoo

Build log from Gentoo package =x11-libs/qt-webkit-4.8.0
Comment 6 Jonathan Hyry 2012-02-01 21:01:05 PST
I have encountered this same issue trying to compile webkit-1.6.1. I am on Slackware 13.37 i686.

I noticed Mathew Dawkins' comment with the diff.... If you modify his diff as follows, webkit should compile normally:

--- webkit-1.6.1/Source/JavaScriptCore/wtf/gobject/GTypedefs.h~    2011-09-26 14:54:57.000000000 -0600
+++ webkit-1.6.1/Source/JavaScriptCore/wtf/gobject/GTypedefs.h    2011-11-20 06:30:29.608190397 -0700
@@ -52,7 +51,6 @@
 typedef struct _GHashTable GHashTable;
 typedef struct _GInputStream GInputStream;
 typedef struct _GList GList;
-typedef struct _GMutex GMutex;
+typedef union  _GMutex GMutex;
 typedef struct _GPatternSpec GPatternSpec;
 typedef struct _GPollableOutputStream GPollableOutputStream;
 typedef struct _GSocketClient GSocketClient;

_GMutex needs to be typedf'ed like this because the definition of a GMutex is as follows, per http://developer.gnome.org/glib/2.31/glib-Threads.html#GMutex:

union _GMutex
{
  /*< private >*/
  gpointer p;
  guint i[2];
};

This appears to be the only problem so far. Though webkit is still compiling (has been for the past 20 minutes), it has not run into any errors/warnings. I will post a follow-up comment if it errors out of the build process.
Comment 7 Rolf S. Arvidson 2012-02-11 13:49:55 PST
(In reply to comment #6)
> I have encountered this same issue trying to compile webkit-1.6.1. I am on Slackware 13.37 i686.
> 
> I noticed Mathew Dawkins' comment with the diff.... If you modify his diff as follows, webkit should compile normally:
> 
> --- webkit-1.6.1/Source/JavaScriptCore/wtf/gobject/GTypedefs.h~    2011-09-26 14:54:57.000000000 -0600
> +++ webkit-1.6.1/Source/JavaScriptCore/wtf/gobject/GTypedefs.h    2011-11-20 06:30:29.608190397 -0700
> @@ -52,7 +51,6 @@
>  typedef struct _GHashTable GHashTable;
>  typedef struct _GInputStream GInputStream;
>  typedef struct _GList GList;
> -typedef struct _GMutex GMutex;
> +typedef union  _GMutex GMutex;
>  typedef struct _GPatternSpec GPatternSpec;
>  typedef struct _GPollableOutputStream GPollableOutputStream;
>  typedef struct _GSocketClient GSocketClient;
> 
> _GMutex needs to be typedf'ed like this because the definition of a GMutex is as follows, per http://developer.gnome.org/glib/2.31/glib-Threads.html#GMutex:
> 
> union _GMutex
> {
>   /*< private >*/
>   gpointer p;
>   guint i[2];
> };
> 
> This appears to be the only problem so far. Though webkit is still compiling (has been for the past 20 minutes), it has not run into any errors/warnings. I will post a follow-up comment if it errors out of the build process.

Jonathan / Matthew: Your suggested fix compiled OK on gentoo, please see comments at https://bugs.gentoo.org/show_bug.cgi?id=401855#c3. Thanks for your help. //Rolf
Comment 8 Maciej Piechotka 2012-02-18 03:56:32 PST
I may be wrong but wouldn't the fix break compiling with <2.31.0 (when GMutex was struct)? I guess the easiest way would be to just include <glib.h> (I don't know the webkit source code but the existence of the header file seems a bit strange).
Comment 9 Yael 2012-05-26 16:40:04 PDT

*** This bug has been marked as a duplicate of bug 69840 ***