Skip to content

"Can not run test applications in this cross environment" not consistent with meson.can_run_host_binaries() #13841

@smcv

Description

@smcv

Describe the bug
Similar to #12017, when doing a native build in a Debian armhf chroot (32-bit arm-linux-gnueabihf with ARMv7 baseline) on an aarch64 machine, compiler.run() can fail with Can not run test applications in this cross environment, even though meson.can_run_host_binaries() previously returned true.

https://tests.reproducible-builds.org/debian/logs/unstable/armhf/accountsservice_23.13.9-7.build2.log.gz is an example of this causing a build failure during automated testing.

To Reproduce
In an armhf chroot/container on an an aarch64 machine, without using linux32 or similar personality wrapper:

project('foo', 'c')
if meson.is_cross_build()
    warning('cross build detected')
endif
if meson.can_run_host_binaries()
    meson.get_compiler('c').run('whatever')
endif

(Or set up the above with linux64 meson setup _build)

Workaround (1)
Set a personality so that the kernel pretends to be running on a 32-bit machine, for example:

linux32 meson setup _build

The 32-bit chroots on Debian porterboxes and official Debian buildds do this automatically, but it is not guaranteed, and in particular https://tests.reproducible-builds.org/debian does not guarantee to do so.

Workaround (2)

$ cat > workaround.txt <<EOF
[properties]
needs_exe_wrapper = false
EOF
$ meson setup --native-file workaround.txt _build

Expected behavior
I expected the sample project to configure successfully. (Obviously the invalid C code whatever fails to compile, but in this minimal reproducer that has no practical effect.)

It would also be understandable, although considerably less good, if meson.is_cross_build() returned true and meson.can_run_host_binaries() returned false.

system parameters

  • Is this a cross build or just a plain native build (for the same computer)? .. that depends on precisely how you define a cross build, but meson.is_cross_build() returns false
  • what operating system: Debian testing/unstable
  • what Python version: 3.12.5, 3.12.7
  • what meson --version: 1.5.1, 1.6.0
  • what ninja --version: setup fails before this becomes relevant

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions