Skip to contentSkip to conversation

build: ccache support for cross build

PATCH Superseded [email protected] 7 participants 15 messages Jun 2, 2022 – Jun 14, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 build: ccache support for cross build

From: Jerin Jacob <[email protected]>

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

---
 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(-)
config/arm/arm32_armv8_linux_gcc +2 -2
index 89f8a12881..7f2977e49d 100644
@@ -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'
config/arm/arm64_armada_linux_gcc +2 -2
index 301418949b..1566999101 100644
@@ -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'
config/arm/arm64_armv8_linux_clang_ubuntu +2 -2
index db488d75f4..86ae43937b 100644
@@ -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'
config/arm/arm64_armv8_linux_gcc +2 -2
index 5391d35389..048c2d9f29 100644
@@ -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'
config/arm/arm64_bluefield_linux_gcc +2 -2
index 248a9f031a..38df3c198b 100644
@@ -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'
config/arm/arm64_centriq2400_linux_gcc +2 -2
index dfe9110331..0966eef2c5 100644
@@ -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'
config/arm/arm64_cn10k_linux_gcc +2 -2
index a3578c03a1..201e0ccd59 100644
@@ -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'
config/arm/arm64_cn9k_linux_gcc +2 -2
index a94b44a551..a9b4d51958 100644
@@ -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'
config/arm/arm64_dpaa_linux_gcc +2 -2
index e9d5fd31fc..0d5761bd72 100644
@@ -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'
config/arm/arm64_emag_linux_gcc +2 -2
index 9cdd931180..16ec49fc32 100644
@@ -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'
config/arm/arm64_graviton2_linux_gcc +2 -2
index 8016fd236c..094c540f50 100644
@@ -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'
config/arm/arm64_kunpeng920_linux_gcc +2 -2
index c4685b2458..fc057c9063 100644
@@ -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'
config/arm/arm64_kunpeng930_linux_gcc +2 -2
index fb85d2d710..5f43941fae 100644
@@ -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'
config/arm/arm64_n1sdp_linux_gcc +2 -2
index 0df283e2f4..fc123ab53f 100644
@@ -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'
config/arm/arm64_n2_linux_gcc +2 -2
index 036aee2b0a..930bd5c236 100644
@@ -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'
config/arm/arm64_stingray_linux_gcc +2 -2
index 319a4a151d..5dfcd974fd 100644
@@ -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'
config/arm/arm64_thunderx2_linux_gcc +2 -2
index 69c71cbc82..c1f5995d93 100644
@@ -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'
config/arm/arm64_thunderxt83_linux_gcc +2 -2
index 47102c900b..52746e2e59 100644
@@ -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'
config/arm/arm64_thunderxt88_linux_gcc +2 -2
index 372097ba01..fed7eb791e 100644
@@ -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'
config/ppc/ppc64le-power8-linux-gcc +2 -2
index 51f7ceebf3..465044e427 100644
@@ -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'
 
config/ppc/ppc64le-power8-linux-gcc-ubuntu +2 -2
index 803c612cbc..44d7e0100a 100644
@@ -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'
 
config/x86/cross-mingw +2 -2
index 09f7af0928..cddebda5b5 100644
@@ -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'
Signature · 1 line
2.36.1
#1 lore raw
Quoted 10 lines · On Thu, Jun 02, 2022 at 02:53:55PM +0530, [email protected] wrote:

From: Jerin Jacob <[email protected]>

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

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

#2 lore raw
Quoted 8 lines · Bruce Richardson
Quoted 6 lines · On Thu, Jun 02, 2022 at 02:53:55PM +0530, [email protected] wrote:

From: Jerin Jacob <[email protected]>

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

Quoted 6 lines
Quoted 4 lines

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

Does this still work even if ccache is not available? That's not fully

Yes.

Quoted 4 lines

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.

Quoted 3 lines

/Bruce

#3 lore raw

02/06/2022 11:43, Jerin Jacob:

Quoted 17 lines
Quoted 8 lines · Bruce Richardson
Quoted 6 lines · On Thu, Jun 02, 2022 at 02:53:55PM +0530, [email protected] wrote:

From: Jerin Jacob <[email protected]>

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

Quoted 6 lines
Quoted 4 lines

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

Does this still work even if ccache is not available? That's not fully

Quoted 8 lines

Yes.

Quoted 4 lines

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.

#4 lore raw
Quoted 21 lines · Thomas Monjalon

02/06/2022 11:43, Jerin Jacob:

Quoted 19 lines
Quoted 8 lines · Bruce Richardson
Quoted 6 lines · On Thu, Jun 02, 2022 at 02:53:55PM +0530, [email protected] wrote:

From: Jerin Jacob <[email protected]>

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

Quoted 6 lines
Quoted 4 lines

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

Does this still work even if ccache is not available? That's not fully

Yes.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

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

Quoted 3 lines

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.

Quoted 6 lines

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.

#5 lore raw
Quoted 40 lines · Jerin Jacob
Quoted 21 lines · Thomas Monjalon

02/06/2022 11:43, Jerin Jacob:

Quoted 19 lines
Quoted 8 lines · Bruce Richardson
Quoted 6 lines · On Thu, Jun 02, 2022 at 02:53:55PM +0530, [email protected] wrote:

From: Jerin Jacob <[email protected]>

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

Quoted 6 lines
Quoted 4 lines

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

Does this still work even if ccache is not available? That's not fully

Yes.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

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

Quoted 1 line
Quoted 5 lines
Quoted 2 lines

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

#6 lore raw
In reply to Jerin Jacob
Quoted 30 lines · Jerin Jacob
Quoted 28 lines · Thomas Monjalon

02/06/2022 11:43, Jerin Jacob:

Quoted 25 lines
Quoted 8 lines · Bruce Richardson
Quoted 6 lines · On Thu, Jun 02, 2022 at 02:53:55PM +0530, [email protected] wrote:

From: Jerin Jacob <[email protected]>

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

Quoted 6 lines
Quoted 4 lines

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

Does this still work even if ccache is not available? That's not fully

Yes.

Quoted 4 lines

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.

Quoted 7 lines
Quoted 1 line

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.

Quoted 15 lines
Quoted 6 lines

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.

Quoted 6 lines

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.

#7 lore raw

08/06/2022 10:22, Jerin Jacob:

Quoted 35 lines · Jerin Jacob
Quoted 34 lines · Thomas Monjalon
Quoted 21 lines

02/06/2022 11:43, Jerin Jacob:

Quoted 19 lines
Quoted 8 lines · Bruce Richardson
Quoted 6 lines · On Thu, Jun 02, 2022 at 02:53:55PM +0530, [email protected] wrote:

From: Jerin Jacob <[email protected]>

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

Quoted 6 lines
Quoted 4 lines

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

Does this still work even if ccache is not available? That's not fully

Yes.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

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.

Quoted 7 lines
Quoted 3 lines

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.

#8 lore raw
Quoted 41 lines · Thomas Monjalon

08/06/2022 10:22, Jerin Jacob:

Quoted 39 lines · Jerin Jacob
Quoted 37 lines · Thomas Monjalon
Quoted 21 lines

02/06/2022 11:43, Jerin Jacob:

Quoted 19 lines
Quoted 8 lines · Bruce Richardson
Quoted 6 lines · On Thu, Jun 02, 2022 at 02:53:55PM +0530, [email protected] wrote:

From: Jerin Jacob <[email protected]>

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

Quoted 6 lines
Quoted 4 lines

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

Does this still work even if ccache is not available? That's not fully

Yes.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

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

Quoted 7 lines
Quoted 3 lines

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/[email protected]/

Thanks

Quoted 3 lines
#9 lore raw
Quoted 47 lines · Jerin Jacob
Quoted 45 lines · Thomas Monjalon

08/06/2022 10:22, Jerin Jacob:

Quoted 42 lines · Jerin Jacob
Quoted 30 lines · Thomas Monjalon
Quoted 28 lines

02/06/2022 11:43, Jerin Jacob:

Quoted 25 lines
Quoted 8 lines · Bruce Richardson
Quoted 6 lines · On Thu, Jun 02, 2022 at 02:53:55PM +0530, [email protected] wrote:

From: Jerin Jacob <[email protected]>

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

Quoted 6 lines
Quoted 4 lines

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

