diff mbox series

Remove ccache wrappers

Message ID 20230120152514.24630-1-fercerpav@gmail.com
State Accepted
Delegated to: Hauke Mehrtens
Headers show
Series Remove ccache wrappers | expand

Commit Message

Paul Fertser Jan. 20, 2023, 3:25 p.m. UTC
These wrappers are not needed as CC doesn't need to be a single word.

a53b084e497a9f1629a2caada833ebe14a6838b7 which introduced the wrappers
doesn't explain why they were really needed and why only for the target
and not for the host.

Moreover, name of the wrappers breaks a ccache assumption: since
v4.0-3-g6a92b4cd3a67 it has special handling for "chained" invocation
such as "ccache ccache gcc" where it skips all the "ccache*" names in
the middle and proceeds to run as if it was started as "ccache

This becomes important when a build system sees ccache in the PATH and
automatically enables it by prepending to CC. An example of such a
system would be autosetup as used by jimtcl. With the wrappers it breaks
as the command line ends up being just "ccache -Os..." because
"ccache_cc" gets skipped as it starts with "ccache".

[1] https://github.com/ccache/ccache/blob/master/src/ccache.cpp#L2105
[2] https://github.com/ccache/ccache/blob/master/src/Util.cpp#L802

Reported-by: Karl Palsson <karlp@etactica.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>

I tried CONFIG_ALL=y build and fixed bad packaging where I noticed:

Also sent a patch for Alpine (in private) and a patch/bug report to
libicu upstream: https://github.com/unicode-org/icu/pull/2290 .

My notion is that properly fixing affected software is better in the
long run. However just renaming the wrappers is an option too if it's
much less painful in the end. One potential downside would be that the
build systems wouldn't be able to detect e.g. GCC vs clang if used
with a wrapper and wouldn't apply custom build flags.

 rules.mk                      |  4 ++--
 tools/ccache/Makefile         | 10 ----------
 tools/ccache/files/ccache_cc  |  2 --
 tools/ccache/files/ccache_cxx |  2 --
 4 files changed, 2 insertions(+), 16 deletions(-)
 delete mode 100755 tools/ccache/files/ccache_cc
 delete mode 100755 tools/ccache/files/ccache_cxx
diff mbox series


diff --git a/rules.mk b/rules.mk
index 3d151338af11..a2f5bcca4b0d 100644
--- a/rules.mk
+++ b/rules.mk
@@ -283,8 +283,8 @@  export HOSTCC_NOCACHE
 ifneq ($(CONFIG_CCACHE),)
-  TARGET_CC:= ccache_cc
-  TARGET_CXX:= ccache_cxx
+  TARGET_CC:= ccache $(TARGET_CC)
+  TARGET_CXX:= ccache $(TARGET_CXX)
   HOSTCC:= ccache $(HOSTCC)
   HOSTCXX:= ccache $(HOSTCXX)
diff --git a/tools/ccache/Makefile b/tools/ccache/Makefile
index 25ab4a46eabe..6824dbddfd40 100644
--- a/tools/ccache/Makefile
+++ b/tools/ccache/Makefile
@@ -28,14 +28,4 @@  ifneq (docs-$(CONFIG_BUILD_DOCUMENTATION),docs-y)
-define Host/Install/ccache
-	$(CP) ./files/* $(STAGING_DIR_HOST)/bin/
-define Host/Install
-	$(call Host/Install/Default)
-	$(call Host/Install/ccache)
 $(eval $(call HostBuild))
diff --git a/tools/ccache/files/ccache_cc b/tools/ccache/files/ccache_cc
deleted file mode 100755
index 01c4ad42a21d..000000000000
--- a/tools/ccache/files/ccache_cc
+++ /dev/null
@@ -1,2 +0,0 @@ 
-exec ccache "${TARGET_CC_NOCACHE}" "$@"
diff --git a/tools/ccache/files/ccache_cxx b/tools/ccache/files/ccache_cxx
deleted file mode 100755
index cc60eb3a13c7..000000000000
--- a/tools/ccache/files/ccache_cxx
+++ /dev/null
@@ -1,2 +0,0 @@ 
-exec ccache "${TARGET_CXX_NOCACHE}" "$@"