From: Patrick Steinhardt Date: Tue, 02 Dec 2025 20:27:42 GMT Subject: Re: [PATCH 2/2] meson: only detect ICONV_OMITS_BOM if possible Message-ID: In-Reply-To: <20251202-toon-cross-compile-v1-2-cabc8bce529f@iotcl.com> On Tue, Dec 02, 2025 at 11:48:09AM +0100, Toon Claes wrote: > In our Meson setup it automatically detects whether ICONV_OMITS_BOM > should be defined. To check this, a piece of code is compiled and ran. > > When cross-compiling, it's not possible to run this piece of code. Guard > this test with a can_run_host_binaries() check to ensure it can run. > > Signed-off-by: Toon Claes > --- > meson.build | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/meson.build b/meson.build > index f1b3615659..95348e69a4 100644 > --- a/meson.build > +++ b/meson.build > @@ -1064,7 +1064,7 @@ if iconv.found() > } > ''' > > - if compiler.run(iconv_omits_bom_source, > + if meson.can_run_host_binaries() and compiler.run(iconv_omits_bom_source, > dependencies: iconv, > name: 'iconv omits BOM', > ).returncode() != 0 We have `not meson.is_cross_build()` in a different location to guard a call to `compiler.run()`. But `can_run_host_binaries()` is the better way to test for this condition, as it allows the host to plug in a wrapper (e.g. QEMU or WINE) that _would_ allow it to execute binaries of the target host. `can_run_host_binaries()` is available since Meson 0.55, and we target a version >=0.61.0. So should we maybe convert that other callsite to use `can_run_host_binaries()` in a separate commit? Thanks for these fixes! Patrick