Skip to contentSkip to conversation

Fixes for ccache

PATCH In review Robert Yang 2 participants 8 messages Jan 24, 2019 – Jan 25, 2019

lore
Share & tools
lore
#0 lore raw

cover Fixes for ccache

The following changes since commit a4edfa4cf451bf412525887b5b24b9db6486ae97:

remove unused distutils-tools.bbclass (2019-01-23 07:57:02 +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 (5):
cmake-native: Add --enable-ccache to configure options bitbake.conf: Add CCACHE_TOP_DIR to BB_HASHBASE_WHITELIST ccache.bbclass: Only let native recipes depend on ccache-native
ccache: 3.5 -> 3.6
ccache: Fix Segmentation fault error when gcc -o /dev/null

 meta/classes/ccache.bbclass                        |  5 +-
 meta/conf/bitbake.conf                             |  2 +-
 meta/recipes-devtools/ccache/ccache_3.5.bb         | 11 ---
 meta/recipes-devtools/ccache/ccache_3.6.bb         | 12 ++++
 .../0002-dev.mk.in-fix-file-name-too-long.patch    |  8 +--
 ...mentation-fault-error-when-gcc-o-dev-null.patch | 79 ++++++++++++++++++++++
 meta/recipes-devtools/cmake/cmake-native_3.12.2.bb |  1 +
 7 files changed, 101 insertions(+), 17 deletions(-)
 delete mode 100644 meta/recipes-devtools/ccache/ccache_3.5.bb
 create mode 100644 meta/recipes-devtools/ccache/ccache_3.6.bb
 create mode 100644 meta/recipes-devtools/ccache/files/0003-Fix-Segmentation-fault-error-when-gcc-o-dev-null.patch
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/5 cmake-native: Add --enable-ccache to configure options

cmake-native requires --enable-ccache to enable ccache, target recipe doesn't need this since it is already handled by cmake.bbclass.

---
 meta/recipes-devtools/cmake/cmake-native_3.12.2.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-devtools/cmake/cmake-native_3.12.2.bb +1 -0
index 2f4ecc4..fedcf3d 100644
@@ -29,6 +29,7 @@ CMAKE_EXTRACONF = "\
 do_configure () {
 	${S}/configure --verbose --prefix=${prefix} \
 		${@oe.utils.parallel_make_argument(d, '--parallel=%d')} \
+		${@bb.utils.contains('CCACHE', 'ccache ', '--enable-ccache', '', d)} \
 		-- ${CMAKE_EXTRACONF}
 }
 
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/5 bitbake.conf: Add CCACHE_TOP_DIR to BB_HASHBASE_WHITELIST

In reply to Robert Yang

As we did for SSTATE_DIR.

---
 meta/conf/bitbake.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/conf/bitbake.conf +1 -1
index 0bdcd04..4ee14c6 100644
@@ -866,7 +866,7 @@ BB_HASHBASE_WHITELIST ?= "TMPDIR FILE PATH PWD BB_TASKHASH BBPATH BBSERVER DL_DI
     WARN_QA ERROR_QA WORKDIR STAMPCLEAN PKGDATA_DIR BUILD_ARCH SSTATE_PKGARCH \
     BB_WORKERCONTEXT BB_LIMITEDDEPS BB_UNIHASH extend_recipe_sysroot DEPLOY_DIR \
     SSTATE_HASHEQUIV_METHOD SSTATE_HASHEQUIV_SERVER SSTATE_HASHEQUIV_REPORT_TASKDATA \
-    SSTATE_HASHEQUIV_OWNER"
+    SSTATE_HASHEQUIV_OWNER CCACHE_TOP_DIR"
 BB_HASHCONFIG_WHITELIST ?= "${BB_HASHBASE_WHITELIST} DATE TIME SSH_AGENT_PID \
     SSH_AUTH_SOCK PSEUDO_BUILD BB_ENV_EXTRAWHITE DISABLE_SANITY_CHECKS \
     PARALLEL_MAKE BB_NUMBER_THREADS BB_ORIGENV BB_INVALIDCONF BBINCLUDED \
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/5 ccache.bbclass: Only let native recipes depend on ccache-native

In reply to Robert Yang

Make native recipes depend on ccache-native should be enough since native recipes are on target/nativesdk recipes' dependency chain, this can reduce the size of DEPENDS.

---
 meta/classes/ccache.bbclass | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
meta/classes/ccache.bbclass +4 -1
index b545735..6caaca7 100644
@@ -47,8 +47,11 @@ 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 ')
+        # Make native recipes depend on ccache-native should be enough since
+        # native recipes are on target recipes' dependency chain.
+        if bb.data.inherits_class('native', d):
+            d.appendVar('DEPENDS', ' ccache-native')
 }
 
 addtask cleanccache after do_clean
Signature · 1 line
2.7.4
#4 lore raw

Re: [PATCH 3/5] ccache.bbclass: Only let native recipes depend on ccache-native

Quoted 16 lines · Robert Yang

Make native recipes depend on ccache-native should be enough since native recipes are on target/nativesdk recipes' dependency chain, this can reduce the size of DEPENDS.

---
 meta/classes/ccache.bbclass | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
meta/classes/ccache.bbclass +0 -0
index b545735..6caaca7 100644
@@ -47,8 +47,11 @@ python() {
     # quilt-native doesn't need ccache since no c files
     if not (pn in ('ccache-native', 'quilt-native') or

meta/classes/ccache.bbclass python() { · line 57

Quoted 10 lines
meta/classes/ccache.bbclass +4 -1
             bb.utils.to_boolean(d.getVar('CCACHE_DISABLE'))):
-        d.appendVar('DEPENDS', ' ccache-native')
         d.setVar('CCACHE', 'ccache ')
+        # Make native recipes depend on ccache-native should be enough since
+        # native recipes are on target recipes' dependency chain.
+        if bb.data.inherits_class('native', d):
+            d.appendVar('DEPENDS', ' ccache-native')
 }
 
 addtask cleanccache after do_clean

This is not correct. Think about the case where the native recipes were installed from sstate. The target recipe dependencies would then be incorrect.

Cheers,

Richard

#5 lore raw

Re: [PATCH 3/5] ccache.bbclass: Only let native recipes depend on ccache-native

Quoted 26 lines · Richard Purdie
Quoted 25 lines · Robert Yang

Make native recipes depend on ccache-native should be enough since native recipes are on target/nativesdk recipes' dependency chain, this can reduce the size of DEPENDS.

---
  meta/classes/ccache.bbclass | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
meta/classes/ccache.bbclass +4 -1
index b545735..6caaca7 100644
@@ -47,8 +47,11 @@ 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 ')
+        # Make native recipes depend on ccache-native should be enough since
+        # native recipes are on target recipes' dependency chain.
+        if bb.data.inherits_class('native', d):
+            d.appendVar('DEPENDS', ' ccache-native')
  }
 
Quoted 5 lines

meta/classes/ccache.bbclass python() { · line 57

Quoted 1 line
meta/classes/ccache.bbclass +0 -0
  addtask cleanccache after do_clean

This is not correct. Think about the case where the native recipes were installed from sstate. The target recipe dependencies would then be incorrect.

It seems that it is OK, I used base-files to do a test:

- Add 'DEPENDS += "m4-native"' to base-files_3.0.14.bb
- Add INHERIT += "ccache" to local.conf

$ bitbake m4-native

# Got the ones have been built

$ bitbake m4-native -g

Clean all the native builds to make them installed from sstate:

$ bitbake `cat pn-buildlist` -cclean
$ bitbake base-files -cconfigure

Now m4-native is installed from sstate, but ccache is still be installed to base-files/3.0.14-r89/recipe-sysroot-native/usr/bin/ccache.

I looked at staging.bbclass:extend_recipe_sysroot(), it seems that it did install all the dependencies on the chain.

// Robert

Quoted 6 lines

Cheers,

Richard

#6 lore raw

PATCH 4/5 ccache: 3.5 -> 3.6

In reply to Robert Yang

* Rebased 0002-dev.mk.in-fix-file-name-too-long.patch and sent it to upstream, and got merged.
* The LIC_FILES_CHKSUM is changed because of year updated.

---
 meta/recipes-devtools/ccache/ccache_3.5.bb                    | 11 -----------
 meta/recipes-devtools/ccache/ccache_3.6.bb                    | 11 +++++++++++
 .../ccache/files/0002-dev.mk.in-fix-file-name-too-long.patch  |  8 ++++----
 3 files changed, 15 insertions(+), 15 deletions(-)
 delete mode 100644 meta/recipes-devtools/ccache/ccache_3.5.bb
 create mode 100644 meta/recipes-devtools/ccache/ccache_3.6.bb
meta/recipes-devtools/ccache/ccache_3.5.bb deleted +0 -11
deleted file mode 100644
index 89062c4..0000000
@@ -1,11 +0,0 @@
-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 \
-"
meta/recipes-devtools/ccache/ccache_3.6.bb new file +11 -0
new file mode 100644
index 0000000..a12306e
@@ -0,0 +1,11 @@
+require ccache.inc
+
+LICENSE = "GPLv3+"
+LIC_FILES_CHKSUM = "file://LICENSE.adoc;md5=70762511f9c509cc2a4e4ba2ef687ae3"
+
+SRC_URI[md5sum] = "bd6fd69db28426baf22ec0acdd5c4b2a"
+SRC_URI[sha256sum] = "a3f2b91a2353b65a863c5901251efe48060ecdebec46b5eaec8ea8e092b9e871"
+
+SRC_URI += " \
+            file://0002-dev.mk.in-fix-file-name-too-long.patch \
+"
meta/recipes-devtools/ccache/files/0002-dev.mk.in-fix-file-name-too-long.patch +4 -4
index 68c2371..16a6e9d 100644
@@ -1,13 +1,13 @@
 From 7dab2995ed8eeccd7b0acd79668bc28f3a2427d5 Mon Sep 17 00:00:00 2001
 From: Robert Yang <[email protected]>
 Date: Wed, 16 Sep 2015 19:45:40 -0700
-Subject: [PATCH] dev.mk.in: fix file name too long
+Subject: [PATCH] dev.mk.in: fix file name too long error
 
-The all_cppflags change paths to filename which cause file name too long
+The all_cppflags changes path to filename which causes file name too long
 error when the path is longer than NAME_MAX (usually 255). Strip srcdir
 to fix the problem.
 
-Upstream-Status: Pending
+Upstream-Status: Backport [https://github.com/ccache/ccache/commit/4d86e884d07ba1853a0c70507cc4d04107f57c29]
 
 Signed-off-by: Robert Yang <[email protected]>
 
@@ -22,7 +22,7 @@ index 91b0a57..583ade0 100644
 @@ -1,7 +1,7 @@
  # GNU make syntax reigns in this file.
  
- all_cflags += -Werror
+ all_cflags += -Werror @more_warnings@
 -all_cppflags += -MD -MP -MF .deps/$(subst .._,,$(subst /,_,$<)).d
 +all_cppflags += -MD -MP -MF .deps/$(subst .._,,$(subst /,_,$(subst $(srcdir)/,,$<))).d
  
Signature · 1 line
2.7.4
#7 lore raw

PATCH 5/5 ccache: Fix Segmentation fault error when gcc -o /dev/null

In reply to Robert Yang

Fixed:

$ export CCACHE_DEBUG=1
$ ccache gcc -c hello.c -o /dev/null

Segmentation fault (core dumped)

This is because failed to open /dev/null.foo (Permission denied), check file stream before write to it can fix the problem.

---
 meta/recipes-devtools/ccache/ccache_3.6.bb         |  1 +
 ...mentation-fault-error-when-gcc-o-dev-null.patch | 79 ++++++++++++++++++++++
 2 files changed, 80 insertions(+)
 create mode 100644 meta/recipes-devtools/ccache/files/0003-Fix-Segmentation-fault-error-when-gcc-o-dev-null.patch
meta/recipes-devtools/ccache/ccache_3.6.bb +1 -0
index a12306e..60807be 100644
@@ -8,4 +8,5 @@ SRC_URI[sha256sum] = "a3f2b91a2353b65a863c5901251efe48060ecdebec46b5eaec8ea8e092
 
 SRC_URI += " \
             file://0002-dev.mk.in-fix-file-name-too-long.patch \
+            file://0003-Fix-Segmentation-fault-error-when-gcc-o-dev-null.patch \
 "
meta/recipes-devtools/ccache/files/0003-Fix-Segmentation-fault-error-when-gcc-o-dev-null.patch new file +79 -0

79 lines not on this page · raw message

Signature · 1 line
2.7.4