Hi Tal,

> [...] when ccache runs the real compiler it removes the color flag from
the
> command line causing the build to succeed: [...]

I believe the attached patch should fix the problem. Could you give it a
spin and see if it works for you?

-- Joel


On 18 November 2014 12:16, tal zilcer <tal.zil...@gmail.com> wrote:

> hi,
>
> ive been using ccache for quite some time now(version 3.1.9) and decided to
> upgrade to 3.2.
> when i try to build buildroot for x86_64 platform with ccache i have a
> build error,
> because of the -fdiagnostics-color=auto flag.
> from build log:
> >>> host-kmod 18 Building
> ...
> ...
> cc1: error: unrecognized command line option "-fdiagnostics-color=auto"
>
> when configure runs for host-kmod it checks if it can use the color flag:
> checking if /home/workspace/ccache_3.2/host/usr/bin/ccache /usr/bin/gcc
> -std=gnu99 supports flag -fdiagnostics-color=auto in envvar CFLAGS... yes
> from ccache log:
> 2014-11-18T11:40:25.004210 5163 ] Command line:
> /home//workspace/ccache_3.2/host/usr/bin/ccache /usr/bin/gcc -std=gnu99 -c
> -Werror -fdiagnostics-color=auto
> -I/home/workspace/ccache_3.2//host/usr/include conftest.c
>
> when ccache runs the real compiler it removes the color flag from the
> command line causing the build to succeed:
> [2014-11-18T11:40:25.006572 5163 ] Executing /usr/bin/gcc -std=gnu99
> -Werror -I../../host/usr/include -E conftest.c
>
> so as a result configure thinks -fdiagnostics-color=auto is supported and
> later in the build phase
> it fails to run the real compiler.
>
> the relevant commit in ccache is: d875edef19d0ab157b2f6408330bb1392fd38f60
>
> any ideas what should i do?
> is this a bug?
>
> thanks,
> tal
> _______________________________________________
> ccache mailing list
> ccache@lists.samba.org
> https://lists.samba.org/mailman/listinfo/ccache
>
From b766d4a73d1041f3206194d8caba91a90cb2a3b2 Mon Sep 17 00:00:00 2001
From: Joel Rosdahl <j...@rosdahl.net>
Date: Wed, 19 Nov 2014 21:23:20 +0100
Subject: [PATCH] Pass -fdiagnostics-color=auto to the compiler even if stderr
 is redirected

This fixes a problem when e.g. a configure test probes if the compiler
(wrapped via ccache) supports -fdiagnostics-color=auto. If ccache discards
the option since configure redirects stderr, then configure will
erroneously think that the compiler supports the option and the build will
fail later on (if stderr refers to a TTY).
---
 ccache.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ccache.c b/ccache.c
index f3a6a03..9e2f4d8 100644
--- a/ccache.c
+++ b/ccache.c
@@ -1999,6 +1999,8 @@ cc_process_args(struct args *args, struct args **preprocessor_args,
 				/* Output is redirected, so color output must be forced. */
 				args_add(stripped_args, "-fdiagnostics-color=always");
 				cc_log("Automatically forcing colors");
+			} else {
+				args_add(stripped_args, argv[i]);
 			}
 			found_color_diagnostics = true;
 			continue;
-- 
1.9.1

_______________________________________________
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache

Reply via email to