[v1] build: ccache support for cross build

Message ID 20220602092356.2788089-1-jerinj@marvell.com (mailing list archive)
State Changes Requested, archived
Delegated to: Thomas Monjalon
Headers
Series [v1] build: ccache support for cross build |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-testing warning apply patch failure
ci/github-robot: build success github build: passed
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS

Commit Message

Jerin Jacob Kollanukkaran June 2, 2022, 9:23 a.m. UTC
  From: Jerin Jacob <jerinj@marvell.com>

By default, ccache is not used for cross build[1].
Update all cross files to use ccache if it is available
in build machine.

[1]
https://mesonbuild.com/Machine-files.html

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
---
 config/arm/arm32_armv8_linux_gcc           | 4 ++--
 config/arm/arm64_armada_linux_gcc          | 4 ++--
 config/arm/arm64_armv8_linux_clang_ubuntu  | 4 ++--
 config/arm/arm64_armv8_linux_gcc           | 4 ++--
 config/arm/arm64_bluefield_linux_gcc       | 4 ++--
 config/arm/arm64_centriq2400_linux_gcc     | 4 ++--
 config/arm/arm64_cn10k_linux_gcc           | 4 ++--
 config/arm/arm64_cn9k_linux_gcc            | 4 ++--
 config/arm/arm64_dpaa_linux_gcc            | 4 ++--
 config/arm/arm64_emag_linux_gcc            | 4 ++--
 config/arm/arm64_graviton2_linux_gcc       | 4 ++--
 config/arm/arm64_kunpeng920_linux_gcc      | 4 ++--
 config/arm/arm64_kunpeng930_linux_gcc      | 4 ++--
 config/arm/arm64_n1sdp_linux_gcc           | 4 ++--
 config/arm/arm64_n2_linux_gcc              | 4 ++--
 config/arm/arm64_stingray_linux_gcc        | 4 ++--
 config/arm/arm64_thunderx2_linux_gcc       | 4 ++--
 config/arm/arm64_thunderxt83_linux_gcc     | 4 ++--
 config/arm/arm64_thunderxt88_linux_gcc     | 4 ++--
 config/ppc/ppc64le-power8-linux-gcc        | 4 ++--
 config/ppc/ppc64le-power8-linux-gcc-ubuntu | 4 ++--
 config/x86/cross-mingw                     | 4 ++--
 22 files changed, 44 insertions(+), 44 deletions(-)
  

Comments

Bruce Richardson June 2, 2022, 9:41 a.m. UTC | #1
On Thu, Jun 02, 2022 at 02:53:55PM +0530, jerinj@marvell.com wrote:
> From: Jerin Jacob <jerinj@marvell.com>
> 
> By default, ccache is not used for cross build[1].
> Update all cross files to use ccache if it is available
> in build machine.
> 
> [1]
> https://mesonbuild.com/Machine-files.html
> 
> Signed-off-by: Jerin Jacob <jerinj@marvell.com>

Does this still work even if ccache is not available? That's not fully
clear from the docs, but it seems to be that if an array is passed the
whole array is used as the command, rather than just one element of the
array. That would imply that cross-builds now require ccache. Is that
acceptable?

/Bruce
  
Jerin Jacob June 2, 2022, 9:43 a.m. UTC | #2
On Thu, Jun 2, 2022 at 3:11 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> On Thu, Jun 02, 2022 at 02:53:55PM +0530, jerinj@marvell.com wrote:
> > From: Jerin Jacob <jerinj@marvell.com>
> >
> > By default, ccache is not used for cross build[1].
> > Update all cross files to use ccache if it is available
> > in build machine.
> >
> > [1]
> > https://mesonbuild.com/Machine-files.html
> >
> > Signed-off-by: Jerin Jacob <jerinj@marvell.com>
>
> Does this still work even if ccache is not available? That's not fully

Yes.

> clear from the docs, but it seems to be that if an array is passed the
> whole array is used as the command, rather than just one element of the
> array. That would imply that cross-builds now require ccache. Is that
> acceptable?

I have removed ccache from the build machine still it works.

>
> /Bruce
>
  
Thomas Monjalon June 2, 2022, 10:55 a.m. UTC | #3
02/06/2022 11:43, Jerin Jacob:
> On Thu, Jun 2, 2022 at 3:11 PM Bruce Richardson
> <bruce.richardson@intel.com> wrote:
> >
> > On Thu, Jun 02, 2022 at 02:53:55PM +0530, jerinj@marvell.com wrote:
> > > From: Jerin Jacob <jerinj@marvell.com>
> > >
> > > By default, ccache is not used for cross build[1].
> > > Update all cross files to use ccache if it is available
> > > in build machine.
> > >
> > > [1]
> > > https://mesonbuild.com/Machine-files.html
> > >
> > > Signed-off-by: Jerin Jacob <jerinj@marvell.com>
> >
> > Does this still work even if ccache is not available? That's not fully
> 
> Yes.
> 
> > clear from the docs, but it seems to be that if an array is passed the
> > whole array is used as the command, rather than just one element of the
> > array. That would imply that cross-builds now require ccache. Is that
> > acceptable?
> 
> I have removed ccache from the build machine still it works.

