Skip to contentSkip to conversation

ccache: fix explicit build 'make clean host-ccache'

PATCH New Thomas De Schampheleire 2 participants 4 messages Apr 29, 2016 – May 1, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ccache: fix explicit build 'make clean host-ccache'

From: Thomas De Schampheleire <[email protected]>

To build host-ccache we need to call the bare compiler. With a standard 'make', this is guaranteed because host-ccache is built as part of the dependencies, and a target-specific variable sets HOSTCC/HOSTCXX to the no-ccache version (see support/dependencies/dependencies.mk). However, this is not the case when using 'make host-ccache' explicitly from a clean build.

---
 package/ccache/ccache.mk | 7 +++++++
 1 file changed, 7 insertions(+)
package/ccache/ccache.mk +7 -0
index c4f0310..ae369a6 100644
@@ -21,6 +21,13 @@ CCACHE_LICENSE_FILES = LICENSE.txt GPL-3.0.txt
 # has zero dependency besides the C library.
 HOST_CCACHE_CONF_OPTS += --with-bundled-zlib
 
+# To build host-ccache we need to call the bare compiler. With a standard
+# 'make', this is guaranteed because host-ccache is built as part of the
+# dependencies, and a target-specific variable sets HOSTCC/HOSTCXX to the
+# no-ccache version (see support/dependencies/dependencies.mk).
+# However, this is not the case when using 'make host-ccache'.
+HOST_CCACHE_CONF_ENV += CC=$(HOSTCC_NOCCACHE) CXX=$(HOSTCXX_NOCCACHE)
+
 # Patch host-ccache as follows:
 #  - Use BR_CACHE_DIR instead of CCACHE_DIR, because CCACHE_DIR
 #    is already used by autotargets for the ccache package.
Signature · 1 line
2.7.3
#1 lore raw

PATCH 1/1 ccache: fix explicit build 'make clean host-ccache'

Hello,

Quoted 6 lines · Thomas De Schampheleire

To build host-ccache we need to call the bare compiler. With a standard 'make', this is guaranteed because host-ccache is built as part of the dependencies, and a target-specific variable sets HOSTCC/HOSTCXX to the no-ccache version (see ).
However, this is not the case when using 'make host-ccache' explicitly from a clean build.

I think this means that the CC/CXX assignments in support/dependencies/dependencies.mk are useless, no? If you do "make clean host-tar", or "make clean host-xz" or "make clean host-sstrip", it will fail the same way, no? Doesn't this mean that those "special" package should be fixed to define CC=$(HOSTCC_NOCCACHE) CXX=$(HOSTCXX_NOCCACHE) in their environment ?

package/ccache/ccache.mk CCACHE_LICENSE_FILES = LICENSE.txt GPL-3.0.txt · line 29

Quoted 6 lines
package/ccache/ccache.mk +6 -0
+# To build host-ccache we need to call the bare compiler. With a standard
+# 'make', this is guaranteed because host-ccache is built as part of the
+# dependencies, and a target-specific variable sets HOSTCC/HOSTCXX to the
+# no-ccache version (see support/dependencies/dependencies.mk).
+# However, this is not the case when using 'make host-ccache'.
+HOST_CCACHE_CONF_ENV += CC=$(HOSTCC_NOCCACHE) CXX=$(HOSTCXX_NOCCACHE)

Double quotes around the variable value?

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 ccache: fix explicit build 'make clean host-ccache'

Hi Thomas,

Quoted 11 lines · Thomas Petazzoni

Hello,

Quoted 6 lines · Thomas De Schampheleire

To build host-ccache we need to call the bare compiler. With a standard 'make', this is guaranteed because host-ccache is built as part of the dependencies, and a target-specific variable sets HOSTCC/HOSTCXX to the no-ccache version (see ).fo
However, this is not the case when using 'make host-ccache' explicitly from a clean build.

Quoted 6 lines

I think this means that the CC/CXX assignments in support/dependencies/dependencies.mk are useless, no? If you do "make clean host-tar", or "make clean host-xz" or "make clean host-sstrip", it will fail the same way, no? Doesn't this mean that those "special" package should be fixed to define CC=$(HOSTCC_NOCCACHE) CXX=$(HOSTCXX_NOCCACHE) in their environment ?

