ccahe: ccache.bbclass: Use ccache-native and disable ccache for native recipes
cover ccahe: ccache.bbclass: Use ccache-native and disable ccache for native recipes
The following changes since commit 5f3cace37496fe1dc4fd045f688f7d441505c437:
boost: drop arm-intrinsics.patch (2021-01-17 11:27:59 +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 (3):
Revert "ccache.bbclass: use ccache from host distribution" ccache.bbclass: Use ccache-native and disable ccache for native
recipes
apt: Fix do_compile error when enable ccache
meta/classes/ccache.bbclass | 5 ++--- meta/conf/bitbake.conf | 2 +- meta/lib/oeqa/selftest/cases/buildoptions.py | 19 ++++++++++--------- meta/recipes-devtools/apt/apt_1.8.2.1.bb | 6 +++++- 4 files changed, 18 insertions(+), 14 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/3 Revert "ccache.bbclass: use ccache from host distribution"
This reverts commit f5b29367af4d8e5daea5771264774aa49519f9a8.
Will use ccache-native which is more reliable.
--- meta/classes/ccache.bbclass | 3 +-- meta/conf/bitbake.conf | 2 +- meta/lib/oeqa/selftest/cases/buildoptions.py | 8 ++++---- 3 files changed, 6 insertions(+), 7 deletions(-)
meta/classes/ccache.bbclass +1 -2
@@ -1,7 +1,5 @@ # # Usage: -# - Install ccache package on the host distribution and set up a build directory -# # - Enable ccache # Add the following line to a conffile such as conf/local.conf: # INHERIT += "ccache"
@@ -53,6 +51,7 @@ python() { # 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 -1
@@ -498,7 +498,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"
meta/lib/oeqa/selftest/cases/buildoptions.py +4 -4
@@ -33,10 +33,10 @@ class ImageOptionsTests(OESelftestTestCase): self.assertTrue(incremental_removed, msg = "Match failed in:\n%s" % log_data_removed) def test_ccache_tool(self): - bb_vars = get_bb_vars(['HOSTTOOLS_DIR'], 'm4-native') - p = bb_vars['HOSTTOOLS_DIR'] + "/" + "ccache" - if not os.path.isfile(p): - self.skipTest("No ccache binary found in %s" % bb_vars['HOSTTOOLS_DIR']) + bitbake("ccache-native") + bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'ccache-native') + 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-native') bitbake("m4-native -c clean")
Signature · 1 line
2.17.1
PATCH 2/3 ccache.bbclass: Use ccache-native and disable ccache for native recipes
In reply to Robert YangSince host's ccache is not reliable, so disable ccache for native recipes and use ccache-native for other types of recipes. We need disable ccache for native recipes is because ccache-native now depends on cmake-native which causes circular dependencies, and it's not easy to break the circular.
--- meta/classes/ccache.bbclass | 2 +- meta/lib/oeqa/selftest/cases/buildoptions.py | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-)
meta/classes/ccache.bbclass +1 -1
@@ -49,7 +49,7 @@ python() { """ pn = d.getVar('PN') # quilt-native doesn't need ccache since no c files - if not (pn in ('ccache-native', 'quilt-native') or + if not (bb.data.inherits_class("native", d) or bb.utils.to_boolean(d.getVar('CCACHE_DISABLE'))): d.appendVar('DEPENDS', ' ccache-native') d.setVar('CCACHE', 'ccache ')
meta/lib/oeqa/selftest/cases/buildoptions.py +6 -5
@@ -38,13 +38,14 @@ 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-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") + recipe = "binutils-cross-x86_64" + self.add_command_to_tearDown('bitbake -c clean %s' % recipe) + bitbake("%s -c clean" % recipe) + bitbake("%s -f -c compile" % recipe) + log_compile = os.path.join(get_bb_var("WORKDIR", recipe), "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-native log.do_compile. For further details: %s" % log_compile) + self.assertIn("ccache", loglines, msg="No match for ccache in %s log.do_compile. For further details: %s" % (recipe , log_compile)) def test_read_only_image(self): distro_features = get_bb_var('DISTRO_FEATURES')
Signature · 1 line
2.17.1
PATCH 3/3 apt: Fix do_compile error when enable ccache
In reply to Robert YangFixed:
apt-pkg/libapt-pkg.so.5.0.2: undefined reference to `ZSTD_endStream'
collect2: error: ld returned 1 exit status
This is because ccache-native depends on zstd-native which makes apt wronly find it. Disable zstd for apt to fix the problem.
--- meta/recipes-devtools/apt/apt_1.8.2.1.bb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
meta/recipes-devtools/apt/apt_1.8.2.1.bb +5 -1
@@ -40,7 +40,11 @@ BBCLASSEXTEND = "native nativesdk" DEPENDS += "virtual/libiconv virtual/libintl db gnutls lz4 zlib bzip2 xz" -EXTRA_OECMAKE_append = " -DCURRENT_VENDOR=debian -DWITH_DOC=False -DUSE_NLS=False -DDPKG_DATADIR=${datadir}/dpkg -DTRIEHASH_EXECUTABLE=${WORKDIR}/triehash" +EXTRA_OECMAKE_append = " -DCURRENT_VENDOR=debian -DWITH_DOC=False \ + -DUSE_NLS=False -DDPKG_DATADIR=${datadir}/dpkg \ + -DTRIEHASH_EXECUTABLE=${WORKDIR}/triehash \ + -DCMAKE_DISABLE_FIND_PACKAGE_Zstd=True \ +" do_configure_prepend () { echo "set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH )" >> ${WORKDIR}/toolchain.cmake
Signature · 1 line
2.17.1
Re: [OE-core] [PATCH 1/3] Revert "ccache.bbclass: use ccache from host distribution"
In reply to a message not in the archiveQuoted 36 lines · Robert Yang
This reverts commit
f5b29367af4d8e5daea5771264774aa49519f9a8.Will use ccache-native which is more reliable.
Signed-off-by Robert Yang <[email protected]>--- meta/classes/ccache.bbclass | 3 +-- meta/conf/bitbake.conf | 2 +- meta/lib/oeqa/selftest/cases/buildoptions.py | 8 ++++---- 3 files changed, 6 insertions(+), 7 deletions(-)meta/classes/ccache.bbclass +1
-2@@ -1,7 +1,5 @@ # # Usage: -# - Install ccache package on the host distribution and set up a build directory -# # - Enable ccache # Add the following line to a conffile such as conf/local.conf: # INHERIT += "ccache"@@ -53,6 +51,7 @@ python() { # 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
meta/conf/bitbake.conf HOSTTOOLS += " \ · line 501
Quoted 5 lines
meta/conf/bitbake.conf +1
-1@@ -498,7 +498,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"
The original patch has another side effect, once ccache is in hosttools, it
might be used when automatically, no matter set "INHERIT += ccache.bbclass" or not, and cause build errros such as:
ccache: error: Failed to create temporary file for~/.ccache/a/9/d6ei86jnu3q6gknptjb97vtr9hc329kR.tmp.kufXFz: Disk quota exceeded
So we can't add ccache to hosttools.
// Robert
Quoted 27 lines
meta/conf/bitbake.conf +0
-0# Temporary add few more detected in bitbake world HOSTTOOLS_NONFATAL += "join nl size yes zcat"meta/lib/oeqa/selftest/cases/buildoptions.py +4
-4@@ -33,10 +33,10 @@ class ImageOptionsTests(OESelftestTestCase): self.assertTrue(incremental_removed, msg = "Match failed in:\n%s" % log_data_removed) def test_ccache_tool(self): - bb_vars = get_bb_vars(['HOSTTOOLS_DIR'], 'm4-native') - p = bb_vars['HOSTTOOLS_DIR'] + "/" + "ccache" - if not os.path.isfile(p): - self.skipTest("No ccache binary found in %s" % bb_vars['HOSTTOOLS_DIR']) + bitbake("ccache-native") + bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'ccache-native') + 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-native') bitbake("m4-native -c clean")