I don't understand why it works without ccache.

In general, I would prefer we have a mechanism to update the cross file
on the fly, depending on the setup.
We have this for toolchain prefix name.
The prefix depends on where the toochain comes from.
In a "normal" build system, we set the prefix with an environment variable,
not by writing a file.
  
Jerin Jacob June 2, 2022, noon UTC | #4
On Thu, Jun 2, 2022 at 4:25 PM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> 02/06/2022 11:43, Jerin Jacob:
> > On Thu, Jun 2, 2022 at 3:11 PM Bruce Richardson
> > <bruce.richardson@intel.com> wrote:
> > >
> > > On Thu, Jun 02, 2022 at 02:53:55PM +0530, jerinj@marvell.com wrote:
> > > > From: Jerin Jacob <jerinj@marvell.com>
> > > >
> > > > By default, ccache is not used for cross build[1].
> > > > Update all cross files to use ccache if it is available
> > > > in build machine.
> > > >
> > > > [1]
> > > > https://mesonbuild.com/Machine-files.html
> > > >
> > > > Signed-off-by: Jerin Jacob <jerinj@marvell.com>
> > >
> > > Does this still work even if ccache is not available? That's not fully
> >
> > Yes.
> >
> > > clear from the docs, but it seems to be that if an array is passed the
> > > whole array is used as the command, rather than just one element of the
> > > array. That would imply that cross-builds now require ccache. Is that
> > > acceptable?
> >
> > I have removed ccache from the build machine still it works.
>
> I don't understand why it works without ccache.

Meson is detecting valid compiler prefix. ccache is one of them.

See
https://github.com/fabio-porcedda/meson/commit/44db495f5ece43645ca3994dc95895c76a828530
https://github.com/mesonbuild/meson/issues/1392



>
> In general, I would prefer we have a mechanism to update the cross file
> on the fly, depending on the setup.

I believe, It would be a departure from the meson cross-file concept.

> We have this for toolchain prefix name.
> The prefix depends on where the toochain comes from.
> In a "normal" build system, we set the prefix with an environment variable,
> not by writing a file.
>
>
  
Bruce Richardson June 2, 2022, 1:33 p.m. UTC | #5
On Thu, Jun 02, 2022 at 05:30:36PM +0530, Jerin Jacob wrote:
> On Thu, Jun 2, 2022 at 4:25 PM Thomas Monjalon <thomas@monjalon.net> wrote:
> >
> > 02/06/2022 11:43, Jerin Jacob:
> > > On Thu, Jun 2, 2022 at 3:11 PM Bruce Richardson
> > > <bruce.richardson@intel.com> wrote:
> > > >
> > > > On Thu, Jun 02, 2022 at 02:53:55PM +0530, jerinj@marvell.com wrote:
> > > > > From: Jerin Jacob <jerinj@marvell.com>
> > > > >
> > > > > By default, ccache is not used for cross build[1].
> > > > > Update all cross files to use ccache if it is available
> > > > > in build machine.
> > > > >
> > > > > [1]
> > > > > https://mesonbuild.com/Machine-files.html
> > > > >
> > > > > Signed-off-by: Jerin Jacob <jerinj@marvell.com>
> > > >
> > > > Does this still work even if ccache is not available? That's not fully
> > >
> > > Yes.
> > >
> > > > clear from the docs, but it seems to be that if an array is passed the
> > > > whole array is used as the command, rather than just one element of the
> > > > array. That would imply that cross-builds now require ccache. Is that
> > > > acceptable?
> > >
> > > I have removed ccache from the build machine still it works.
> >
> > I don't understand why it works without ccache.
> 
> Meson is detecting valid compiler prefix. ccache is one of them.
> 
> See
> https://github.com/fabio-porcedda/meson/commit/44db495f5ece43645ca3994dc95895c76a828530
> https://github.com/mesonbuild/meson/issues/1392
> 
> 
> 
> >
> > In general, I would prefer we have a mechanism to update the cross file
> > on the fly, depending on the setup.
> 
> I believe, It would be a departure from the meson cross-file concept.
> 
I don't see why we could script it and use it if people wanted. The
cross-file used should be stored in the build directory, so it's associated
with the build.

/Bruce
  
Jerin Jacob June 8, 2022, 8:22 a.m. UTC | #6
On Thu, Jun 2, 2022 at 5:30 PM Jerin Jacob <jerinjacobk@gmail.com> wrote:
>
> On Thu, Jun 2, 2022 at 4:25 PM Thomas Monjalon <thomas@monjalon.net> wrote:
> >
> > 02/06/2022 11:43, Jerin Jacob:
> > > On Thu, Jun 2, 2022 at 3:11 PM Bruce Richardson
> > > <bruce.richardson@intel.com> wrote:
> > > >
> > > > On Thu, Jun 02, 2022 at 02:53:55PM +0530, jerinj@marvell.com wrote:
> > > > > From: Jerin Jacob <jerinj@marvell.com>
> > > > >
> > > > > By default, ccache is not used for cross build[1].
> > > > > Update all cross files to use ccache if it is available
> > > > > in build machine.
> > > > >
> > > > > [1]
> > > > > https://mesonbuild.com/Machine-files.html
> > > > >
> > > > > Signed-off-by: Jerin Jacob <jerinj@marvell.com>
> > > >
> > > > Does this still work even if ccache is not available? That's not fully
> > >
> > > Yes.
> > >
> > > > clear from the docs, but it seems to be that if an array is passed the
> > > > whole array is used as the command, rather than just one element of the
> > > > array. That would imply that cross-builds now require ccache. Is that
> > > > acceptable?
> > >
> > > I have removed ccache from the build machine still it works.
> >
> > I don't understand why it works without ccache.
>
> Meson is detecting valid compiler prefix. ccache is one of them.
>
> See
> https://github.com/fabio-porcedda/meson/commit/44db495f5ece43645ca3994dc95895c76a828530
> https://github.com/mesonbuild/meson/issues/1392

I hope there are no other review comments to fix it for this patch.
Since it is improving the build time for cross-build. If there is no
objection to this patch, Please merge it.


>
>
>
> >
> > In general, I would prefer we have a mechanism to update the cross file
> > on the fly, depending on the setup.
>
> I believe, It would be a departure from the meson cross-file concept.
>
> > We have this for toolchain prefix name.
> > The prefix depends on where the toochain comes from.
> > In a "normal" build system, we set the prefix with an environment variable,
> > not by writing a file.
> >
> >
  
Thomas Monjalon June 8, 2022, 8:30 a.m. UTC | #7
08/06/2022 10:22, Jerin Jacob:
> On Thu, Jun 2, 2022 at 5:30 PM Jerin Jacob <jerinjacobk@gmail.com> wrote:
> >
> > On Thu, Jun 2, 2022 at 4:25 PM Thomas Monjalon <thomas@monjalon.net> wrote:
> > >
> > > 02/06/2022 11:43, Jerin Jacob:
> > > > On Thu, Jun 2, 2022 at 3:11 PM Bruce Richardson
> > > > <bruce.richardson@intel.com> wrote:
> > > > >
> > > > > On Thu, Jun 02, 2022 at 02:53:55PM +0530, jerinj@marvell.com wrote:
> > > > > > From: Jerin Jacob <jerinj@marvell.com>
> > > > > >
> > > > > > By default, ccache is not used for cross build[1].
> > > > > > Update all cross files to use ccache if it is available
> > > > > > in build machine.
> > > > > >
> > > > > > [1]
> > > > > > https://mesonbuild.com/Machine-files.html
> > > > > >
> > > > > > Signed-off-by: Jerin Jacob <jerinj@marvell.com>
> > > > >
> > > > > Does this still work even if ccache is not available? That's not fully
> > > >
> > > > Yes.
> > > >
> > > > > clear from the docs, but it seems to be that if an array is passed the
> > > > > whole array is used as the command, rather than just one element of the
> > > > > array. That would imply that cross-builds now require ccache. Is that
> > > > > acceptable?
> > > >
> > > > I have removed ccache from the build machine still it works.
> > >
> > > I don't understand why it works without ccache.
> >
> > Meson is detecting valid compiler prefix. ccache is one of them.
> >
> > See
> > https://github.com/fabio-porcedda/meson/commit/44db495f5ece43645ca3994dc95895c76a828530
> > https://github.com/mesonbuild/meson/issues/1392
> 
> I hope there are no other review comments to fix it for this patch.
> Since it is improving the build time for cross-build. If there is no
> objection to this patch, Please merge it.

I've tested it now and I see a big blocker.
This patch is breaking the use of devtools/test-meson-builds.sh
so I cannot merge it as-is, sorry.
  