After some quick checking, it seems to depend which packages are in
DEPENDENCIES_HOST_PREREQ: 'make clean host-foo' will fail if host-foo is in DEPENDENCIES_HOST_PREREQ but will succeed if it is not. This is because packages that all packages get 'dependencies' as dependency, except packages that are itself in DEPENDENCIES_HOST_PREREQ.

So, on my system, 'make clean host-xz' worked fine because I have a suitable xzcat already and hence host-xz is not put in DEPENDENCIES_HOST_PREREQ. Similar for host-tar. If I cheat and add host-xz in DEPENDENCIES_HOST_PREREQ unconditionally, 'make clean host-xz' indeed fails.

This difference depending on the host system also means that a solution where e.g. host-xz is changed to set CC and CXX to no-ccache-versions is suboptimal: in case host-xz is not in DEPENDENCIES_HOST_PREREQ, the package would be built without ccache even if it were available. One could argue that there's no need to build host-xz in this scenario, but I can imagine other packages that can be mandatory in some situations and optional in others. Maybe this is nothing to worry about and we should keep things simple:
don't use ccache for host packages that are potentially a core dependency for buildroot.

What are your thoughts?

Quoted 9 lines

package/ccache/ccache.mk CCACHE_LICENSE_FILES = LICENSE.txt GPL-3.0.txt · line 29

Quoted 7 lines
package/ccache/ccache.mk +6 -0
+# To build host-ccache we need to call the bare compiler. With a standard
+# 'make', this is guaranteed because host-ccache is built as part of the
+# dependencies, and a target-specific variable sets HOSTCC/HOSTCXX to the
+# no-ccache version (see support/dependencies/dependencies.mk).
+# However, this is not the case when using 'make host-ccache'.
+HOST_CCACHE_CONF_ENV += CC=$(HOSTCC_NOCCACHE) CXX=$(HOSTCXX_NOCCACHE)

Double quotes around the variable value?

Yes, indeed. Need to fix that in any case.

/Thomas

#3 lore raw

PATCH 1/1 ccache: fix explicit build 'make clean host-ccache'

Hello,

Quoted 30 lines · Thomas De Schampheleire
Quoted 6 lines

I think this means that the CC/CXX assignments in support/dependencies/dependencies.mk are useless, no? If you do "make clean host-tar", or "make clean host-xz" or "make clean host-sstrip", it will fail the same way, no? Doesn't this mean that those "special" package should be fixed to define CC=$(HOSTCC_NOCCACHE) CXX=$(HOSTCXX_NOCCACHE) in their environment ?

After some quick checking, it seems to depend which packages are in
DEPENDENCIES_HOST_PREREQ: 'make clean host-foo' will fail if host-foo is in DEPENDENCIES_HOST_PREREQ but will succeed if it is not. This is because packages that all packages get 'dependencies' as dependency, except packages that are itself in DEPENDENCIES_HOST_PREREQ.

So, on my system, 'make clean host-xz' worked fine because I have a suitable xzcat already and hence host-xz is not put in DEPENDENCIES_HOST_PREREQ. Similar for host-tar. If I cheat and add host-xz in DEPENDENCIES_HOST_PREREQ unconditionally, 'make clean host-xz' indeed fails.

This difference depending on the host system also means that a solution where e.g. host-xz is changed to set CC and CXX to no-ccache-versions is suboptimal: in case host-xz is not in DEPENDENCIES_HOST_PREREQ, the package would be built without ccache even if it were available. One could argue that there's no need to build host-xz in this scenario, but I can imagine other packages that can be mandatory in some situations and optional in others. Maybe this is nothing to worry about and we should keep things simple:
don't use ccache for host packages that are potentially a core dependency for buildroot.

Quoted 1 line

What are your thoughts?

I think we should be simple, and indeed build those few packages always without ccache. I don't think we have any package that depends on "host-tar". Regarding host-xz, I'm not that sure, but it's a small package, so building it without ccache is not a big deal.

Alternatively, we could try to make those packages depend on host-ccache. But I'm really not sure it's worth it.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com