]> code.ossystems Code Review - openembedded-core.git/commitdiff
bitbake.conf: disable ccache explicitly if it is not enabled
authorRobert Yang <liezhi.yang@windriver.com>
Mon, 25 Jun 2012 09:31:19 +0000 (17:31 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 28 Jun 2012 15:23:18 +0000 (16:23 +0100)
The autogen-native built error on FC17:

ccache: failed to create /dev/null/.ccache

This is because the default gcc command of FC17 is a symlink to ccache,
so the ccache will always be used regardless to the setting of CCACHE,
ccache uses $HOME/.ccache as the CACHE_DIR by default, but autogen set
HOME=/dev/null, so the error happens.

Disable ccache explicitly if it is not enabled would fix the problem,
otherwise it would always use ccache regardless to the setting of CCACHE
on Fedora 17.

The ccache 3.1.7 has a bug, it would always create $CCCHE_DIR/.ccache
even CCACHE_DISABLE=1.

Unset CCACHE_DISABLE in ccache.bbclass, since ccache only checks whether
there is a CCACHE_DISABLE in the environment or not, it doesn't care about
its value, so we need unset it explicitly when enable ccache.

[YOCTO #2554]

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
meta/classes/ccache.bbclass
meta/conf/bitbake.conf

index 10f9b9f9aa0da3af0b9a4b8f5cb2097db565ea97..5aa2da2df4bfc3ce3b78504fc57e3dee227397f5 100644 (file)
@@ -1,5 +1,6 @@
 CCACHE = "${@bb.which(d.getVar('PATH', True), 'ccache') and 'ccache '}"
 export CCACHE_DIR = "${TMPDIR}/ccache/${MULTIMACH_HOST_SYS}/${PN}"
+CCACHE_DISABLE[unexport] = "1"
 
 do_configure[dirs] =+ "${CCACHE_DIR}"
 do_kernel_configme[dirs] =+ "${CCACHE_DIR}"
index fbc0ca205a19053b85c2849f48e4c5ed61a57210..9b26580f1bdf3dcea3368b5f0f0ea6f288ab452f 100644 (file)
@@ -414,6 +414,14 @@ export PATH
 ##################################################################
 
 CCACHE ??= ""
+# Disable ccache explicitly if CCACHE is null since gcc may be a symlink
+# of ccache some distributions (e.g., Fedora 17).
+export CCACHE_DISABLE ??= "${@[0,1][d.getVar('CCACHE', True) == '']}"
+# Assign CCACHE_DIR a default vaule to fix a bug of ccache 3.1.7,
+# since it would always create CCACHE_DIR/.ccache even if
+# CCACHE_DISABLE = 1.
+export CCACHE_DIR ??= "${@os.getenv('HOME')}"
+
 TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TARGET}"
 
 export CC = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"