Bug #63705 Build fails with #error "Only <glib.h> can be included directly"
Submitted: 10 Dec 2011 9:39 Modified: 14 Aug 2012 19:16
Reporter: Remi Collet (OCA) Email Updates:
Status: Closed Impact on me:
Category:MySQL Workbench Severity:S2 (Serious)
Version:5.2.41 OS:Linux (Fedora 17)
Assigned to: CPU Architecture:Any
Tags: Contribution

[10 Dec 2011 9:39] Remi Collet
With latest glib 2.31 on fedora rawhide (will be fedora 17) build fails.

For example, in glib/gthread.h 
#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
#error "Only <glib.h> can be included directly."

How to repeat:

Suggested fix:
Should use
#include <glib.h>

Patch proposal will come soon
[10 Dec 2011 9:52] Remi Collet
Patch for latest glib2

Attachment: mw-glib2.patch (text/x-patch), 3.51 KiB.

[10 Dec 2011 10:42] Remi Collet
The build also raises a lot lot of deprecated warning.

GMutex* g_mutex_new()' is deprecated 
GCond* g_cond_new()' is deprecated
void g_mutex_free(GMutex*)' is deprecated
gint g_strcasecmp(const gchar*, const gchar*)' is deprecated
void g_static_rec_mutex_init(GStaticRecMutex*)' is deprecated Use 'g_rec_mutex_init' instead

You can see the full fedora 17 build log at:
[10 Dec 2011 12:30] Valeriy Kravchuk
Thank you for the problem report and patch contributed.
[27 Mar 2012 10:50] Dmitry Smirnov
5.2.38 patch for FTBFS with glib-2.32

Attachment: glib-single-include.patch (text/x-diff), 2.90 KiB.

[27 Mar 2012 10:54] Dmitry Smirnov
We have the same problem with glib 2.32 and M-W 5.2.38 on Debian.

Patch for 5.2.38 is attached. 
[27 Mar 2012 20:04] Philip Olson
Fixed as of 5.2.39, and the changelog entry is as follows:

Workbench would not build with GLib 2.3x+, as only glib.h can be included directly.
[17 Apr 2012 5:39] Hans de Graaff
It looks like this isn't fully fixed in 5.2.39, see our bug report downstream: https://bugs.gentoo.org/show_bug.cgi?id=412265

Indeed the 5.2.39 release still contains references to <glib/gthread.h>
[17 Apr 2012 5:43] Remi Collet
Yes, I confirm that the same fix is still to build 5.2.38 or 5.2.39
[11 Aug 2012 7:45] Remi Collet
Bug still present in 5.2.41
[11 Aug 2012 7:52] Remi Collet

Attachment: mysql-workbench-5.2.41-glib.patch (application/x-awk, text), 655 bytes.

[11 Aug 2012 8:01] Remi Collet
[14 Aug 2012 19:16] Alfredo Kojima
This fix didn't make into 5.2.42, but is already committed for version 5.2.43.
Sorry about that.