Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Romain Naour <romain.naour@openwide.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2 16/18] toolchain-wrapper: support change of BR2_CCACHE
Date: Sun, 4 Oct 2015 16:24:56 +0200	[thread overview]
Message-ID: <561136B8.8010200@openwide.fr> (raw)
In-Reply-To: <1443961738-12149-17-git-send-email-arnout@mind.be>

Arnout,

Le 04/10/2015 14:28, Arnout Vandecappelle (Essensium/Mind) a ?crit :
> By moving the ccache call to the toolchain wrapper, the following
> scenario no longer works:
> 
> make foo-dirclean all BR2_CCACHE=
> 
> That's a sometimes useful call to check if some failure is perhaps
> caused by ccache.
> 
> We can enable this scenario again by exporting BR_NO_CCACHE when
> BR2_CCACHE is not set, and by handling this in the toolchain wrapper.
> 
> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

I tried this patch with the whole series applied (I removed the hash to ease the
reading)

$ make O=test/ccache/ busybox BR2_DEBUG_WRAPPER=2

Toolchain wrapper executing:CCACHE_COMPILERCHECK=string:[hash]
    CCACHE_BASEDIR=/home/naourr/git/buildroot/test/ccache

    '/home/naourr/git/buildroot/test/ccache/host/usr/bin/ccache'

'/home/naourr/git/buildroot/test/ccache/host/usr/bin/i686-buildroot-linux-uclibc-gcc.real'
    '--sysroot'

'/home/naourr/git/buildroot/test/ccache/host/usr/i686-buildroot-linux-uclibc/sysroot'
    '-E'
    '-xc'
    '-'

$ make O=test/ccache/ busybox BR2_DEBUG_WRAPPER=2 BR2_CCACHE=

Toolchain wrapper executing:CCACHE_COMPILERCHECK=string:[hash]
    CCACHE_BASEDIR=/home/naourr/git/buildroot/test/ccache


'/home/naourr/git/buildroot/test/ccache/host/usr/bin/i686-buildroot-linux-uclibc-gcc.real'
    '--sysroot'

'/home/naourr/git/buildroot/test/ccache/host/usr/i686-buildroot-linux-uclibc/sysroot'
    '-E'
    '-xc'
    '-'

Tested-by: Romain Naour <romain.naour@openwide.fr>
Reviewed-by: Romain Naour <romain.naour@openwide.fr>

Best regards,
Romain

> ---
> v2: No change, but no longer RFC.
> ---
>  Makefile                      |  2 ++
>  toolchain/toolchain-wrapper.c | 15 +++++++++++----
>  2 files changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index fdbca02..e8e2f02 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -375,6 +375,8 @@ BR_CACHE_DIR = $(call qstrip,$(BR2_CCACHE_DIR))
>  export BR_CACHE_DIR
>  HOSTCC := $(CCACHE) $(HOSTCC)
>  HOSTCXX := $(CCACHE) $(HOSTCXX)
> +else
> +export BR_NO_CCACHE
>  endif
>  
>  # Scripts in support/ or post-build scripts may need to reference
> diff --git a/toolchain/toolchain-wrapper.c b/toolchain/toolchain-wrapper.c
> index b5fe1d3..cf66fac 100644
> --- a/toolchain/toolchain-wrapper.c
> +++ b/toolchain/toolchain-wrapper.c
> @@ -95,7 +95,7 @@ static void check_unsafe_path(const char *path, int paranoid)
>  
>  int main(int argc, char **argv)
>  {
> -	char **args, **cur;
> +	char **args, **cur, **exec_args;
>  	char *relbasedir, *absbasedir;
>  	char *progpath = argv[0];
>  	char *basename;
> @@ -237,6 +237,13 @@ int main(int argc, char **argv)
>  	/* finish with NULL termination */
>  	*cur = NULL;
>  
> +	exec_args = args;
> +#ifdef BR_CCACHE
> +	if (getenv("BR_NO_CCACHE"))
> +		/* Skip the ccache call */
> +		exec_args++;
> +#endif
> +
>  	/* Debug the wrapper to see actual arguments passed to
>  	 * the compiler:
>  	 * unset, empty, or 0: do not trace
> @@ -247,14 +254,14 @@ int main(int argc, char **argv)
>  		debug = atoi(env_debug);
>  		if (debug > 0) {
>  			fprintf(stderr, "Toolchain wrapper executing:");
> -			for (i = 0; args[i]; i++)
> +			for (i = 0; exec_args[i]; i++)
>  				fprintf(stderr, "%s'%s'",
> -					(debug == 2) ? "\n    " : " ", args[i]);
> +					(debug == 2) ? "\n    " : " ", exec_args[i]);
>  			fprintf(stderr, "\n");
>  		}
>  	}
>  
> -	if (execv(args[0], args))
> +	if (execv(exec_args[0], exec_args))
>  		perror(path);
>  
>  	free(args);
> 

  reply	other threads:[~2015-10-04 14:24 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-04 12:28 [Buildroot] [PATCH v2 00/18] Internal toolchain wrapper & ccache support Arnout Vandecappelle
2015-10-04 12:28 ` [Buildroot] [PATCH v2 01/18] toolchain-external: move wrapper to toolchain directory Arnout Vandecappelle
2015-10-04 12:28 ` [Buildroot] [PATCH v2 02/18] gcc: use toolchain wrapper Arnout Vandecappelle
2015-10-04 12:28 ` [Buildroot] [PATCH v2 03/18] gcc: remove unsafe patch check (poison system dirs) patch Arnout Vandecappelle
2015-10-04 12:28 ` [Buildroot] [PATCH v2 04/18] infra: move ccache handling to the toolchain wrapper Arnout Vandecappelle
2015-10-04 15:07   ` Peter Korsgaard
2015-10-04 15:23   ` [Buildroot] [PATCH v3] " Arnout Vandecappelle
2015-10-04 12:28 ` [Buildroot] [PATCH v2 05/18] perl: Remove ccache handling Arnout Vandecappelle
2015-10-04 12:28 ` [Buildroot] [PATCH v2 06/18] imx-lib: remove now-redundant " Arnout Vandecappelle
2015-10-04 12:28 ` [Buildroot] [PATCH v2 07/18] imx-vpu: " Arnout Vandecappelle
2015-10-04 12:28 ` [Buildroot] [PATCH v2 08/18] linux: " Arnout Vandecappelle
2015-10-04 12:28 ` [Buildroot] [PATCH v2 09/18] uboot: " Arnout Vandecappelle
2015-10-04 12:28 ` [Buildroot] [PATCH v2 10/18] barebox: " Arnout Vandecappelle
2015-10-04 12:28 ` [Buildroot] [PATCH v2 11/18] cryptodev-linux: remove now-redundant fix-ccache-compile patch Arnout Vandecappelle
2015-10-04 12:28 ` [Buildroot] [PATCH v2 12/18] qt5base: remove now-redundant ccache handling Arnout Vandecappelle
2015-10-04 12:28 ` [Buildroot] [PATCH v2 13/18] package-cmake: remove now-redundant target ccache support Arnout Vandecappelle
2015-10-04 12:28 ` [Buildroot] [PATCH v2 14/18] qpid-proton: remove now-redundant ccache handling patch Arnout Vandecappelle
2015-10-04 12:28 ` [Buildroot] [PATCH v2 15/18] Makefile.in: remove now-unused TARGET_CC/CXX_NOCCACHE Arnout Vandecappelle
2015-10-04 12:28 ` [Buildroot] [PATCH v2 16/18] toolchain-wrapper: support change of BR2_CCACHE Arnout Vandecappelle
2015-10-04 14:24   ` Romain Naour [this message]
2015-10-04 12:28 ` [Buildroot] [PATCH v2 17/18] ccache: use mtime for external toolchain, CONF_OPTS for internal toolchain Arnout Vandecappelle
2015-10-04 14:55   ` Romain Naour
2015-10-04 15:25   ` [Buildroot] [PATCH v3] " Arnout Vandecappelle
2015-10-04 12:28 ` [Buildroot] [PATCH v2 18/18] [RFC] ccache: support changing the output directory Arnout Vandecappelle
2015-10-04 15:25   ` [Buildroot] [PATCH v3] " Arnout Vandecappelle
2015-10-04 16:01 ` [Buildroot] [PATCH v2 00/18] Internal toolchain wrapper & ccache support Peter Korsgaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=561136B8.8010200@openwide.fr \
    --to=romain.naour@openwide.fr \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox