Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] infra/ccache: avoid color diagnostics with GCC older than v4.9
@ 2017-02-10 13:34 Carlos Santos
  2017-02-11 15:38 ` Thomas Petazzoni
  2017-02-12 11:33 ` [Buildroot] [PATCH v2] " Carlos Santos
  0 siblings, 2 replies; 17+ messages in thread
From: Carlos Santos @ 2017-02-10 13:34 UTC (permalink / raw)
  To: buildroot

When GCC_COLORS is set, ccache passes '-fdiagnostics-color' to GCC but
this flag requires GCC v4.9 or later. Older versions fail, complaining
about the unrecognized command line option.

The problem is not detectable in the autobuilders because they redirect
the output to files/pipes and ccache adds the offending flag only when
stderr is a terminal.

Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
---
Change-Id: I0574c7527b24d9e21119961adfa1c7aa17337314

Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
---
 package/Makefile.in | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/package/Makefile.in b/package/Makefile.in
index 5d591e9..6a010b1 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -237,6 +237,13 @@ export PERL5LIB=$(HOST_DIR)/usr/lib/perl
 
 TARGET_MAKE_ENV = PATH=$(BR_PATH)
 
+# When GCC_COLORS is set, ccache passes '-fdiagnostics-color' to GCC but
+# this flag requires GCC v4.9 or later. Older versions fail, complaining
+# about unrecognized command line option.
+ifneq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_4_9),y)
+	TARGET_MAKE_ENV += GCC_COLORS=""
+endif
+
 TARGET_CONFIGURE_OPTS = \
 	$(TARGET_MAKE_ENV) \
 	AR="$(TARGET_AR)" \
@@ -286,6 +293,11 @@ HOST_MAKE_ENV = \
 	PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 \
 	PKG_CONFIG_LIBDIR="$(HOST_DIR)/usr/lib/pkgconfig:$(HOST_DIR)/usr/share/pkgconfig"
 
+# Prevent ccache from passing '-fdiagnostics-color' (see above).
+ifneq ($(BR2_HOST_GCC_AT_LEAST_4_9),y)
+	HOST_MAKE_ENV += GCC_COLORS=""
+endif
+
 HOST_CONFIGURE_OPTS = \
 	$(HOST_MAKE_ENV) \
 	AR="$(HOSTAR)" \
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2017-02-14 16:48 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-10 13:34 [Buildroot] [PATCH] infra/ccache: avoid color diagnostics with GCC older than v4.9 Carlos Santos
2017-02-11 15:38 ` Thomas Petazzoni
2017-02-12 10:08   ` Yann E. MORIN
2017-02-12 12:14     ` Thomas Petazzoni
2017-02-12 12:33       ` Yann E. MORIN
2017-02-12 12:59         ` Thomas Petazzoni
2017-02-12 13:08           ` Yann E. MORIN
2017-02-12 13:10             ` Thomas Petazzoni
2017-02-12 11:33 ` [Buildroot] [PATCH v2] " Carlos Santos
2017-02-12 12:34   ` Yann E. MORIN
2017-02-12 14:14   ` Yann E. MORIN
2017-02-12 14:55     ` Carlos Santos
2017-02-12 17:21       ` Yann E. MORIN
2017-02-12 17:22       ` Thomas Petazzoni
2017-02-12 17:28         ` Yann E. MORIN
2017-02-13 22:41     ` Carlos Santos
2017-02-14 16:48       ` Yann E. MORIN

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox