GNOME Bugzilla – Bug 665293
glibconfig includes glib/gmacros.h which results in error
Last modified: 2011-12-02 11:25:53 UTC
since glib 2.31, only glib.h (and a few exceptions) can be #include'd glib itself fails on this in the autogenerated glibconfig.h that is autogenerated from configure. This makes any application #include'ing glibconfig.h fail. Patch attached to change the include to glib.h only.
Created attachment 202523 [details] [review] Change glibconfig.h to only include glib.h
Sorry.. that patch actually does not work (well, it was the 'obvious' thing to do... but it badly fails to bootstrap with this patch: libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -I.. -I../glib -I../glib -I.. -DG_LOG_DOMAIN=\"GLib\" -DG_ENABLE_DEBUG -DGLIB_COMPILATION -DPCRE_STATIC -pthread -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -c gatomic.c -fPIC -DPIC -o .libs/gatomic.o In file included from ./glib.h:33:0, from ./glibconfig.h:9, from ../glib/gtypes.h:34, from ../glib/gmem.h:34, from ../glib/glist.h:34, from deprecated/gcompletion.h:34, from deprecated/gcompletion.c:36: ../glib/garray.h:38:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'typedef' ../glib/garray.h:44:3: error: unknown type name 'gchar' ../glib/garray.h:45:3: error: unknown type name 'guint' ../glib/garray.h:50:3: error: unknown type name 'guint8' ../glib/garray.h:51:3: error: unknown type name 'guint' ../glib/garray.h:56:3: error: unknown type name 'gpointer' ../glib/garray.h:57:3: error: unknown type name 'guint'
Created attachment 202533 [details] [review] New patch: Allow gmacros to be included from glibconfig.h With this patch I can bootstrap and the application which originally triggered the issue for me (pan) can be successfully built as well.
hi Dominique, We have been advertising for some time that the only acceptable header to include from GLib is <glib.h>. It is intended that code that includes other headers directly should now fail to compile.
Ryan, Does that mean that glibconfig.h is NOT supposed to be included neither by any app? Note: glibconfig.h is NOT pulled in by glib.h (like a few others as well) (but I did not check if it is infact being pulled by any other header... that might well be) glibconfig.h is being auto-generated by glib's configure script (configure.ac). My first patch was an obvious 'do not include anything else from glibconfig.h', but that broke even bootstrapping.
glibconfig.h is included by gtypes.h, which is included by glib.h
ahh! Thanks.. .that's the missing link I missed.. I'm just building the 'offending' app without including glibconfig.h and in this case very likely we can just close this bug here.. sorry!
Indeed. It was only my own oversight for having missed that glibconfig is in fact indirectly included in all builds. Please discard. And sorry for that.