Does this still work even if ccache is not available? That's not fully

Yes.

Quoted 4 lines

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.

Quoted 7 lines
Quoted 1 line

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.

Quoted 8 lines
Quoted 3 lines

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/[email protected]/

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.

#10 lore raw

PATCH v2 1/1 build: ccache support for cross build

In reply to [email protected]

From: Jerin Jacob <[email protected]>

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

Also, updated devtools/test-meson-builds.sh
script to find the correct DPDK_TARGET due to
change in cross file syntax.

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

---

v2:
- Rebased with master, therefore added update riscv64 cross files
- Fixed DPDK_TARGET detection with devtools/test-meson-builds.sh due to cross file synatx update.

 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/riscv/riscv64_linux_gcc             | 4 ++--
 config/riscv/riscv64_sifive_u740_linux_gcc | 4 ++--
 config/x86/cross-mingw                     | 4 ++--
 devtools/test-meson-builds.sh              | 3 ++-
 25 files changed, 50 insertions(+), 49 deletions(-)
config/arm/arm32_armv8_linux_gcc +2 -2
index 89f8a12881..7f2977e49d 100644
@@ -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'
config/arm/arm64_armada_linux_gcc +2 -2
index 301418949b..1566999101 100644
@@ -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'
config/arm/arm64_armv8_linux_clang_ubuntu +2 -2
index db488d75f4..86ae43937b 100644
@@ -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'
config/arm/arm64_armv8_linux_gcc +2 -2
index 5391d35389..048c2d9f29 100644
@@ -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'
config/arm/arm64_bluefield_linux_gcc +2 -2
index 248a9f031a..38df3c198b 100644
@@ -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'
config/arm/arm64_centriq2400_linux_gcc +2 -2
index dfe9110331..0966eef2c5 100644
@@ -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'
config/arm/arm64_cn10k_linux_gcc +2 -2
index a3578c03a1..201e0ccd59 100644
@@ -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'
config/arm/arm64_cn9k_linux_gcc +2 -2
index a94b44a551..a9b4d51958 100644
@@ -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'
config/arm/arm64_dpaa_linux_gcc +2 -2
index e9d5fd31fc..0d5761bd72 100644
@@ -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'
config/arm/arm64_emag_linux_gcc +2 -2
index 9cdd931180..16ec49fc32 100644
@@ -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'
config/arm/arm64_graviton2_linux_gcc +2 -2
index 8016fd236c..094c540f50 100644
@@ -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'
config/arm/arm64_kunpeng920_linux_gcc +2 -2
index c4685b2458..fc057c9063 100644
@@ -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'
config/arm/arm64_kunpeng930_linux_gcc +2 -2
index fb85d2d710..5f43941fae 100644
@@ -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'
config/arm/arm64_n1sdp_linux_gcc +2 -2
index 0df283e2f4..fc123ab53f 100644
@@ -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'
config/arm/arm64_n2_linux_gcc +2 -2
index 036aee2b0a..930bd5c236 100644
@@ -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'
config/arm/arm64_stingray_linux_gcc +2 -2
index 319a4a151d..5dfcd974fd 100644
@@ -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'
config/arm/arm64_thunderx2_linux_gcc +2 -2
index 69c71cbc82..c1f5995d93 100644
@@ -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'
config/arm/arm64_thunderxt83_linux_gcc +2 -2
index 47102c900b..52746e2e59 100644
@@ -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'
config/arm/arm64_thunderxt88_linux_gcc +2 -2
index 372097ba01..fed7eb791e 100644
@@ -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'
config/ppc/ppc64le-power8-linux-gcc +2 -2
index 51f7ceebf3..465044e427 100644
@@ -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'
 
config/ppc/ppc64le-power8-linux-gcc-ubuntu +2 -2
index 803c612cbc..44d7e0100a 100644
@@ -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'
 
config/riscv/riscv64_linux_gcc +2 -2
index ed4d3ce7fb..5e58781193 100644
@@ -1,6 +1,6 @@
 [binaries]
