GNOME Bugzilla – Bug 498408
Incorrect flags passed to gtkdoc-scanobj
Last modified: 2018-08-17 13:56:37 UTC
gconf-2.20.1 (as with all recent previous versions) doesn't pass the compiler and linker flags to gtkdoc-scanobj correctly. The GTKDOC_CFLAGS and GTKDOC_LIBS definitions doc/gconf/Makefile.am are set according to what the automake variables sound like they mean, not how they are actually (and documented to be) used: # CFLAGS and LDFLAGS for compiling scan program. Only needed # if $(DOC_MODULE).types is non-empty. GTKDOC_CFLAGS = -I$(top_srcdir) $(CFLAGS) $(DEPENDENT_CFLAGS) GTKDOC_LIBS = $(LDFLAGS) $(DEPENDENT_LIBS) $(top_builddir)/gconf/libgconf-$(MAJOR_VERSION).la I notice that $(CFLAGS) is passed in GTKDOC_CFLAGS not GTKDOC_LIBS and that $(CPPFLAGS) isn't passed in GTKDOC_CFLAGS Here's a snippet of gconf/Makefile.in to see how the flags are used. COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ In order to get gtkdoc-scanobj to "see the same thing as the actual compile" and (at least as importantly) get the correct benefit of whatever critical CPPFLAGS and CFLAGS were set from ./configure, I think it should be passed the same -I and -L and related flags in the same order as they are actually used: GTKDOC_CFLAGS = -I$(top_srcdir) $(DEPENDENT_CFLAGS) $(CPPFLAGS) $(CFLAGS) GTKDOC_LIBS = $(CFLAGS) $(LDFLAGS) $(DEPENDENT_LIBS) $(top_builddir)/gconf/libgconf-$(MAJOR_VERSION).la
Looking further, automake has given Makefile.in an actual gtkdoc-scanobj of: CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" CFLAGS="$(GTKDOC_CFLAGS)" LDFLAGS="$(GTKDOC_LIBS)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(srcdir) (from gtk-doc.make) where: GTKDOC_CC = $(LIBTOOL) --mode=compile $(CC) $(INCLUDES) $(AM_CFLAGS) $(CFLAGS) GTKDOC_LD = $(LIBTOOL) --mode=link $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) Internally, gtkdoc-scanobj links and compiles via: $CC $CFLAGS -c -o $o_file $MODULE-scan.c $LD -o $MODULE-scan $o_file $LDFLAGS So CFLAGS and LDFLAGS are already well passed without having to put them in GTKDOC_CFLAGS or GTKDOC_LIBS at all. That makes sense...automake handles all the default ("normal") flags, the only thing Makefile.am needs to specify are special (package-specific) ones. Maybe: GTKDOC_CFLAGS = -I$(top_srcdir) $(DEPENDENT_CFLAGS) GTKDOC_LIBS = $(top_builddir)/gconf/libgconf-$(MAJOR_VERSION).la $(DEPENDENT_LIBS) is the correct way, and the (in my opinion) missing CPPFLAGS and any other ordering issues are in the hands of gtk-doc itself.
I tried this and it didn't break distcheck at least.
GConf has been deprecated since 2011. GConf is not under active development anymore. Its codebase has been archived: https://gitlab.gnome.org/Archive/gconf/commits/master dconf and gsettings are its successors. See https://developer.gnome.org/gio/stable/ch34.html and https://developer.gnome.org/GSettings/ for porting info. Closing this report as WONTFIX as part of Bugzilla Housekeeping to reflect reality. Feel free to open a task in GNOME Gitlab if the issue described in this task still applies to a recent + supported version of dconf/gsettings. Thanks!