Jerin Jacob June 8, 2022, 5:16 p.m. UTC | #8
On Wed, Jun 8, 2022 at 2:00 PM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> 08/06/2022 10:22, Jerin Jacob:
> > On Thu, Jun 2, 2022 at 5:30 PM Jerin Jacob <jerinjacobk@gmail.com> wrote:
> > >
> > > On Thu, Jun 2, 2022 at 4:25 PM Thomas Monjalon <thomas@monjalon.net> wrote:
> > > >
> > > > 02/06/2022 11:43, Jerin Jacob:
> > > > > On Thu, Jun 2, 2022 at 3:11 PM Bruce Richardson
> > > > > <bruce.richardson@intel.com> wrote:
> > > > > >
> > > > > > On Thu, Jun 02, 2022 at 02:53:55PM +0530, jerinj@marvell.com wrote:
> > > > > > > From: Jerin Jacob <jerinj@marvell.com>
> > > > > > >
> > > > > > > By default, ccache is not used for cross build[1].
> > > > > > > Update all cross files to use ccache if it is available
> > > > > > > in build machine.
> > > > > > >
> > > > > > > [1]
> > > > > > > https://mesonbuild.com/Machine-files.html
> > > > > > >
> > > > > > > Signed-off-by: Jerin Jacob <jerinj@marvell.com>
> > > > > >
> > > > > > Does this still work even if ccache is not available? That's not fully
> > > > >
> > > > > Yes.
> > > > >
> > > > > > clear from the docs, but it seems to be that if an array is passed the
> > > > > > whole array is used as the command, rather than just one element of the
> > > > > > array. That would imply that cross-builds now require ccache. Is that
> > > > > > acceptable?
> > > > >
> > > > > I have removed ccache from the build machine still it works.
> > > >
> > > > I don't understand why it works without ccache.
> > >
> > > Meson is detecting valid compiler prefix. ccache is one of them.
> > >
> > > See
> > > https://github.com/fabio-porcedda/meson/commit/44db495f5ece43645ca3994dc95895c76a828530
> > > https://github.com/mesonbuild/meson/issues/1392
> >
> > I hope there are no other review comments to fix it for this patch.
> > Since it is improving the build time for cross-build. If there is no
> > objection to this patch, Please merge it.
>
> I've tested it now and I see a big blocker.
> This patch is breaking the use of devtools/test-meson-builds.sh
> so I cannot merge it as-is, sorry.

I assume you are referring to fixing the DPDK_TARGET update due to the
cross-file update.
If so, it is fixed in v2 at
http://patches.dpdk.org/project/dpdk/patch/20220608171304.945454-1-jerinj@marvell.com/

Thanks
>
>
>
  
Stanislaw Kardach June 8, 2022, 6:30 p.m. UTC | #9
On Wed, Jun 8, 2022 at 7:17 PM Jerin Jacob <jerinjacobk@gmail.com> wrote:
>
> On Wed, Jun 8, 2022 at 2:00 PM Thomas Monjalon <thomas@monjalon.net> wrote:
> >
> > 08/06/2022 10:22, Jerin Jacob:
> > > On Thu, Jun 2, 2022 at 5:30 PM Jerin Jacob <jerinjacobk@gmail.com> wrote:
> > > >
> > > > On Thu, Jun 2, 2022 at 4:25 PM Thomas Monjalon <thomas@monjalon.net> wrote:
> > > > >
> > > > > 02/06/2022 11:43, Jerin Jacob:
> > > > > > On Thu, Jun 2, 2022 at 3:11 PM Bruce Richardson
> > > > > > <bruce.richardson@intel.com> wrote:
> > > > > > >
> > > > > > > On Thu, Jun 02, 2022 at 02:53:55PM +0530, jerinj@marvell.com wrote:
> > > > > > > > From: Jerin Jacob <jerinj@marvell.com>
> > > > > > > >
> > > > > > > > By default, ccache is not used for cross build[1].
> > > > > > > > Update all cross files to use ccache if it is available
> > > > > > > > in build machine.
> > > > > > > >
> > > > > > > > [1]
> > > > > > > > https://mesonbuild.com/Machine-files.html
> > > > > > > >
> > > > > > > > Signed-off-by: Jerin Jacob <jerinj@marvell.com>
> > > > > > >
> > > > > > > Does this still work even if ccache is not available? That's not fully
> > > > > >
> > > > > > Yes.
> > > > > >
> > > > > > > clear from the docs, but it seems to be that if an array is passed the
> > > > > > > whole array is used as the command, rather than just one element of the
> > > > > > > array. That would imply that cross-builds now require ccache. Is that
> > > > > > > acceptable?
> > > > > >
> > > > > > I have removed ccache from the build machine still it works.
> > > > >
> > > > > I don't understand why it works without ccache.
> > > >
> > > > Meson is detecting valid compiler prefix. ccache is one of them.
> > > >
> > > > See
> > > > https://github.com/fabio-porcedda/meson/commit/44db495f5ece43645ca3994dc95895c76a828530
> > > > https://github.com/mesonbuild/meson/issues/1392
> > >
> > > I hope there are no other review comments to fix it for this patch.
> > > Since it is improving the build time for cross-build. If there is no
> > > objection to this patch, Please merge it.
> >
> > I've tested it now and I see a big blocker.
> > This patch is breaking the use of devtools/test-meson-builds.sh
> > so I cannot merge it as-is, sorry.
>
> I assume you are referring to fixing the DPDK_TARGET update due to the
> cross-file update.
> If so, it is fixed in v2 at
> http://patches.dpdk.org/project/dpdk/patch/20220608171304.945454-1-jerinj@marvell.com/

