ccache.bbclass: Refactor it to make it more reliable
PATCH v3 1/11 ccache-native: Remove dependencies
In reply to Robert YangRemove ccache-native's dependencies so that all native recipes can depend on ccache-native and use it except ccache-native itself.
It has the following 4 dependencies:
- xz-native: It is intruduced by ccache-3.4.2.tar.xz, use ccache-3.4.2.tar.gz to replace of it can fix the problem.
- zlib-native: Use --with-bundled-zlib to fix it.
- autotools-native: Set INHIBIT_AUTOTOOLS_DEPS and add a do_configure() to fix the problem.
- quilt-native: Set PATCHTOOL = "patch" to fix it.
--- meta/recipes-devtools/ccache/ccache.inc | 13 ++++++++++++- meta/recipes-devtools/ccache/ccache_3.4.2.bb | 4 ++-- 2 files changed, 14 insertions(+), 3 deletions(-)
meta/recipes-devtools/ccache/ccache.inc +12 -1
@@ -9,8 +9,19 @@ LICENSE = "GPLv3+" DEPENDS = "zlib" -SRC_URI = "https://download.samba.org/pub/${BPN}/${BP}.tar.xz" +SRC_URI = "https://download.samba.org/pub/${BPN}/${BP}.tar.gz" inherit autotools +# Remove ccache-native's dependencies, so that it can be used widely by +# other native recipes. +DEPENDS_class-native = "" +EXTRA_OECONF_class-native = "--with-bundled-zlib" +INHIBIT_AUTOTOOLS_DEPS_class-native = "1" +PATCHTOOL = "patch" + BBCLASSEXTEND = "native" + +do_configure_class-native() { + oe_runconf +}
meta/recipes-devtools/ccache/ccache_3.4.2.bb +2 -2
@@ -3,8 +3,8 @@ require ccache.inc LICENSE = "GPLv3+" LIC_FILES_CHKSUM = "file://LICENSE.adoc;md5=2722abeaf1750dbf175b9491112374e1" -SRC_URI[md5sum] = "9e048f88f3897125864f9a5e1abfb72d" -SRC_URI[sha256sum] = "18a8b14367d63d3d37fb6c33cba60e1b7fcd7a63d608df97c9771ae0d234fee2" +SRC_URI[md5sum] = "07d4324efbb3c216bbd1c512f4553480" +SRC_URI[sha256sum] = "b2264923c63e2b90a17cf56acb1df3f4229c416fb88e476e5ec7e02919d319c3" SRC_URI += " \ file://0002-dev.mk.in-fix-file-name-too-long.patch \
Signature · 1 line
2.7.4
PATCH v3 2/11 ccache: 3.4.2 -> 3.5
In reply to Robert YangThe LIC_FILES_CHKSUM is changed because copyright year and zlib version are changed, others are still the same.
This version supports CCACHE_DEBUG which will make the debug easier.
--- meta/recipes-devtools/ccache/ccache_3.4.2.bb | 11 ----------- meta/recipes-devtools/ccache/ccache_3.5.bb | 11 +++++++++++ 2 files changed, 11 insertions(+), 11 deletions(-) delete mode 100644 meta/recipes-devtools/ccache/ccache_3.4.2.bb create mode 100644 meta/recipes-devtools/ccache/ccache_3.5.bb
meta/recipes-devtools/ccache/ccache_3.4.2.bb deleted +0 -11
@@ -1,11 +0,0 @@ -require ccache.inc - -LICENSE = "GPLv3+" -LIC_FILES_CHKSUM = "file://LICENSE.adoc;md5=2722abeaf1750dbf175b9491112374e1" - -SRC_URI[md5sum] = "07d4324efbb3c216bbd1c512f4553480" -SRC_URI[sha256sum] = "b2264923c63e2b90a17cf56acb1df3f4229c416fb88e476e5ec7e02919d319c3" - -SRC_URI += " \ - file://0002-dev.mk.in-fix-file-name-too-long.patch \ -"
meta/recipes-devtools/ccache/ccache_3.5.bb new file +11 -0
@@ -0,0 +1,11 @@ +require ccache.inc + +LICENSE = "GPLv3+" +LIC_FILES_CHKSUM = "file://LICENSE.adoc;md5=39f34d6ff4df51ed718fd7d243fc4e51" + +SRC_URI[md5sum] = "6e62bf2fd2c8fdc749efdca74868da41" +SRC_URI[sha256sum] = "8094f9bc186be4c9db9b480eeac280926bd44039502d1e596f45371b05a85918" + +SRC_URI += " \ + file://0002-dev.mk.in-fix-file-name-too-long.patch \ +"
Signature · 1 line
2.7.4
v3 cover ccache.bbclass: Refactor it to make it more reliable
* V3
- Make cache files can be shared between different build dirs
- Add task do_cleanccache
- Make cmake work with ccache
- Upgrade ccache to 3.5, this version has a debug mode, which is useful for figuring out why a cache file is not used.
* V2
- Fix comments from Martin Jansa and Martin Hundebøll.
- Fix RP's comments:
1) Add comments for ccache related code in base.bbclass
2) Remove all ccache-native's dependencies so that all recipes can depend on and use it.
- Update test_ccache_tool in oeqa
* V1
Initial version
The following changes since commit 20aea61385e1a53ac245353899277ba20104ed2f:
gcc: Drop 7.3 since 8.2 is working fine for us (2018-12-15 17:10:44 +0000)
are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib rbt/ccache
http://cgit.openembedded.org/openembedded-core-contrib/log/?h=rbt/ccache
Robert Yang (11):
ccache-native: Remove dependencies
ccache: 3.4.2 -> 3.5
ccache.bbclass: Refactor it to make it more reliable ccache.bbclass: Make it can be shared between different builds ccache.bbclass: Add task do_cleanccache ccache.bbclass: Set CCACHE_CONFIGPATH to fix race issues bitbake.conf: Enable -fdebug-prefix-map for nativesdk goarch.bbclass: Set CCACHE_DISABLE
cmake.bbclass: Make it work with ccache apr/openssl10: Enable ccache for them oeqa/selftest/cases: Update test_ccache_tool
meta/classes/ccache.bbclass | 63 ++++++++++++++++++++-- meta/classes/cmake.bbclass | 21 +++++--- meta/classes/goarch.bbclass | 4 ++ meta/conf/bitbake.conf | 8 +-- meta/conf/ccache.conf | 2 + meta/conf/layer.conf | 1 - meta/lib/oe/utils.py | 3 ++ meta/lib/oeqa/selftest/cases/buildoptions.py | 10 ++-- .../openssl/openssl10_1.0.2q.bb | 3 -- meta/recipes-devtools/ccache/ccache.inc | 13 ++++- meta/recipes-devtools/ccache/ccache_3.4.2.bb | 11 ---- meta/recipes-devtools/ccache/ccache_3.5.bb | 11 ++++ meta/recipes-graphics/piglit/piglit_git.bb | 3 ++ meta/recipes-graphics/vulkan/vulkan_1.1.73.0.bb | 3 ++ meta/recipes-sato/webkit/webkitgtk_2.22.4.bb | 3 ++ meta/recipes-support/apr/apr_1.6.5.bb | 5 -- 16 files changed, 122 insertions(+), 42 deletions(-) create mode 100644 meta/conf/ccache.conf delete mode 100644 meta/recipes-devtools/ccache/ccache_3.4.2.bb create mode 100644 meta/recipes-devtools/ccache/ccache_3.5.bb
Signature · 1 line
2.7.4
PATCH v3 4/11 ccache.bbclass: Make it can be shared between different builds
CCACHE_BASEDIR: ccache removes this from file path, so that hashes will be
the same in different build dirs.
CCACHE_TOP_DIR: Set it to a shared location for different builds.
--- meta/classes/ccache.bbclass | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
meta/classes/ccache.bbclass +21 -1
@@ -8,8 +8,28 @@ # Add the following line to the recipe if it can't be built with ccache: # CCACHE_DISABLE = '1' # +# - Share ccache files between different builds +# Set CCACHE_TOP_DIR to a shared dir +# CCACHE_TOP_DIR = /path/to/shared_ccache/ +# +# - TO debug ccahe +# export CCACHE_DEBUG = "1" +# export CCACHE_LOGFILE = "${CCACHE_DIR}/logfile.log" +# And also set PARALLEL_MAKE = "-j 1" to get make the log in order +# + +# Set it to a shared location for different builds, so that cache files can +# be shared between different builds. +CCACHE_TOP_DIR ?= "${TMPDIR}/ccache" + +# ccahe removes CCACHE_BASEDIR from file path, so that hashes will be the same +# in different builds. +export CCACHE_BASEDIR ?= "${TMPDIR}" + +# Used for sharing cache files after compiler is rebuilt +export CCACHE_COMPILERCHECK ?= "%compiler% -dumpspecs" -export CCACHE_DIR ?= "${TMPDIR}/ccache/${MULTIMACH_TARGET_SYS}/${PN}" +export CCACHE_DIR ?= "${CCACHE_TOP_DIR}/${MULTIMACH_TARGET_SYS}/${PN}" # We need to stop ccache considering the current directory or the # debug-prefix-map target directory to be significant when calculating
Signature · 1 line
2.7.4
PATCH v3 5/11 ccache.bbclass: Add task do_cleanccache
In reply to Robert Yang--- meta/classes/ccache.bbclass | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
meta/classes/ccache.bbclass +14 -0
@@ -48,3 +48,17 @@ python() { d.appendVar('DEPENDS', ' ccache-native') d.setVar('CCACHE', 'ccache ') } + +addtask cleanccache after do_clean +python do_cleanccache() { + import shutil + + ccache_dir = d.getVar('CCACHE_DIR') + if os.path.exists(ccache_dir): + bb.note("Removing %s" % ccache_dir) + shutil.rmtree(ccache_dir) + else: + bb.note("%s doesn't exist" % ccache_dir) +} +addtask cleanall after do_cleanccache +do_cleanccache[nostamp] = "1"
Signature · 1 line
2.7.4
PATCH v3 3/11 ccache.bbclass: Refactor it to make it more reliable
In reply to Robert YangThe previous ccache.bbclass has the following problems:
- It uses host's ccache for native recipes, but this may not work on some hosts, for example, it nerver works on my Ubuntu 14.04.4, there are always build failures (m4-native failed at do_configure, and others will also be failed if I disable CCACHE for m4-native)
- native/nativesdk/cross/crosssdk recipes use host's ccahe, but target uses ccache-native, this may confuse user.
- The target recipes may use both host's ccache and ccache-native, this may cause unexpected problems and hard to debug. This is because ccache-native is in SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS, so ccache-native may not be present when rebuild target recipes, and then it would use hosttools/ccache, but the previous ccache files were generated by ccache-native.
- Target recipes can't use ccache when no ccahe is installed on the host:
CCACHE = "${@bb.utils.which(d.getVar('PATH'), 'ccache') and 'ccache '}"
After refactored:
All types recipes (native, target and others) will use ccache-native except ccache-native itself, host's cache won't be used any more. It is more reliable now, which will work everywhere when ccache-native can be built.
And now we need use "CCACHE_DISABLE = '1'" to disable ccahe for the recipe rather than "CCACHE = ''" since we set CCACHE in anonymous function, and d.getVar('CCACHE') works after "CCACHE ??=" which is set in bitbake.conf, so we can't check whether CCACHE is set or not in anonymous function since it is always set. Use CCACHE_DISABLE to disable it would be more clear.
--- meta/classes/ccache.bbclass | 25 ++++++++++++++++++++++--- meta/conf/bitbake.conf | 6 +----- meta/conf/layer.conf | 1 - meta/lib/oe/utils.py | 3 +++ 4 files changed, 26 insertions(+), 9 deletions(-)
meta/classes/ccache.bbclass +22 -3
@@ -1,4 +1,14 @@ -CCACHE = "${@bb.utils.which(d.getVar('PATH'), 'ccache') and 'ccache '}" +# +# Usage: +# - Enable ccache +# Add the following line to a conffile such as conf/local.conf: +# INHERIT += "ccache" +# +# - Disable ccache for a recipe +# Add the following line to the recipe if it can't be built with ccache: +# CCACHE_DISABLE = '1' +# + export CCACHE_DIR ?= "${TMPDIR}/ccache/${MULTIMACH_TARGET_SYS}/${PN}" # We need to stop ccache considering the current directory or the
@@ -7,5 +17,14 @@ export CCACHE_DIR ?= "${TMPDIR}/ccache/${MULTIMACH_TARGET_SYS}/${PN}" # ${PV} or ${PR} change. export CCACHE_NOHASHDIR ?= "1" -DEPENDS_append_class-target = " ccache-native" -DEPENDS[vardepvalueexclude] = " ccache-native" +python() { + """ + Enable ccache for the recipe + """ + pn = d.getVar('PN') + # quilt-native doesn't need ccache since no c files + if not (pn in ('ccache-native', 'quilt-native') or + bb.utils.to_boolean(d.getVar('CCACHE_DISABLE'))): + d.appendVar('DEPENDS', ' ccache-native') + d.setVar('CCACHE', 'ccache ') +}
meta/conf/bitbake.conf +1 -5
@@ -492,7 +492,7 @@ HOSTTOOLS += " \ HOSTTOOLS += "${@'ip ping ps scp ssh stty' if (bb.utils.contains_any('IMAGE_CLASSES', 'testimage testsdk', True, False, d) or any(x in (d.getVar("BBINCLUDED") or "") for x in ["testimage.bbclass", "testsdk.bbclass"])) else ''}" # Link to these if present -HOSTTOOLS_NONFATAL += "aws ccache gcc-ar gpg ld.bfd ld.gold nc pigz sftp socat ssh sudo" +HOSTTOOLS_NONFATAL += "aws gcc-ar gpg ld.bfd ld.gold nc pigz sftp socat ssh sudo" # Temporary add few more detected in bitbake world HOSTTOOLS_NONFATAL += "join nl size yes zcat"
@@ -504,10 +504,6 @@ HOSTTOOLS_NONFATAL += "bzr" HOSTTOOLS_NONFATAL += "scp" CCACHE ??= "" -# ccache < 3.1.10 will create CCACHE_DIR on startup even if disabled, and -# autogen sets HOME=/dev/null so in certain situations builds can fail. -# Explicitly export CCACHE_DIR until we can assume ccache >3.1.10 on the host. -export CCACHE_DIR ??= "${@os.getenv('HOME')}/.ccache" TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TARGET}"
meta/conf/layer.conf +0 -1
@@ -49,7 +49,6 @@ SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS += " \ *->quilt-native \ *->subversion-native \ *->git-native \ - *->ccache-native \ *->icecc-create-env-native \ gcc-cross-${TARGET_ARCH}->virtual/${TARGET_PREFIX}libc-for-gcc \ gcc-cross-${TARGET_ARCH}->linux-libc-headers \
meta/lib/oe/utils.py +3 -0
@@ -363,6 +363,9 @@ def host_gcc_version(d, taskcontextonly=False): return compiler = d.getVar("BUILD_CC") + # Get rid of ccache since it is not present when parsing. + if compiler.startswith('ccache '): + compiler = compiler[7:] try: env = os.environ.copy() env["PATH"] = d.getVar("PATH")
Signature · 1 line
2.7.4
PATCH v3 6/11 ccache.bbclass: Set CCACHE_CONFIGPATH to fix race issues
In reply to Robert YangFixed race issues when parallel build:
ccache: error: /path/to/ccache/i586-poky-linux/mmc-utils/ccache.conf: No such file or directory
ccache: error: /path/to/ccache/i586-poky-linux/mmc-utils/ccache.conf: No such file or directory
This is because we set CCACHE_DIR for earch recipe, and ccache will create a ccache.conf for each CCACHE_DIR when CCACHE_CONFIGPATH is not set, but there might be a race issue in parallel build:
ccache gcc file1.c
ccache gcc file2.c
If the two ccache processes use fopen(path, "w") to create ccache.conf at the same time, the error would happen. Set CCACHE_CONFIGPATH to meta/conf/ccache.conf can fix the problem, and we can add other configs to the file when needed.
And also set cache_dir_levels to 1 (default is 2) since each recipe has a cache dir, thus we don't have too many files in one dir.
--- meta/classes/ccache.bbclass | 2 ++ meta/conf/ccache.conf | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 meta/conf/ccache.conf
meta/classes/ccache.bbclass +2 -0
@@ -29,6 +29,8 @@ export CCACHE_BASEDIR ?= "${TMPDIR}" # Used for sharing cache files after compiler is rebuilt export CCACHE_COMPILERCHECK ?= "%compiler% -dumpspecs" +export CCACHE_CONFIGPATH ?= "${COREBASE}/meta/conf/ccache.conf" + export CCACHE_DIR ?= "${CCACHE_TOP_DIR}/${MULTIMACH_TARGET_SYS}/${PN}" # We need to stop ccache considering the current directory or the
meta/conf/ccache.conf new file +2 -0
@@ -0,0 +1,2 @@ +max_size = 0 +cache_dir_levels = 1
Signature · 1 line
2.7.4
PATCH v3 8/11 goarch.bbclass: Set CCACHE_DISABLE
In reply to Robert YangGo can't be built with ccache.
--- meta/classes/goarch.bbclass | 4 ++++ 1 file changed, 4 insertions(+)
meta/classes/goarch.bbclass +4 -0
@@ -42,6 +42,10 @@ TUNE_CCARGS_remove = "-march=mips32r2" SECURITY_CFLAGS_mipsarch = "${SECURITY_NOPIE_CFLAGS}" SECURITY_NOPIE_CFLAGS ??= "" +# go can't be built with ccache: +# gcc: fatal error: no input files +CCACHE_DISABLE ?= "1" + def go_map_arch(a, d): import re if re.match('i.86', a):
Signature · 1 line
2.7.4
PATCH v3 9/11 cmake.bbclass: Make it work with ccache
In reply to Robert YangThis can make the following recipes work with cmake:
cmake libdnf libcomps librepo createrepo-c llvm dnf libsolv assimp waffle libjpeg-turbo taglib libproxy libical
And the following 3 recipes don't:
webkitgtk vulkan piglit
Now cmake.bbclass doesn't disble ccache any more, disable it in the recipes if needed.
--- meta/classes/cmake.bbclass | 21 +++++++++++++++------ meta/recipes-graphics/piglit/piglit_git.bb | 3 +++ meta/recipes-graphics/vulkan/vulkan_1.1.73.0.bb | 3 +++ meta/recipes-sato/webkit/webkitgtk_2.22.4.bb | 3 +++ 4 files changed, 24 insertions(+), 6 deletions(-)
meta/classes/cmake.bbclass +15 -6
@@ -4,9 +4,6 @@ OECMAKE_SOURCEPATH ??= "${S}" DEPENDS_prepend = "cmake-native " B = "${WORKDIR}/build" -# We need to unset CCACHE otherwise cmake gets too confused -CCACHE = "" - # What CMake generator to use. # The supported options are "Unix Makefiles" or "Ninja". OECMAKE_GENERATOR ?= "Ninja"
@@ -23,10 +20,22 @@ python() { d.setVarFlag("do_compile", "progress", r"outof:^\[(\d+)/(\d+)\]\s+") else: bb.fatal("Unknown CMake Generator %s" % generator) + + # C/C++ Compiler (without cpu arch/tune arguments) + if not d.getVar('OECMAKE_C_COMPILER'): + cc_list = d.getVar('CC').split() + if cc_list[0] == 'ccache': + d.setVar('OECMAKE_C_COMPILER', '%s %s' % (cc_list[0], cc_list[1])) + else: + d.setVar('OECMAKE_C_COMPILER', cc_list[0]) + + if not d.getVar('OECMAKE_CXX_COMPILER'): + cxx_list = d.getVar('CXX').split() + if cxx_list[0] == 'ccache': + d.setVar('OECMAKE_CXX_COMPILER', '%s %s' % (cxx_list[0], cxx_list[1])) + else: + d.setVar('OECMAKE_CXX_COMPILER', cxx_list[0]) } -# C/C++ Compiler (without cpu arch/tune arguments) -OECMAKE_C_COMPILER ?= "`echo ${CC} | sed 's/^\([^ ]*\).*/\1/'`" -OECMAKE_CXX_COMPILER ?= "`echo ${CXX} | sed 's/^\([^ ]*\).*/\1/'`" OECMAKE_AR ?= "${AR}" # Compiler flags
meta/recipes-graphics/piglit/piglit_git.bb +3 -0
@@ -52,3 +52,6 @@ RDEPENDS_${PN} = "waffle waffle-bin python3 python3-mako python3-json \ " INSANE_SKIP_${PN} += "dev-so already-stripped" + +# Can't be built with ccache +CCACHE_DISABLE = "1"
meta/recipes-graphics/vulkan/vulkan_1.1.73.0.bb +3 -0
@@ -35,3 +35,6 @@ PACKAGECONFIG[wayland] = "-DBUILD_WSI_WAYLAND_SUPPORT=ON, -DBUILD_WSI_WAYLAND_SU RRECOMMENDS_${PN} = "mesa-vulkan-drivers" INSANE_SKIP_${PN}-dev += "dev-elf" + +# Can't be built with ccache +CCACHE_DISABLE = "1"
meta/recipes-sato/webkit/webkitgtk_2.22.4.bb +3 -0
@@ -121,3 +121,6 @@ ARM_INSTRUCTION_SET_armv7ve = "thumb" # Segmentation fault GI_DATA_ENABLED_armv7a = "False" GI_DATA_ENABLED_armv7ve = "False" + +# Can't be built with ccache +CCACHE_DISABLE = "1"
Signature · 1 line
2.7.4
PATCH v3 7/11 bitbake.conf: Enable -fdebug-prefix-map for nativesdk
In reply to Robert YangFiles like lib/.debug/libgcc_s.so.1 from nativesdk-libgcc-dbg contains buildpath without -fdebug-prefix-map, the root cause is object files (.o) contain buildpath, and then ccache can't use them correctly.
--- meta/conf/bitbake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/conf/bitbake.conf +1 -1
@@ -558,7 +558,7 @@ export CPPFLAGS = "${TARGET_CPPFLAGS}" export TARGET_CPPFLAGS = "" export BUILD_CFLAGS = "${BUILD_CPPFLAGS} ${BUILD_OPTIMIZATION}" -BUILDSDK_CFLAGS = "${BUILDSDK_CPPFLAGS} ${BUILD_OPTIMIZATION}" +BUILDSDK_CFLAGS = "${BUILDSDK_CPPFLAGS} ${BUILD_OPTIMIZATION} ${DEBUG_PREFIX_MAP}" export CFLAGS = "${TARGET_CFLAGS}" export TARGET_CFLAGS = "${TARGET_CPPFLAGS} ${SELECTED_OPTIMIZATION}"
Signature · 1 line
2.7.4
PATCH v3 11/11 oeqa/selftest/cases: Update test_ccache_tool
In reply to Robert YangNow we can compile m4-native rather than target m4, this can save a lot of build time.
--- meta/lib/oeqa/selftest/cases/buildoptions.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
meta/lib/oeqa/selftest/cases/buildoptions.py +5 -5
@@ -37,13 +37,13 @@ class ImageOptionsTests(OESelftestTestCase): p = bb_vars['SYSROOT_DESTDIR'] + bb_vars['bindir'] + "/" + "ccache" self.assertTrue(os.path.isfile(p), msg = "No ccache found (%s)" % p) self.write_config('INHERIT += "ccache"') - self.add_command_to_tearDown('bitbake -c clean m4') - bitbake("m4 -c clean") - bitbake("m4 -f -c compile") - log_compile = os.path.join(get_bb_var("WORKDIR","m4"), "temp/log.do_compile") + self.add_command_to_tearDown('bitbake -c clean m4-native') + bitbake("m4-native -c clean") + bitbake("m4-native -f -c compile") + log_compile = os.path.join(get_bb_var("WORKDIR","m4-native"), "temp/log.do_compile") with open(log_compile, "r") as f: loglines = "".join(f.readlines()) - self.assertIn("ccache", loglines, msg="No match for ccache in m4 log.do_compile. For further details: %s" % log_compile) + self.assertIn("ccache", loglines, msg="No match for ccache in m4-native log.do_compile. For further details: %s" % log_compile) @OETestID(1435) def test_read_only_image(self):
Signature · 1 line
2.7.4
PATCH v3 10/11 apr/openssl10: Enable ccache for them
In reply to Robert YangThey work well now.
--- meta/recipes-connectivity/openssl/openssl10_1.0.2q.bb | 3 --- meta/recipes-support/apr/apr_1.6.5.bb | 5 ----- 2 files changed, 8 deletions(-)
meta/recipes-connectivity/openssl/openssl10_1.0.2q.bb +0 -3
@@ -76,9 +76,6 @@ EXTRA_OEMAKE = "${@bb.utils.contains('PACKAGECONFIG', 'manpages', '', 'OE_DISABL export OE_LDFLAGS = "${LDFLAGS}" -# openssl fails with ccache: https://bugzilla.yoctoproject.org/show_bug.cgi?id=12810 -CCACHE = "" - TERMIO ?= "-DTERMIO" TERMIO_libc-musl = "-DTERMIOS" EXTRA_OECONF_append_libc-musl_powerpc64 = " no-asm"
meta/recipes-support/apr/apr_1.6.5.bb +0 -5
@@ -37,11 +37,6 @@ CACHED_CONFIGUREVARS += "ac_cv_header_netinet_sctp_h=no ac_cv_header_netinet_sct CACHED_CONFIGUREVARS += "ac_cv_sizeof_struct_iovec=yes" CACHED_CONFIGUREVARS += "ac_cv_file__dev_zero=yes" -# Otherwise libtool fails to compile apr-utils -# x86_64-linux-libtool: compile: unable to infer tagged configuration -# x86_64-linux-libtool: error: specify a tag with '--tag' -CCACHE = "" - PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}" PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,"
Signature · 1 line
2.7.4
✗ patchtest: failure for ccache.bbclass: Refactor it to make it more reliable (rev3)
In reply to Robert Yang== Series Details ==
Series: ccache.bbclass: Refactor it to make it more reliable (rev3)
Revision: 3
URL : https://patchwork.openembedded.org/series/15276/
State : failure
== Summary ==
Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures:
* Issue LIC_FILES_CHKSUM changed on target ccache but there is no "License-Update" tag in commit message [test_lic_files_chksum_modified_not_mentioned]
Suggested fix Include "License-Update: <description>" into the commit message with a brief description
Current checksum file://LICENSE.adoc;md5=2722abeaf1750dbf175b9491112374e1
New checksum file://LICENSE.adoc;md5=39f34d6ff4df51ed718fd7d243fc4e51
If you believe any of these test results are incorrect, please reply to the mailing list ([email protected]) raising your concerns. Otherwise we would appreciate you correcting the issues and submitting a new version of the patchset if applicable. Please ensure you add/increment the version number when sending the new version (i.e. [PATCH] -> [PATCH v2] -> [PATCH v3] -> ...).
---
Guidelines: https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest Test suite: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe
Re: ✗ patchtest: failure for ccache.bbclass: Refactor it to make it more reliable (rev3)
Fixed in the repo:
ccache: 3.4.2 -> 3.5
License-Update: Copyright year and zlib version are changed, others are the same.
This version supports CCACHE_DEBUG which will make the debug easier.
// Robert
Quoted 36 lines · Patchwork
== Series Details ==
Series: ccache.bbclass: Refactor it to make it more reliable (rev3)
Revision: 3
URL : https://patchwork.openembedded.org/series/15276/
State : failure== Summary ==
Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures:
* Issue
LIC_FILES_CHKSUMchanged on target ccache but there is no "License-Update" tag in commit message [test_lic_files_chksum_modified_not_mentioned]
Suggested fix Include "License-Update: <description>" into the commit message with a brief description
Current checksum file://LICENSE.adoc;md5=2722abeaf1750dbf175b9491112374e1
New checksum file://LICENSE.adoc;md5=39f34d6ff4df51ed718fd7d243fc4e51If you believe any of these test results are incorrect, please reply to the mailing list ([email protected]) raising your concerns. Otherwise we would appreciate you correcting the issues and submitting a new version of the patchset if applicable. Please ensure you add/increment the version number when sending the new version (i.e. [PATCH] -> [PATCH v2] -> [PATCH v3] -> ...).
---
Guidelines: https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest Test suite: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe
Hi RP,
Do you have any comments on this, please? It's really very useful during development. It can save both configure and compile time in the second run, It can save about 8 minutes (30m -> 22m) if I rebuild core-image-minimal totally without any sstate caches.
// Robert
Quoted 61 lines · Robert Yang
* V3
- Make cache files can be shared between different build dirs
- Add taskdo_cleanccache
- Make cmake work with ccache
- Upgrade ccache to 3.5, this version has a debug mode, which is useful for figuring out why a cache file is not used.* V2
- Fix comments from Martin Jansa and Martin Hundebøll.
- Fix RP's comments:
1) Add comments for ccache related code in base.bbclass
2) Remove all ccache-native's dependencies so that all recipes can depend on and use it.
- Updatetest_ccache_toolin oeqa* V1
Initial versionThe following changes since commit
20aea61385e1a53ac245353899277ba20104ed2f:gcc: Drop 7.3 since 8.2 is working fine for us (2018-12-15 17:10:44 +0000)
are available in the git repository at:
git://git.openembedded.org/openembedded-core-contribrbt/ccache
http://cgit.openembedded.org/openembedded-core-contrib/log/?h=rbt/ccacheRobert Yang (11):
ccache-native: Remove dependencies
ccache: 3.4.2 -> 3.5
ccache.bbclass: Refactor it to make it more reliable ccache.bbclass: Make it can be shared between different builds ccache.bbclass: Add taskdo_cleanccacheccache.bbclass: SetCCACHE_CONFIGPATHto fix race issues bitbake.conf: Enable -fdebug-prefix-map for nativesdk goarch.bbclass: SetCCACHE_DISABLE
cmake.bbclass: Make it work with ccache apr/openssl10: Enable ccache for them oeqa/selftest/cases: Updatetest_ccache_toolmeta/classes/ccache.bbclass | 63 ++++++++++++++++++++-- meta/classes/cmake.bbclass | 21 +++++--- meta/classes/goarch.bbclass | 4 ++ meta/conf/bitbake.conf | 8 +-- meta/conf/ccache.conf | 2 + meta/conf/layer.conf | 1 - meta/lib/oe/utils.py | 3 ++ meta/lib/oeqa/selftest/cases/buildoptions.py | 10 ++-- .../openssl/openssl10_1.0.2q.bb | 3 -- meta/recipes-devtools/ccache/ccache.inc | 13 ++++- meta/recipes-devtools/ccache/ccache_3.4.2.bb | 11 ---- meta/recipes-devtools/ccache/ccache_3.5.bb | 11 ++++ meta/recipes-graphics/piglit/piglit_git.bb | 3 ++ meta/recipes-graphics/vulkan/vulkan_1.1.73.0.bb | 3 ++ meta/recipes-sato/webkit/webkitgtk_2.22.4.bb | 3 ++ meta/recipes-support/apr/apr_1.6.5.bb | 5 -- 16 files changed, 122 insertions(+), 42 deletions(-)create mode 100644
meta/conf/ccache.conf
delete mode 100644 meta/recipes-devtools/ccache/ccache_3.4.2.bb create mode 100644 meta/recipes-devtools/ccache/ccache_3.5.bb
A couple of typos and grammar improvements, otherwise a good improvement for iterative development of a package/image where sstate isn't useful.
Quoted 7 lines · Robert Yang
The previous ccache.bbclass has the following problems:
- It uses host's ccache for native recipes, but this may not work on some hosts, for example, it nerver works on my Ubuntu 14.04.4, there are always build failures (m4-native failed atdo_configure, and others will also be failed if I disable CCACHE for m4-native)- native/nativesdk/cross/crosssdk recipes use host's ccahe, but target uses
* host's ccache
Quoted 4 lines
ccache-native, this may confuse user.
- The target recipes may use both host's ccache and ccache-native, this may cause unexpected problems and hard to debug. This is because ccache-native is
* and be hard to debug
Quoted 5 lines
in
SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS, so ccache-native may not be present when rebuild target recipes, and then it would use hosttools/ccache, but the previous ccache files were generated by ccache-native.- Target recipes can't use ccache when no ccahe is installed on the host:
* no ccache
Quoted 8 lines
CCACHE = "${@bb.utils.which(d.getVar('PATH'), 'ccache') and 'ccache '}"After refactored:
All types recipes (native, target and others) will use ccache-native except ccache-native itself, host's cache won't be used any more. It is more reliable now, which will work everywhere when ccache-native can be built.And now we need use "
CCACHE_DISABLE= '1'" to disable ccahe for the recipe
* disable ccache
../Randy
Quoted 101 lines
rather than "CCACHE = ''" since we set CCACHE in anonymous function, and
d.getVar('CCACHE')works after "CCACHE ??=" which is set in bitbake.conf, so we can't check whether CCACHE is set or not in anonymous function since it is always set. UseCCACHE_DISABLEto disable it would be more clear.Signed-off-by Robert Yang <[email protected]>--- meta/classes/ccache.bbclass | 25 ++++++++++++++++++++++--- meta/conf/bitbake.conf | 6 +----- meta/conf/layer.conf | 1 - meta/lib/oe/utils.py | 3 +++ 4 files changed, 26 insertions(+), 9 deletions(-)meta/classes/ccache.bbclass +22
-3@@ -1,4 +1,14 @@ -CCACHE = "${@bb.utils.which(d.getVar('PATH'), 'ccache') and 'ccache '}" +# +# Usage: +# - Enable ccache +# Add the following line to a conffile such as conf/local.conf: +# INHERIT += "ccache" +# +# - Disable ccache for a recipe +# Add the following line to the recipe if it can't be built with ccache: +# CCACHE_DISABLE = '1' +# + export CCACHE_DIR ?= "${TMPDIR}/ccache/${MULTIMACH_TARGET_SYS}/${PN}" # We need to stop ccache considering the current directory or the@@ -7,5 +17,14 @@ export CCACHE_DIR ?= "${TMPDIR}/ccache/${MULTIMACH_TARGET_SYS}/${PN}" # ${PV} or ${PR} change. export CCACHE_NOHASHDIR ?= "1" -DEPENDS_append_class-target = " ccache-native" -DEPENDS[vardepvalueexclude] = " ccache-native" +python() { + """ + Enable ccache for the recipe + """ + pn = d.getVar('PN') + # quilt-native doesn't need ccache since no c files + if not (pn in ('ccache-native', 'quilt-native') or + bb.utils.to_boolean(d.getVar('CCACHE_DISABLE'))): + d.appendVar('DEPENDS', ' ccache-native') + d.setVar('CCACHE', 'ccache ') +}meta/conf/bitbake.conf +1
-5@@ -492,7 +492,7 @@ HOSTTOOLS += " \ HOSTTOOLS += "${@'ip ping ps scp ssh stty' if (bb.utils.contains_any('IMAGE_CLASSES', 'testimage testsdk', True, False, d) or any(x in (d.getVar("BBINCLUDED") or "") for x in ["testimage.bbclass", "testsdk.bbclass"])) else ''}" # Link to these if present -HOSTTOOLS_NONFATAL += "aws ccache gcc-ar gpg ld.bfd ld.gold nc pigz sftp socat ssh sudo" +HOSTTOOLS_NONFATAL += "aws gcc-ar gpg ld.bfd ld.gold nc pigz sftp socat ssh sudo" # Temporary add few more detected in bitbake world HOSTTOOLS_NONFATAL += "join nl size yes zcat"@@ -504,10 +504,6 @@ HOSTTOOLS_NONFATAL += "bzr" HOSTTOOLS_NONFATAL += "scp" CCACHE ??= "" -# ccache < 3.1.10 will create CCACHE_DIR on startup even if disabled, and -# autogen sets HOME=/dev/null so in certain situations builds can fail. -# Explicitly export CCACHE_DIR until we can assume ccache >3.1.10 on the host. -export CCACHE_DIR ??= "${@os.getenv('HOME')}/.ccache" TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TARGET}"meta/conf/layer.conf +0
-1@@ -49,7 +49,6 @@ SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS += " \ *->quilt-native \ *->subversion-native \ *->git-native \ - *->ccache-native \ *->icecc-create-env-native \ gcc-cross-${TARGET_ARCH}->virtual/${TARGET_PREFIX}libc-for-gcc \ gcc-cross-${TARGET_ARCH}->linux-libc-headers \meta/lib/oe/utils.py +3
-0@@ -363,6 +363,9 @@ def host_gcc_version(d, taskcontextonly=False): return compiler = d.getVar("BUILD_CC") + # Get rid of ccache since it is not present when parsing. + if compiler.startswith('ccache '): + compiler = compiler[7:] try: env = os.environ.copy() env["PATH"] = d.getVar("PATH")
Signature · 2 lines
# Randy MacLeod # Wind River Linux
Hi Randy,
I'm sorry for the types, and thanks for the correction. I found that it has been merged, I will be more careful.
// Robert
Quoted 136 lines · Randy MacLeod
A couple of typos and grammar improvements, otherwise a good improvement for iterative development of a package/image where sstate isn't useful.
Quoted 7 lines · Robert Yang
The previous ccache.bbclass has the following problems:
- It uses host's ccache for native recipes, but this may not work on some hosts, for example, it nerver works on my Ubuntu 14.04.4, there are always build failures (m4-native failed atdo_configure, and others will also be failed if I disable CCACHE for m4-native)- native/nativesdk/cross/crosssdk recipes use host's ccahe, but target uses
* host's ccache
Quoted 4 lines
ccache-native, this may confuse user.
- The target recipes may use both host's ccache and ccache-native, this may cause unexpected problems and hard to debug. This is because ccache-native is
* and be hard to debug
Quoted 5 lines
in
SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS, so ccache-native may not be present when rebuild target recipes, and then it would use hosttools/ccache, but the previous ccache files were generated by ccache-native.- Target recipes can't use ccache when no ccahe is installed on the host:
* no ccache
Quoted 8 lines
CCACHE = "${@bb.utils.which(d.getVar('PATH'), 'ccache') and 'ccache '}"
After refactored:
All types recipes (native, target and others) will use ccache-native except ccache-native itself, host's cache won't be used any more. It is more reliable now, which will work everywhere when ccache-native can be built.And now we need use "
CCACHE_DISABLE= '1'" to disable ccahe for the recipe* disable ccache
../Randy
Quoted 96 lines
rather than "CCACHE = ''" since we set CCACHE in anonymous function, and
d.getVar('CCACHE')works after "CCACHE ??=" which is set in bitbake.conf, so we can't check whether CCACHE is set or not in anonymous function since it is always set. UseCCACHE_DISABLEto disable it would be more clear.Signed-off-by Robert Yang <[email protected]>---
meta/classes/ccache.bbclass | 25 ++++++++++++++++++++++--- meta/conf/bitbake.conf | 6 +----- meta/conf/layer.conf | 1 - meta/lib/oe/utils.py | 3 +++4 files changed, 26 insertions(+), 9 deletions(-)meta/classes/ccache.bbclass +11
-1@@ -1,4 +1,14 @@ -CCACHE = "${@bb.utils.which(d.getVar('PATH'), 'ccache') and 'ccache '}" +# +# Usage: +# - Enable ccache +# Add the following line to a conffile such as conf/local.conf: +# INHERIT += "ccache" +# +# - Disable ccache for a recipe +# Add the following line to the recipe if it can't be built with ccache: +# CCACHE_DISABLE = '1' +# +export
CCACHE_DIR?= "${TMPDIR}/ccache/${MULTIMACH_TARGET_SYS}/${PN}" # We need to stop ccache considering the current directory or themeta/classes/ccache.bbclass +0
-0@@ -7,5 +17,14 @@ export CCACHE_DIR ?="${TMPDIR}/ccache/${MULTIMACH_TARGET_SYS}/${PN}"
# ${PV} or ${PR} change.
exportCCACHE_NOHASHDIR?= "1"meta/classes/ccache.bbclass +11
-2-DEPENDS_append_class-target = " ccache-native" -DEPENDS[vardepvalueexclude] = " ccache-native" +python() { + """ + Enable ccache for the recipe + """ + pn = d.getVar('PN') + # quilt-native doesn't need ccache since no c files + if not (pn in ('ccache-native', 'quilt-native') or + bb.utils.to_boolean(d.getVar('CCACHE_DISABLE'))): + d.appendVar('DEPENDS', ' ccache-native') + d.setVar('CCACHE', 'ccache ') +}meta/conf/bitbake.conf +0
-0@@ -492,7 +492,7 @@ HOSTTOOLS += " \HOSTTOOLS += "${@'ip ping ps scp ssh stty' if (
bb.utils.contains_any('IMAGE_CLASSES', 'testimage testsdk', True, False, d)orany(x in (d.getVar("BBINCLUDED") or "") for x in ["testimage.bbclass", "testsdk.bbclass"])) else ''}" # Link to these if present
-HOSTTOOLS_NONFATAL += "aws ccache gcc-ar gpg ld.bfd ld.gold nc pigz sftp
socat ssh sudo"
+HOSTTOOLS_NONFATAL += "aws gcc-ar gpg ld.bfd ld.gold nc pigz sftp socat ssh
sudo"
# Temporary add few more detected in bitbake world
HOSTTOOLS_NONFATAL+= "join nl size yes zcat"meta/conf/bitbake.conf +0
-0@@ -504,10 +504,6 @@ HOSTTOOLS_NONFATAL += "bzr"
HOSTTOOLS_NONFATAL+= "scp"
CCACHE ??= ""meta/conf/bitbake.conf +0
-4-# ccache < 3.1.10 will create CCACHE_DIR on startup even if disabled, and -# autogen sets HOME=/dev/null so in certain situations builds can fail. -# Explicitly export CCACHE_DIR until we can assume ccache >3.1.10 on the host. -export CCACHE_DIR ??= "${@os.getenv('HOME')}/.ccache"
TOOLCHAIN_OPTIONS= " --sysroot=${STAGING_DIR_TARGET}"meta/conf/layer.conf +0
-1@@ -49,7 +49,6 @@ SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS += " \ *->quilt-native \ *->subversion-native \ *->git-native \ - *->ccache-native \ *->icecc-create-env-native \ gcc-cross-${TARGET_ARCH}->virtual/${TARGET_PREFIX}libc-for-gcc \ gcc-cross-${TARGET_ARCH}->linux-libc-headers \meta/lib/oe/utils.py +0
-0@@ -363,6 +363,9 @@ def host_gcc_version(d, taskcontextonly=False):return
compiler =d.getVar("BUILD_CC")
+ # Get rid of ccache since it is not present when parsing. + ifcompiler.startswith('ccache '):
+ compiler = compiler[7:]
try:
env =os.environ.copy()
env["PATH"] =d.getVar("PATH")
Quoted 5 lines · Robert Yang
Hi Randy,
I'm sorry for the types, and thanks for the correction. I found that it has
been merged, I will be more careful.
I did tweak the commit message!
Cheers,
Richard
Quoted 8 lines · Richard Purdie
Quoted 5 lines · Robert Yang
Hi Randy,
I'm sorry for the types, and thanks for the correction. I found that it has
been merged, I will be more careful.I did tweak the commit message!
Thank you very much!
// Robert
Quoted 6 lines
Cheers,
Richard