By default, Bugzilla does not search the list of RESOLVED bugs.
You can force it to do so by putting the upper-case word ALL in front of your search query, e.g.: ALL tdelibs
We recommend searching for bugs this way, as you may discover that your bug has already been resolved and fixed in a later release.
Bug 1063 - Build issue: #error "Only <glib.h> can be included directly."
Summary: Build issue: #error "Only <glib.h> can be included directly."
Status: RESOLVED FIXED
Alias: None
Product: TDE
Classification: Unclassified
Component: other (any) (show other bugs)
Version: R14.0.0 [Trinity]
Hardware: All Linux
: P5 blocker
Assignee: Timothy Pearson
URL:
Depends on:
Blocks:
 
Reported: 2012-06-22 14:22 CDT by David C. Rankin
Modified: 2012-09-18 14:39 CDT (History)
3 users (show)

See Also:
Compiler Version:
TDE Version String:
Application Version:
Application Name:


Attachments
gtk-qt-engine glib.h patch (295 bytes, patch)
2012-06-22 14:22 CDT, David C. Rankin
Details | Diff
glib2 patch for kmplayer (350 bytes, patch)
2012-06-28 11:10 CDT, Darrell
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David C. Rankin 2012-06-22 14:22:05 CDT
Created attachment 692 [details]
gtk-qt-engine glib.h patch

Upstream glib changes have changed the allowable header inclusion scheme replacing the old '#include <glib/whatever.h>' simply with '#include <glib.h>. This bug will identify the affected header files and collect patches for pushing. The first gtk-qt-engine patch is included for reference. If we can do this with set globally, let me know. We may also need to add preprocessor directive to check glib version to allow dynamic implementation of fixes.
Comment 1 Darrell 2012-06-22 16:20:07 CDT
Added "Build issue" to Summary for easier identification and querying.

Which version of glib introduces this quirk?
Comment 2 Darrell 2012-06-27 22:05:57 CDT
On Slackware Current I have glib2 2.28.6 installed. A quick grep of the sources shows numerous "Only <glib.h> can be included directly." messages. Yet I don't see the build failure.

Looking at glist.h:

#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
#error "Only <glib.h> can be included directly."
#endif

Those three variable definitions determine whether the error message occurs.

Browsing around the web indicates glib2 2.31 is the cutoff for these failures, despite the same error message appearing in earlier versions.

Initially I thought we probably needed something like this for each patch:

#if GLIB_MAJOR_VERSION > 2 || ( GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION >= 31)
#include <glib.h>
#else
#include <glib/glist.h>
#endif

Then I thought that because the error messages exist in earlier versions of glib2, we could patch everything without the preprocessor checks and change everything directly. Possibly the early appearance of the error messages means support existed to make such changes but only were enforced in glib2 2.31.

With that said, I used your patch as-is and rebuilt gtk-qt-engine in Slackware 13.1, which uses glib2 2.28.6. This is the oldest Slackware release I am supporting. The new package contents are the same as my previous builds. No build errors.

Therefore your patch works with previous glib2 releases too. I don't know how far back, however. I suppose we could push the patch as-is and should anyone report breakage with an older glib2, then we update the patch with preprocessor checks.
Comment 3 Darrell 2012-06-28 11:10:33 CDT
Created attachment 699 [details]
glib2 patch for kmplayer

After searching the sources, there probably are only two apps that need a patch: gtk-qt-engine and kmplayer:

applications/kmplayer/src/npplayer.c:33: #include <glib/gprintf.h>
applications/gtk-qt-engine/src/qt_theme_draw.c:6: #include <glib/glist.h>

Attached is a patch for kmplayer, if needed.
Comment 4 Darrell 2012-07-10 13:09:38 CDT
gtk-qt-engine patch pushed to GIT in commit 1525fb2f.

kmplayer patch pushed to GIT in commit efeb4d69.

We'll keep this report open a while longer in case other such failures occur.
Comment 5 Darrell 2012-07-17 21:21:11 CDT
Notice:

Anybody building koffice with wv2 support against glib2 >=2.31 will experience a build failure. A header file in wv2 references a glib2 header and needs to be patched. Here is the wv2 patch in case your distro does not have a patched wv2 package:

======================================================================
diff -urN wv2-0.4.2/src/olestream.h wv2-0.4.2.new/src/olestream.h
--- wv2-0.4.2/src/olestream.h 2009-10-31 13:22:43.000000000 -0500
+++ wv2-0.4.2.new/src/olestream.h 2012-07-17 20:56:04.000000000 -0500
@@ -23,7 +23,7 @@
 #include "global.h"  // U8,... typedefs
 #include <stack>

-#include <glib/giochannel.h> // GSeekType
+#include <glib.h> // GSeekType

 namespace wvWare {
Comment 6 Darrell 2012-09-18 14:39:55 CDT
I have not seen any more of these failures. Closing as resolved.

Thanks for reporting!