I've just tested it on a clean Ubuntu 20.04 docker with only RISC-V
toolchain, no ccache and indeed compilation works. Both directly with
meson and via test-meson-builds.sh.
Seems like ccache is parsed in special way by meson as using any other
unknown command just fails meson configuration.
Also setting CC/CXX env variable makes meson bail (even if I use the
cross-file value), so I'm not sure if there is a better way to do it.

Acked-by: Stanislaw Kardach <kda@semihalf.com>
  

Patch

diff --git a/config/arm/arm32_armv8_linux_gcc b/config/arm/arm32_armv8_linux_gcc
index 89f8a12881..7f2977e49d 100644
--- a/config/arm/arm32_armv8_linux_gcc
+++ b/config/arm/arm32_armv8_linux_gcc
@@ -1,6 +1,6 @@ 
 [binaries]
-c = 'arm-linux-gnueabihf-gcc'
-cpp = 'arm-linux-gnueabihf-cpp'
+c = ['ccache', 'arm-linux-gnueabihf-gcc']
+cpp = ['ccache', 'arm-linux-gnueabihf-cpp']
 ar = 'arm-linux-gnueabihf-gcc-ar'
 strip = 'arm-linux-gnueabihf-strip'
 pkgconfig = 'arm-linux-gnueabihf-pkg-config'
diff --git a/config/arm/arm64_armada_linux_gcc b/config/arm/arm64_armada_linux_gcc
index 301418949b..1566999101 100644
--- a/config/arm/arm64_armada_linux_gcc
+++ b/config/arm/arm64_armada_linux_gcc
@@ -1,6 +1,6 @@ 
 [binaries]
-c = 'aarch64-linux-gnu-gcc'
-cpp = 'aarch64-linux-gnu-cpp'
+c = ['ccache', 'aarch64-linux-gnu-gcc']
+cpp = ['ccache', 'aarch64-linux-gnu-cpp']
 ar = 'aarch64-linux-gnu-ar'
 as = 'aarch64-linux-gnu-as'
 strip = 'aarch64-linux-gnu-strip'
diff --git a/config/arm/arm64_armv8_linux_clang_ubuntu b/config/arm/arm64_armv8_linux_clang_ubuntu
index db488d75f4..86ae43937b 100644
--- a/config/arm/arm64_armv8_linux_clang_ubuntu
+++ b/config/arm/arm64_armv8_linux_clang_ubuntu
@@ -1,6 +1,6 @@ 
 [binaries]
-c = 'clang'
-cpp = 'clang++'
+c = ['ccache', 'clang']
+cpp = ['ccache', 'clang++']
 ar = 'llvm-ar'
 strip = 'llvm-strip'
 llvm-config = 'llvm-config'
diff --git a/config/arm/arm64_armv8_linux_gcc b/config/arm/arm64_armv8_linux_gcc
index 5391d35389..048c2d9f29 100644
--- a/config/arm/arm64_armv8_linux_gcc
+++ b/config/arm/arm64_armv8_linux_gcc
@@ -1,6 +1,6 @@ 
 [binaries]
-c = 'aarch64-linux-gnu-gcc'
-cpp = 'aarch64-linux-gnu-cpp'
+c = ['ccache', 'aarch64-linux-gnu-gcc']
+cpp = ['ccache', 'aarch64-linux-gnu-cpp']
 ar = 'aarch64-linux-gnu-gcc-ar'
 strip = 'aarch64-linux-gnu-strip'
 pkgconfig = 'aarch64-linux-gnu-pkg-config'
diff --git a/config/arm/arm64_bluefield_linux_gcc b/config/arm/arm64_bluefield_linux_gcc
index 248a9f031a..38df3c198b 100644
--- a/config/arm/arm64_bluefield_linux_gcc
+++ b/config/arm/arm64_bluefield_linux_gcc
@@ -1,6 +1,6 @@ 
 [binaries]
