GNOME Bugzilla – Bug 688617
#error "Only <gjs/gjs-module.h> can be included directly."
Last modified: 2012-11-25 05:29:35 UTC
quoth jhbuild: make[3]: Entering directory `/home/desrt/jhbuild/checkout/libpeas/loaders/gjs' CC peas-plugin-loader-gjs.lo CC peas-extension-gjs.lo In file included from /opt/ca/desrt/gnome-3.8/include/gjs-1.0/gi/arg.h:29:0, from peas-extension-gjs.c:29: /opt/ca/desrt/gnome-3.8/include/gjs-1.0/gjs/jsapi-util.h:28:2: error: #error "Only <gjs/gjs-module.h> can be included directly." In file included from /opt/ca/desrt/gnome-3.8/include/gjs-1.0/gjs/jsapi-util.h:31:0, from /opt/ca/desrt/gnome-3.8/include/gjs-1.0/gi/arg.h:29, from peas-extension-gjs.c:29: /opt/ca/desrt/gnome-3.8/include/gjs-1.0/gjs/compat.h:26:2: error: #error "Only <gjs/gjs-module.h> can be included directly." make[3]: *** [peas-extension-gjs.lo] Error 1 make[3]: *** Waiting for unfinished jobs.... make[3]: Leaving directory `/home/desrt/jhbuild/checkout/libpeas/loaders/gjs' make[2]: Leaving directory `/home/desrt/jhbuild/checkout/libpeas/loaders' make[1]: Leaving directory `/home/desrt/jhbuild/checkout/libpeas' make[2]: *** [all-recursive] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2
This was caused by bug 688289. A workaround appears to be #include <gjs/gjs-module.h> before any of the <gi/*> includes...
Created attachment 229616 [details] [review] Workaround gjs single-include issue gjs features single-include guards for the headers in gjs/ with gjs/gjs-module.h being the only header you are supposed to include. Unfortunately, the headers in gi/ (which do not appear to have their own master include file) individually include files from gjs/. We can workaround the issue by first #include <gjs/gjs-module.h> which will skip the single-include guard on the files the second time they get included (from the headers in gi/).
Attachment 229616 [details] pushed as 2307c53 - Workaround gjs single-include issue
(In reply to comment #1) > This was caused by bug 688289. > > A workaround appears to be #include <gjs/gjs-module.h> before any of the <gi/*> > includes... I think that's the right thing to do regardless. Now unfortunately this is hard to fix due to the historical mess that makes up the gjs headers... Thanks for the libpeas-side fix!
Would there be any harm in creating a <gi/gi.h> or something and having people use that?