-c = 'riscv64-linux-gnu-gcc'
-cpp = 'riscv64-linux-gnu-g++'
+c = ['ccache', 'riscv64-linux-gnu-gcc']
+cpp = ['ccache', 'riscv64-linux-gnu-g++']
 ar = 'riscv64-linux-gnu-ar'
 strip = 'riscv64-linux-gnu-strip'
 pcap-config = ''
config/riscv/riscv64_sifive_u740_linux_gcc +2 -2
index 3d1905c434..58d2c92f8c 100644
@@ -1,6 +1,6 @@
 [binaries]
-c = 'riscv64-unknown-linux-gnu-gcc'
-cpp = 'riscv64-unknown-linux-gnu-g++'
+c = ['ccache', 'riscv64-unknown-linux-gnu-gcc']
+cpp = ['ccache', 'riscv64-unknown-linux-gnu-g++']
 ar = 'riscv64-unknown-linux-gnu-ar'
 strip = 'riscv64-unknown-linux-gnu-strip'
 pcap-config = ''
config/x86/cross-mingw +2 -2
index 09f7af0928..cddebda5b5 100644
@@ -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'
devtools/test-meson-builds.sh +2 -1
index f732dccf6c..e44a2b1995 100755
@@ -160,7 +160,8 @@ build () # <directory> <target cc | cross file> <ABI check> [meson options]
 	if [ -n "$crossfile" ] ; then
 		cross="--cross-file $crossfile"
 		targetcc=$(sed -n 's,^c[[:space:]]*=[[:space:]]*,,p' \
-			$crossfile | tr -d "'" | tr -d '"')
+			$crossfile | cut -d ',' -f 2 | \
+			tr -d "'" | tr -d '"' | tr -d ']' | tr -d ' ')
 	else
 		cross=
 	fi
Signature · 1 line
2.36.1
Acked-by on v2 1/1
#11 lore raw

Test with: arm64_kunpeng920/930 and gcc-7/10, also with ccache or no, all pass

Quoted 34 lines · On 2022/6/9 1:13, [email protected] wrote:

From: Jerin Jacob <[email protected]>

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

Also, updated devtools/test-meson-builds.sh
script to find the correct DPDK_TARGET due to
change in cross file syntax.

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

---

v2:
- Rebased with master, therefore added update riscv64 cross files
- Fixed DPDK_TARGET detection with devtools/test-meson-builds.sh due to cross file synatx update.

 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 ++--

[snip]

Quoted 1 line
Acked-by on v2 1/1
#12 lore raw
In reply to [email protected]
Quoted 18 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Thursday, June 9, 2022 1:13 AM
To: [email protected]; Jan Viktorin <[email protected]>; Ruifeng Wang <[email protected]>; Bruce Richardson <[email protected]>; David Christensen <[email protected]>; Stanislaw Kardach <[email protected]>; Konstantin Ananyev <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH v2] build: ccache support for cross build

From: Jerin Jacob <[email protected]>

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

Quoted 9 lines

Also, updated devtools/test-meson-builds.sh script to find the correct DPDK_TARGET due to change in cross file syntax.

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

---

Verified that cross-build works fine with/without ccache.

#13 lore raw
Quoted 9 lines
Quoted 9 lines

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

Also, updated devtools/test-meson-builds.sh script to find the correct DPDK_TARGET due to change in cross file syntax.

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

Quoted 6 lines
Quoted 3 lines

---

Verified that cross-build works fine with/without ccache.

Applied with minor change, thanks.

#14 lore raw
In reply to [email protected]

08/06/2022 19:13, [email protected]:

devtools/test-meson-builds.sh build () # <directory> <target cc | cross file> <ABI check> [meson options] · line 164

Quoted 9 lines
devtools/test-meson-builds.sh +2 -1
@@ -160,7 +160,8 @@ build () # <directory> <target cc | cross file> <ABI check> [meson options]
 	if [ -n "$crossfile" ] ; then
 		cross="--cross-file $crossfile"
 		targetcc=$(sed -n 's,^c[[:space:]]*=[[:space:]]*,,p' \
-			$crossfile | tr -d "'" | tr -d '"')
+			$crossfile | cut -d ',' -f 2 | \
+			tr -d "'" | tr -d '"' | tr -d ']' | tr -d ' ')

The last line can be shortened to

	tr -d "'"'"] '

I'll change while merging.