package/ccache: do not force colored diagnostics
PATCH v3 1/1 package/ccache: do not force colored diagnostics
When GCC_COLORS is set, ccache passes '-fdiagnostics-color' to GCC but this flag requires GCC v4.9 or later. Older versions complain about the unrecognized command line option.
We could override GCC_COLORS in the environment, but this would not be enough since some packages may call directly $(CC) or $(HOSTCC) (like makedevs do, as spotted by Thomas).
Since we use the same ccache build for both host and target, we disable that behaviour when either the host or target compiler is tool old to support this, at the cost of nol onger colorising output diagnostics for the one that is recent enough.
---
Changes v2 -> v2: (Yann)
- drop the environment variable override (Yann)
- directly patch ccache (Thomas)
Changes v1->v2 (Carlos)
Fix indentation, use positive logic and improve the commit message, acording to comments from Thomas Petazzoni and Yann E. MORIN.
--- package/ccache/ccache.mk | 10 ++++++++++ 1 file changed, 10 insertions(+)
package/ccache/ccache.mk +10 -0
@@ -35,6 +35,16 @@ endef HOST_CCACHE_POST_PATCH_HOOKS += HOST_CCACHE_PATCH_CONFIGURATION +# Further patch ccache if either the host or target compilers is +# too old to support colored output diagnostics. +ifneq ($(BR2_HOST_GCC_AT_LEAST_4_9)$(BR2_TOOLCHAIN_GCC_AT_LEAST_4_9),yy) +define CCACHE_NO_GCC_COLORS + sed -i '/if (getenv("GCC_COLORS")/,+3d' $(@D)/ccache.c +endef + +#HOST_CCACHE_POST_PATCH_HOOKS += CCACHE_NO_GCC_COLORS +endif + define HOST_CCACHE_MAKE_CACHE_DIR mkdir -p $(BR_CACHE_DIR) endef
Signature · 1 line
2.7.4
PATCH v3 1/1 package/ccache: do not force colored diagnostics
Hello,
Quoted 1 line · Yann E. MORIN
+# Further patch ccache if either the host or target compilers is
compilers -> compiler (I believe, though I'm not an expert in english grammar)
package/ccache/ccache.mk endef · line 42
Quoted 4 lines
package/ccache/ccache.mk +4
-0+# too old to support colored output diagnostics. +ifneq ($(BR2_HOST_GCC_AT_LEAST_4_9)$(BR2_TOOLCHAIN_GCC_AT_LEAST_4_9),yy) +define CCACHE_NO_GCC_COLORS + sed -i '/if (getenv("GCC_COLORS")/,+3d' $(@D)/ccache.c
Using $(SED) not possible here?
package/ccache/ccache.mk endef · line 45
Quoted 3 lines
package/ccache/ccache.mk +3
-0+endef + +#HOST_CCACHE_POST_PATCH_HOOKS += CCACHE_NO_GCC_COLORS
Line commented? :-)
Other than that, looks good to me.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH v3 1/1 package/ccache: do not force colored diagnostics
Thomas, All,
On 2017-02-12 14:34 +0100, Thomas Petazzoni spake thusly:
Quoted 1 line · Yann E. MORIN
[--SNIP--]
Quoted 6 lines
package/ccache/ccache.mk endef · line 42
Quoted 4 lines
package/ccache/ccache.mk +4
-0+# too old to support colored output diagnostics. +ifneq ($(BR2_HOST_GCC_AT_LEAST_4_9)$(BR2_TOOLCHAIN_GCC_AT_LEAST_4_9),yy) +define CCACHE_NO_GCC_COLORS + sed -i '/if (getenv("GCC_COLORS")/,+3d' $(@D)/ccache.cUsing $(SED) not possible here?
I did as was done in the other macro, above.
Quoted 5 lines
package/ccache/ccache.mk endef · line 45
Quoted 3 lines
package/ccache/ccache.mk +3
-0+endef + +#HOST_CCACHE_POST_PATCH_HOOKS += CCACHE_NO_GCC_COLORSLine commented? :-)
Meh, I again forgot to commit --ammend
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v3 1/1 package/ccache: do not force colored diagnostics
In reply to Yann E. MORINHi Yann,
Quoted 35 lines · Yann E. MORIN
When
GCC_COLORSis set, ccache passes '-fdiagnostics-color' to GCC but this flag requires GCC v4.9 or later. Older versions complain about the unrecognized command line option.We could override
GCC_COLORSin the environment, but this would not be enough since some packages may call directly $(CC) or $(HOSTCC) (like makedevs do, as spotted by Thomas).Since we use the same ccache build for both host and target, we disable that behaviour when either the host or target compiler is tool old to support this, at the cost of nol onger colorising output diagnostics for the one that is recent enough.
Reported-by Carlos Santos <[email protected]>Signed-off-by "Yann E. MORIN" <[email protected]>Cc Thomas Petazzoni <[email protected]>---
Changes v2 -> v2: (Yann)
- drop the environment variable override (Yann)
- directly patch ccache (Thomas)Changes
v1->v2(Carlos)
Fix indentation, use positive logic and improve the commit message, acording to comments from Thomas Petazzoni and Yann E. MORIN.--- package/ccache/ccache.mk | 10 ++++++++++ 1 file changed, 10 insertions(+)package/ccache/ccache.mk +0
-0@@ -35,6 +35,16 @@ endef
package/ccache/ccache.mk endef · line 45
Quoted 10 lines
package/ccache/ccache.mk +8
-0HOST_CCACHE_POST_PATCH_HOOKS += HOST_CCACHE_PATCH_CONFIGURATION +# Further patch ccache if either the host or target compilers is +# too old to support colored output diagnostics. +ifneq ($(BR2_HOST_GCC_AT_LEAST_4_9)$(BR2_TOOLCHAIN_GCC_AT_LEAST_4_9),yy) +define CCACHE_NO_GCC_COLORS + sed -i '/if (getenv("GCC_COLORS")/,+3d' $(@D)/ccache.c +endef + +#HOST_CCACHE_POST_PATCH_HOOKS += CCACHE_NO_GCC_COLORS
Are you sure?
package/ccache/ccache.mk endef · line 50
Quoted 5 lines
package/ccache/ccache.mk +2
-0+endif + define HOST_CCACHE_MAKE_CACHE_DIR mkdir -p $(BR_CACHE_DIR) endef
baruch
Signature · 3 lines
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -PATCH v3 1/1 package/ccache: do not force colored diagnostics
In reply to Yann E. MORINQuoted 4 lines · Yann E. MORIN
When
GCC_COLORSis set, ccache passes '-fdiagnostics-color' to GCC but this flag requires GCC v4.9 or later. Older versions complain about the unrecognized command line option.
Quoted 8 lines
We could override
GCC_COLORSin the environment, but this would not be enough since some packages may call directly $(CC) or $(HOSTCC) (like makedevs do, as spotted by Thomas).Since we use the same ccache build for both host and target, we disable that behaviour when either the host or target compiler is tool old to support this, at the cost of nol onger colorising output diagnostics for the one that is recent enough.
Actually, if the user sets GCC_COLORS in his environment while his host
compiler is too old to support that option, then he's just plain stupid, no?
But anyway, I would tend to say, let's simplify things and do a global
"unexport GCC_COLORS" like we already do for a few other options. IMHO colourized output is not so useful in Buildroot context. A global unexport is a lot simpler.
Regards,
Arnout
Quoted 39 lines
Reported-by Carlos Santos <[email protected]>Signed-off-by "Yann E. MORIN" <[email protected]>Cc Thomas Petazzoni <[email protected]>---
Changes v2 -> v2: (Yann)
- drop the environment variable override (Yann)
- directly patch ccache (Thomas)Changes
v1->v2(Carlos)
Fix indentation, use positive logic and improve the commit message, acording to comments from Thomas Petazzoni and Yann E. MORIN.--- package/ccache/ccache.mk | 10 ++++++++++ 1 file changed, 10 insertions(+)package/ccache/ccache.mk +10
-0@@ -35,6 +35,16 @@ endef HOST_CCACHE_POST_PATCH_HOOKS += HOST_CCACHE_PATCH_CONFIGURATION +# Further patch ccache if either the host or target compilers is +# too old to support colored output diagnostics. +ifneq ($(BR2_HOST_GCC_AT_LEAST_4_9)$(BR2_TOOLCHAIN_GCC_AT_LEAST_4_9),yy) +define CCACHE_NO_GCC_COLORS + sed -i '/if (getenv("GCC_COLORS")/,+3d' $(@D)/ccache.c +endef + +#HOST_CCACHE_POST_PATCH_HOOKS += CCACHE_NO_GCC_COLORS +endif + define HOST_CCACHE_MAKE_CACHE_DIR mkdir -p $(BR_CACHE_DIR) endef
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH v3 1/1 package/ccache: do not force colored diagnostics
Arnout, All,
On 2017-02-12 22:39 +0100, Arnout Vandecappelle spake thusly:
Quoted 14 lines · Yann E. MORIN
Quoted 4 lines
When
GCC_COLORSis set, ccache passes '-fdiagnostics-color' to GCC but this flag requires GCC v4.9 or later. Older versions complain about the unrecognized command line option.Quoted 8 lines
We could override
GCC_COLORSin the environment, but this would not be enough since some packages may call directly $(CC) or $(HOSTCC) (like makedevs do, as spotted by Thomas).Since we use the same ccache build for both host and target, we disable that behaviour when either the host or target compiler is tool old to support this, at the cost of nol onger colorising output diagnostics for the one that is recent enough.
Quoted 7 lines
Actually, if the user sets
GCC_COLORSin his environment while his host
compiler is too old to support that option, then he's just plain stupid, no?But anyway, I would tend to say, let's simplify things and do a global
"unexportGCC_COLORS" like we already do for a few other options. IMHO colourized output is not so useful in Buildroot context. A global unexport is a lot simpler.
I agree, too.
Although I could well see that someone is actively developping a package (with an FOO_OVERRIDE_SRCDIR) and would be interested in having the colors for that package. In which case they could add a local override for this specific package, a-la:
FOO_MAKE_ENV += GCC_COLORS=blabla
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'