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 721346 - non-standard CFLAGS_FOR_BUILD, CPPFLAGS_FOR_BUILD, LDFLAGS_FOR_BUILD cause problems
non-standard CFLAGS_FOR_BUILD, CPPFLAGS_FOR_BUILD, LDFLAGS_FOR_BUILD cause pr...
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Class: GtkBuilder
unspecified
Other All
: Normal normal
: ---
Assigned To: GtkBuilder maintainers
GtkBuilder maintainers
Depends on:
Blocks:
 
 
Reported: 2014-01-02 16:20 UTC by Allison Karlitskaya (desrt)
Modified: 2014-01-03 01:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
configure: use CFLAGS, etc. _FOR_BUILD as well (2.54 KB, patch)
2014-01-02 17:02 UTC, Allison Karlitskaya (desrt)
none Details | Review
configure: use CFLAGS, etc. _FOR_BUILD as well (1.47 KB, patch)
2014-01-02 17:17 UTC, Allison Karlitskaya (desrt)
committed Details | Review

Description Allison Karlitskaya (desrt) 2014-01-02 16:20:41 UTC
Most people are trying to build gtk+ in a non-cross-compiled world.  In this case, the CFLAGS_FOR_BUILD (and friends) are problematic because they need to explicitly be set to the same thing as CFLAGS.  This is unlike every other module where settings CFLAGS, LDFLAGS, etc. is sufficient.

In the case that we are not doing a cross-compile, we should set the default value for these variables from the corresponding host variables (CFLAGS, CPPFLAGS, LDFLAGS) so that the person trying to build gtk+ doesn't have to set both variants.
Comment 1 Allison Karlitskaya (desrt) 2014-01-02 16:48:10 UTC
I've sent an email to the autoconf-archive maintainers list (since this is clearly a problem with the AX_PROG_CC_FOR_BUILD macro that we simply downloaded from there).

The two solutions I've proposed are as follows:

if test "$cross_compiling" = "no"; then
       if test -n "$CFLAGS"; then
               CFLAGS_FOR_BUILD=$CFLAGS
       fi
       if test -n "$CPPFLAGS"; then
               CPPFLAGS_FOR_BUILD=$CPPFLAGS
       fi
       if test -n "$LDFLAGS"; then
               LDFLAGS_FOR_BUILD=$LDFLAGS
       fi
fi

-- or --

if test -z "$CFLAGS_FOR_BUILD" -a -n "$CFLAGS"; then
      CFLAGS_FOR_BUILD="$CFLAGS"
fi
if test -z "$CPPFLAGS_FOR_BUILD" -a -n "$CPPFLAGS"; then
      CPPFLAGS_FOR_BUILD="$CPPFLAGS"
fi
if test -z "$LDFLAGS_FOR_BUILD" -a -n "$LDFLAGS"; then
      LDFLAGS_FOR_BUILD="$LDFLAGS"
fi


with preference for the first one.

Meanwhile, we can add a local workaround.  I'll do a patch based on the first one.
Comment 2 Allison Karlitskaya (desrt) 2014-01-02 17:02:56 UTC
Created attachment 265163 [details] [review]
configure: use CFLAGS, etc. _FOR_BUILD as well

When not doing cross-builds, use the values of CFLAGS, CPPFLAGS and
LDFLAGS as the default value for CFLAGS_FOR_BUILD, CPPFLAGS_FOR_BUILD
and LDFLAGS_FOR_BUILD, respectively.

This avoids having to manually specify these variables in order to get
extract-strings to build properly.

This should really be handled by ax_prog_cc_for_build.m4.  That has been
reported upstream.  This is a workaround for now.
Comment 3 Allison Karlitskaya (desrt) 2014-01-02 17:04:37 UTC
I tested this as follows:

 - normal build no CFLAGS set
 - normal build with CFLAGS in environment variable
 - normal build with CFLAGS given to ./configure commandline
 - cross build via mingw32-configure

in all cases, this code functions as I expect:

 - in normal builds CFLAGS == CFLAGS_FOR_BUILD

 - in cross builds, CFLAGS_FOR_BUILD are the default ones (-O2 -g) and CFLAGS
   are the ones that mingw32-configure sets up
Comment 4 Allison Karlitskaya (desrt) 2014-01-02 17:17:26 UTC
Created attachment 265166 [details] [review]
configure: use CFLAGS, etc. _FOR_BUILD as well

When not doing cross-builds, use the values of CFLAGS, CPPFLAGS and
LDFLAGS as the default value for CFLAGS_FOR_BUILD, CPPFLAGS_FOR_BUILD
and LDFLAGS_FOR_BUILD, respectively.

This avoids having to manually specify these variables in order to get
extract-strings to build properly.

This should really be handled by ax_prog_cc_for_build.m4.  That has been
reported upstream.  This is a workaround for now.
Comment 5 Allison Karlitskaya (desrt) 2014-01-02 17:18:05 UTC
Comment on attachment 265163 [details] [review]
configure: use CFLAGS, etc. _FOR_BUILD as well

Accidentally uploaded some unrelated bits (one of which was caused by having to pin back our required glib version to test a cross-build under mingw32).
Comment 6 Matthias Clasen 2014-01-03 01:05:42 UTC
Review of attachment 265166 [details] [review]:

ok
Comment 7 Allison Karlitskaya (desrt) 2014-01-03 01:32:08 UTC
Attachment 265166 [details] pushed as 14c7b26 - configure: use CFLAGS, etc. _FOR_BUILD as well