git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/2] meson: use is_cross_build() where possible

From
Toon Claes <toon@iotcl.com>
Date
Dec 3, 2025, 14:53 UTC
Message-ID
<20251203145331.621529-1-toon@iotcl.com>
In-Reply-To
<20251202-toon-cross-compile-v1-0-cabc8bce529f@iotcl.com>

In previous commit the first use of meson.can_run_host_binaries() was introduced. This is a guard around compiler.run() to ensure it's actually possible to execute the provided.

In other places we've been having the same issue, but here `not meson.is_cross_build()` is used as guard. This does the trick, but it also prevents the code from running even when an exe_wrapper is configured.

Switch to using meson.can_run_host_binaries() here as well.

There is another place left that still uses `not meson.is_cross_build()`, but here it's a guard around fs.exists(). That function will always run on the build machine, so checking for cross-compilation is still in place here.

Signed-off-by: Toon Claes <toon@iotcl.com>
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index 95348e69a4..00ad8a5c60 100644
--- a/meson.build
+++ b/meson.build
@@ -1492,7 +1492,7 @@ if not has_bsd_sysctl
   endif
 endif

-if not meson.is_cross_build() and compiler.run('''
+if meson.can_run_host_binaries() and compiler.run('''
   #include <stdio.h>

   int main(int argc, const char **argv)
--
2.52.0
Previous: Toon ClaesNext: Patrick Steinhardt
Message 6 of 11 in “Few fixes for cross-compiling with Meson”
  1. 0/2 Few fixes for cross-compiling with MesonToon Claes, Dec 2, 2025
  2. 1/2 meson: ignore subprojects/.wraplockToon Claes, Dec 2, 2025
  3. 2/2 meson: only detect ICONV_OMITS_BOM if possibleToon Claes, Dec 2, 2025
  4. Patrick SteinhardtDec 2, 2025
  5. Toon ClaesDec 3, 2025
  6. 3/2 meson: use is_cross_build() where possibleToon Claes, Dec 3, 2025
  7. Patrick SteinhardtDec 4, 2025
  8. Carlo Marcelo Arenas BelónDec 7, 2025
  9. Toon ClaesDec 8, 2025
  10. Carlo ArenasDec 9, 2025
  11. Toon ClaesDec 11, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.