Meson/UnknownCPU

From Yocto Project
Jump to: navigation, search

Unknown CPU Family

The Problem

OpenEmbedded uses the machine fragment of the GCC target triplet to identify the target architecture, but Meson uses the values returned by Python's platform.machine() which is based on the uname values. These don't match, so when cross-compiling we need to map the name when writing the Meson cross file. Also OpenEmbedded patches Meson to make an unknown architecture a fatal error instead of just a warning as during the build the warning won't be visible and bad CPU family setting can produce incorrect builds.

The known CPU families in Meson are listed at http://mesonbuild.com/Reference-tables.html#cpu-families.

When this mapping table isn't complete (for example, passing mipsel instead of mips) or the list in Meson needs updating (for example, new architecture) you'll get an error from Meson:

Unknown CPU family mipsel, see https://wiki.yoctoproject.org/wiki/Meson/UnknownCPU for directions

What To Do

In this situation you need to know two values: the OpenEmbedded architecture name (${TARGET_ARCH}) and the Python platform name. The platform name can be obtained in either a virtual machine or on real hardware:

$ python3 -c 'import platform; print(platform.machine())'
x86_64

As a worked example, consider the little-endian MIPS case. The TARGET_ARCH for a MIPS machine in little-endian mode is mipsel but Meson doesn't consider endian changes different CPU families so they're both mips. This is already in the CPU Family table so all that needs to happen is another case added to meson_cpu_family() in meson.bbclass. Please file a bug with this information, or ideally write a patch.

However if the problem is that you're working on an architecture that isn't in Meson's CPU Family list, then first please submit a bug to Meson to get the canonical platform name added, and then an OpenEmbedded bug if a mapping is required.

Personal tools