-c = 'aarch64-linux-gnu-gcc'
-cpp = 'aarch64-linux-gnu-cpp'
+c = ['ccache', 'aarch64-linux-gnu-gcc']
+cpp = ['ccache', 'aarch64-linux-gnu-cpp']
 ar = 'aarch64-linux-gnu-gcc-ar'
 strip = 'aarch64-linux-gnu-strip'
 pkgconfig = 'aarch64-linux-gnu-pkg-config'
diff --git a/config/arm/arm64_centriq2400_linux_gcc b/config/arm/arm64_centriq2400_linux_gcc
index dfe9110331..0966eef2c5 100644
--- a/config/arm/arm64_centriq2400_linux_gcc
+++ b/config/arm/arm64_centriq2400_linux_gcc
@@ -1,6 +1,6 @@ 
 [binaries]
-c = 'aarch64-linux-gnu-gcc'
-cpp = 'aarch64-linux-gnu-cpp'
+c = ['ccache', 'aarch64-linux-gnu-gcc']
+cpp = ['ccache', 'aarch64-linux-gnu-cpp']
 ar = 'aarch64-linux-gnu-gcc-ar'
 strip = 'aarch64-linux-gnu-strip'
 pkgconfig = 'aarch64-linux-gnu-pkg-config'
diff --git a/config/arm/arm64_cn10k_linux_gcc b/config/arm/arm64_cn10k_linux_gcc
index a3578c03a1..201e0ccd59 100644
--- a/config/arm/arm64_cn10k_linux_gcc
+++ b/config/arm/arm64_cn10k_linux_gcc
@@ -1,6 +1,6 @@ 
 [binaries]
-c = 'aarch64-linux-gnu-gcc'
-cpp = 'aarch64-linux-gnu-cpp'
+c = ['ccache', 'aarch64-linux-gnu-gcc']
+cpp = ['ccache', 'aarch64-linux-gnu-cpp']
 ar = 'aarch64-linux-gnu-gcc-ar'
 strip = 'aarch64-linux-gnu-strip'
 pkgconfig = 'aarch64-linux-gnu-pkg-config'
diff --git a/config/arm/arm64_cn9k_linux_gcc b/config/arm/arm64_cn9k_linux_gcc
index a94b44a551..a9b4d51958 100644
--- a/config/arm/arm64_cn9k_linux_gcc
+++ b/config/arm/arm64_cn9k_linux_gcc
@@ -1,6 +1,6 @@ 
 [binaries]
-c = 'aarch64-linux-gnu-gcc'
-cpp = 'aarch64-linux-gnu-cpp'
+c = ['ccache', 'aarch64-linux-gnu-gcc']
+cpp = ['ccache', 'aarch64-linux-gnu-cpp']
 ar = 'aarch64-linux-gnu-gcc-ar'
 strip = 'aarch64-linux-gnu-strip'
 pkgconfig = 'aarch64-linux-gnu-pkg-config'
diff --git a/config/arm/arm64_dpaa_linux_gcc b/config/arm/arm64_dpaa_linux_gcc
index e9d5fd31fc..0d5761bd72 100644
--- a/config/arm/arm64_dpaa_linux_gcc
+++ b/config/arm/arm64_dpaa_linux_gcc
@@ -1,6 +1,6 @@ 
 [binaries]
-c = 'aarch64-linux-gnu-gcc'
-cpp = 'aarch64-linux-gnu-cpp'
+c = ['ccache', 'aarch64-linux-gnu-gcc']
+cpp = ['ccache', 'aarch64-linux-gnu-cpp']
 ar = 'aarch64-linux-gnu-ar'
 as = 'aarch64-linux-gnu-as'
 strip = 'aarch64-linux-gnu-strip'
diff --git a/config/arm/arm64_emag_linux_gcc b/config/arm/arm64_emag_linux_gcc
index 9cdd931180..16ec49fc32 100644
--- a/config/arm/arm64_emag_linux_gcc
+++ b/config/arm/arm64_emag_linux_gcc
@@ -1,6 +1,6 @@ 
 [binaries]
-c = 'aarch64-linux-gnu-gcc'
-cpp = 'aarch64-linux-gnu-cpp'
+c = ['ccache', 'aarch64-linux-gnu-gcc']
+cpp = ['ccache', 'aarch64-linux-gnu-cpp']
 ar = 'aarch64-linux-gnu-gcc-ar'
 strip = 'aarch64-linux-gnu-strip'
 pkgconfig = 'aarch64-linux-gnu-pkg-config'
diff --git a/config/arm/arm64_graviton2_linux_gcc b/config/arm/arm64_graviton2_linux_gcc
index 8016fd236c..094c540f50 100644
--- a/config/arm/arm64_graviton2_linux_gcc
+++ b/config/arm/arm64_graviton2_linux_gcc
@@ -1,6 +1,6 @@ 
 [binaries]
