Bug 13571

Summary: Meson cross detection is broken
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Ross Burton <ross.burton>
Component: devtools / tool chainAssignee: Ross Burton <ross.burton>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: meta.mr.watcher, meta.watcher
Version: unspecified   
Target Milestone: 2.8 M4   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Ross Burton 2019-10-04 00:26:16 UTC
Upstream Meson fails to detect cross if host and target are compatible (x86->x86).

We patch Meson to check if an exe_wrapper is needed instead (0001-mesonbuild-environment.py-do-not-determine-whether-a.patch).  This appears to work for cross builds but the same patch breaks builds on target where it believes that an exe wrapper is needed and believes that a native build is cross.

I've filed https://github.com/mesonbuild/meson/issues/5993 upstream to track this but we need to fix this for M4 I think.
Comment 1 Alexander Kanavin 2019-10-04 09:26:52 UTC
How can I reproduce this?
Comment 2 Alexander Kanavin 2019-10-04 09:29:53 UTC
Maybe we can simply apply this patch only for native and nativesdk but not for target? Meanwhile hopefully upstream will sort this out.
Comment 3 Ross Burton 2019-10-07 09:46:22 UTC
The reproducer is to try a build on target using Meson: it will detect as cross due to the change in 0001-mesonbuild-environment.py-do-not-determine-whether-a.patch.

Removing the patch will break cross builds if the machines match.

I've a patch which does this:

      def is_cross_build(self) -> bool:
-        return self.need_exe_wrapper()
+        return bool(self.coredata.cross_files)

Appears to work.
Comment 4 Ross Burton 2019-10-07 09:51:34 UTC
Good news is that over the weekend Jussi merged a fix upstream.
Comment 5 Ross Burton 2019-10-17 14:54:07 UTC
Fixed in oe-core 9aa543aa9bd78c63343ae28fc85113ca2c9e0094.