After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 498521 - Inconsistent compiler flags passed in gtk-doc.make
Inconsistent compiler flags passed in gtk-doc.make
Status: RESOLVED FIXED
Product: gtk-doc
Classification: Platform
Component: general
1.8
Other Mac OS
: Normal normal
: 1.10
Assigned To: Stefan Sauer (gstreamer, gtkdoc dev)
gtk-doc maintainers
Depends on:
Blocks:
 
 
Reported: 2007-11-20 14:56 UTC by Daniel Macks
Modified: 2008-02-01 15:21 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Daniel Macks 2007-11-20 14:56:40 UTC
+++ This bug was initially created as a clone of Bug #498408 +++

The flags passed to gtkdoc-objscan do not match the ones used during normal compiling. In particular, CPPFLAGS is missing from the compiler call, meaning some flags that the user has specified during ./configure are not being passed.

Here's a snippet of an automake-generated Makefile.in to see how the flags are used in a source compile:

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 $@

However, gtk-doc-1.8 gives a gtk-doc.make fragment of:

if GTK_DOC_USE_LIBTOOL
GTKDOC_CC = $(LIBTOOL) --mode=compile $(CC) $(INCLUDES) $(AM_CFLAGS) $(CFLAGS)
GTKDOC_LD = $(LIBTOOL) --mode=link $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS)
else
GTKDOC_CC = $(CC) $(INCLUDES) $(AM_CFLAGS) $(CFLAGS)
GTKDOC_LD = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS)
endif
CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" CFLAGS="$(GTKDOC_CFLAGS)" LDFLAG
S="$(GTKDOC_LIBS)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) --
output-dir=$(srcdir)

which is then used in gtkdoc-scanobj via system() calls to these commands:

$CC $CFLAGS -c -o $o_file $MODULE-scan.c
$LD -o $MODULE-scan $o_file $LDFLAGS

So CFLAGS is passed twice to the compiler (once via GTKDOC_CC, once in the gtkdoc-scanobj code itself) and likewise LDFLAGS is passed twice to the linker (once via GTKDOC_LD, once in the gtkdoc-scanobj code itself). And CPPFLAGS is omitted entirely (for consistency with other source compiler calls, should be in GTKDOC_CC before CFLAGS I think?).

There are other flags missing as well, but I don't know enough about all the uses of gtkdoc-scanobj to know if they should be included as well. Probably "good idea" if one has gtk-doc stuff in the same Makefile.am as an actual build, "not needed" if one uses a separate doc/ subdir for it all. And "not absolutely needed ever" since one can always use GTKDOC_CFLAGS and GTKDOC_LIBS to pass those same flags if needed.
Comment 1 Stefan Sauer (gstreamer, gtkdoc dev) 2007-11-21 18:40:37 UTC
Good catch. I'll fix the double CFLAGS and LDFLAGS issue. I could also add CPPFLAGS and AM_CPPFLAGS.
Do you have an existing issue which would require it?
Comment 2 Daniel Macks 2007-11-22 03:42:20 UTC
On OS X, the base system does not include many of the libs one finds on linux machines, and the two major package-managers install their things in their own hierarchies (*not* in the base system directories)...same idea as if a non-root user installed a suite of packages in his own directory. That means we need to pass -I and -L flags just to find the most basic things that are in the automatic search-paths of compilers on other machines. For example, Fink users would need to (and the fink build system does automatically) pass CPPFLAGS=-I/sw/include just to be able to compile the "program":

#include <libintl.h>


Comment 3 Stefan Sauer (gstreamer, gtkdoc dev) 2007-12-04 14:46:58 UTC
I looked at the problem. Basically the gtkdoc-scanobj export CFLAGS/LDFLAGS before calling the build. This should include the CFLAGS/LDFLAGS you've set.

$ make CFLAGS="-DHELLO" docs
gtk-doc: Scanning header files
if grep -l '^..*$' ./tester.types > /dev/null 2>&1 ; then \
            CC="/bin/bash ../../../libtool --mode=compile gcc -I../../.. -I../../../tests/bugs/src -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include    -DHELLO" LD="/bin/bash ../../../libtool --mode=link gcc  -DHELLO " CFLAGS="" LDFLAGS="-lgobject-2.0 -lglib-2.0   ../../../tests/bugs/src/libtester.la" ../../../gtkdoc-scangobj --module=tester --output-dir=. 2>&1 | tee gtkdoc-scangobj.log ;

I've committed adding the AM_ flags cleanup though. Could you retry and check if it works better for you?
Comment 4 Stefan Sauer (gstreamer, gtkdoc dev) 2008-02-01 15:21:33 UTC
I suppose its fixed then. Please reopen if not.