-c = 'aarch64-linux-gnu-gcc'
-cpp = 'aarch64-linux-gnu-cpp'
+c = ['ccache', 'aarch64-linux-gnu-gcc']
+cpp = ['ccache', 'aarch64-linux-gnu-cpp']
 ar = 'aarch64-linux-gnu-gcc-ar'
 strip = 'aarch64-linux-gnu-strip'
 pkgconfig = 'aarch64-linux-gnu-pkg-config'
diff --git a/config/arm/arm64_kunpeng920_linux_gcc b/config/arm/arm64_kunpeng920_linux_gcc
index c4685b2458..fc057c9063 100644
--- a/config/arm/arm64_kunpeng920_linux_gcc
+++ b/config/arm/arm64_kunpeng920_linux_gcc
@@ -1,6 +1,6 @@ 
 [binaries]
-c = 'aarch64-linux-gnu-gcc'
-cpp = 'aarch64-linux-gnu-cpp'
+c = ['ccache', 'aarch64-linux-gnu-gcc']
+cpp = ['ccache', 'aarch64-linux-gnu-cpp']
 ar = 'aarch64-linux-gnu-gcc-ar'
 strip = 'aarch64-linux-gnu-strip'
 pkgconfig = 'aarch64-linux-gnu-pkg-config'
diff --git a/config/arm/arm64_kunpeng930_linux_gcc b/config/arm/arm64_kunpeng930_linux_gcc
index fb85d2d710..5f43941fae 100644
--- a/config/arm/arm64_kunpeng930_linux_gcc
+++ b/config/arm/arm64_kunpeng930_linux_gcc
@@ -1,6 +1,6 @@ 
 [binaries]
-c = 'aarch64-linux-gnu-gcc'
-cpp = 'aarch64-linux-gnu-cpp'
+c = ['ccache', 'aarch64-linux-gnu-gcc']
+cpp = ['ccache', 'aarch64-linux-gnu-cpp']
 ar = 'aarch64-linux-gnu-gcc-ar'
 strip = 'aarch64-linux-gnu-strip'
 pkgconfig = 'aarch64-linux-gnu-pkg-config'
diff --git a/config/arm/arm64_n1sdp_linux_gcc b/config/arm/arm64_n1sdp_linux_gcc
index 0df283e2f4..fc123ab53f 100644
--- a/config/arm/arm64_n1sdp_linux_gcc
+++ b/config/arm/arm64_n1sdp_linux_gcc
@@ -1,6 +1,6 @@ 
 [binaries]
-c = 'aarch64-linux-gnu-gcc'
-cpp = 'aarch64-linux-gnu-cpp'
+c = ['ccache', 'aarch64-linux-gnu-gcc']
+cpp = ['ccache', 'aarch64-linux-gnu-cpp']
 ar = 'aarch64-linux-gnu-gcc-ar'
 strip = 'aarch64-linux-gnu-strip'
 pkgconfig = 'aarch64-linux-gnu-pkg-config'
diff --git a/config/arm/arm64_n2_linux_gcc b/config/arm/arm64_n2_linux_gcc
index 036aee2b0a..930bd5c236 100644
--- a/config/arm/arm64_n2_linux_gcc
+++ b/config/arm/arm64_n2_linux_gcc
@@ -1,6 +1,6 @@ 
 [binaries]
-c = 'aarch64-linux-gnu-gcc'
-cpp = 'aarch64-linux-gnu-cpp'
+c = ['ccache', 'aarch64-linux-gnu-gcc']
+cpp = ['ccache', 'aarch64-linux-gnu-cpp']
 ar = 'aarch64-linux-gnu-gcc-ar'
 strip = 'aarch64-linux-gnu-strip'
 pkgconfig = 'aarch64-linux-gnu-pkg-config'
diff --git a/config/arm/arm64_stingray_linux_gcc b/config/arm/arm64_stingray_linux_gcc
index 319a4a151d..5dfcd974fd 100644
--- a/config/arm/arm64_stingray_linux_gcc
+++ b/config/arm/arm64_stingray_linux_gcc
@@ -1,6 +1,6 @@ 
 [binaries]
-c = 'aarch64-linux-gnu-gcc'
-cpp = 'aarch64-linux-gnu-cpp'
+c = ['ccache', 'aarch64-linux-gnu-gcc']
+cpp = ['ccache', 'aarch64-linux-gnu-cpp']
 ar = 'aarch64-linux-gnu-gcc-ar'
 strip = 'aarch64-linux-gnu-strip'
 pkgconfig = 'aarch64-linux-gnu-pkg-config'
diff --git a/config/arm/arm64_thunderx2_linux_gcc b/config/arm/arm64_thunderx2_linux_gcc
index 69c71cbc82..c1f5995d93 100644
--- a/config/arm/arm64_thunderx2_linux_gcc
+++ b/config/arm/arm64_thunderx2_linux_gcc
@@ -1,6 +1,6 @@ 
 [binaries]
-c = 'aarch64-linux-gnu-gcc'
-cpp = 'aarch64-linux-gnu-cpp'
+c = ['ccache', 'aarch64-linux-gnu-gcc']
+cpp = ['ccache', 'aarch64-linux-gnu-cpp']
 ar = 'aarch64-linux-gnu-gcc-ar'
 strip = 'aarch64-linux-gnu-strip'
 pkgconfig = 'aarch64-linux-gnu-pkg-config'
diff --git a/config/arm/arm64_thunderxt83_linux_gcc b/config/arm/arm64_thunderxt83_linux_gcc
index 47102c900b..52746e2e59 100644
--- a/config/arm/arm64_thunderxt83_linux_gcc
+++ b/config/arm/arm64_thunderxt83_linux_gcc
@@ -1,6 +1,6 @@ 
 [binaries]
-c = 'aarch64-linux-gnu-gcc'
-cpp = 'aarch64-linux-gnu-cpp'
+c = ['ccache', 'aarch64-linux-gnu-gcc']
+cpp = ['ccache', 'aarch64-linux-gnu-cpp']
 ar = 'aarch64-linux-gnu-gcc-ar'
 strip = 'aarch64-linux-gnu-strip'
 pkgconfig = 'aarch64-linux-gnu-pkg-config'
diff --git a/config/arm/arm64_thunderxt88_linux_gcc b/config/arm/arm64_thunderxt88_linux_gcc
index 372097ba01..fed7eb791e 100644
--- a/config/arm/arm64_thunderxt88_linux_gcc
+++ b/config/arm/arm64_thunderxt88_linux_gcc
@@ -1,6 +1,6 @@ 
 [binaries]
-c = 'aarch64-linux-gnu-gcc'
-cpp = 'aarch64-linux-gnu-cpp'
+c = ['ccache', 'aarch64-linux-gnu-gcc']
+cpp = ['ccache', 'aarch64-linux-gnu-cpp']
 ar = 'aarch64-linux-gnu-gcc-ar'
 strip = 'aarch64-linux-gnu-strip'
 pkgconfig = 'aarch64-linux-gnu-pkg-config'
diff --git a/config/ppc/ppc64le-power8-linux-gcc b/config/ppc/ppc64le-power8-linux-gcc
index 51f7ceebf3..465044e427 100644
--- a/config/ppc/ppc64le-power8-linux-gcc
+++ b/config/ppc/ppc64le-power8-linux-gcc
@@ -1,6 +1,6 @@ 
 [binaries]
-c = 'powerpc64le-linux-gcc'
-cpp = 'powerpc64le-linux-cpp'
+c = ['ccache', 'powerpc64le-linux-gcc']
+cpp = ['ccache', 'powerpc64le-linux-cpp']
 ar = 'powerpc64le-linux-gcc-ar'
 strip = 'powerpc64le-linux-strip'
 
diff --git a/config/ppc/ppc64le-power8-linux-gcc-ubuntu b/config/ppc/ppc64le-power8-linux-gcc-ubuntu
index 803c612cbc..44d7e0100a 100644
--- a/config/ppc/ppc64le-power8-linux-gcc-ubuntu
+++ b/config/ppc/ppc64le-power8-linux-gcc-ubuntu
@@ -1,6 +1,6 @@ 
 [binaries]
-c = 'powerpc64le-linux-gnu-gcc'
-cpp = 'powerpc64le-linux-gnu-cpp'
+c = ['ccache', 'powerpc64le-linux-gnu-gcc']
+cpp = ['ccache', 'powerpc64le-linux-gnu-cpp']
 ar = 'powerpc64le-linux-gnu-ar'
 strip = 'powerpc64le-linux-gnu-strip'
 
diff --git a/config/x86/cross-mingw b/config/x86/cross-mingw
index 09f7af0928..cddebda5b5 100644
--- a/config/x86/cross-mingw
+++ b/config/x86/cross-mingw
@@ -1,6 +1,6 @@ 
 [binaries]
-c = 'x86_64-w64-mingw32-gcc'
-cpp = 'x86_64-w64-mingw32-g++'
+c = ['ccache', 'x86_64-w64-mingw32-gcc']
+cpp = ['ccache', 'x86_64-w64-mingw32-g++']
 ld = 'x86_64-w64-mingw32-ld'
 ar = 'x86_64-w64-mingw32-ar'
 strip = 'x86_64-w64-mingw32-strip'