[OE-core] a few more picky questions about COMPATIBLE_MACHINE usage

Phil Blundell pb at pbcl.net
Mon Feb 27 17:50:06 UTC 2017


On Mon, 2017-02-27 at 09:09 -0500, Robert P. J. Day wrote:
>  # webkit-efl isn't available for < armv7a
>  COMPATIBLE_MACHINE = "(-)"
>   COMPATIBLE_MACHINE_x86 = "(.*)"
>   COMPATIBLE_MACHINE_x86-64 = "(.*)"
>   COMPATIBLE_MACHINE_armv7a = "(.*)"
> 
>   first, that comment seems out of date as it makes no mention of
> MIPS
> or ppc, but that's just being picky.
> 
>   next, i assume the line:
> 
>   COMPATIBLE_MACHINE = "(-)"
> 
> is to initialize the set of compatible machines to the empty set,
> yes?

I think the intent is to set it to a string that "can't possibly ever
match". 

> 
  i next assume that lines of the form:
> 
>   COMPATIBLE_MACHINE_x86 = "(.*)"
> 
> are meant to indicate that if that MACHINE_OVERRIDES comparison
> succeeds, then all possible targets are compatible, is that right?
> however, given precisely those lines above, is it not equivalent to
> just write:
> 
>   COMPATIBLE_MACHINE = "(x86|x86-64|armv7a)"

No, because "armv7a" is not a MACHINE.  It would be more equivalent to
write

COMPATIBLE_HOST = "armv7a-.*"

but even this would not be quite the same because it would fail to
match "cortexa15-linux" for example.  Actually that's not a very good
example because cortexa15 is armv7ve not armv7a, but you get the idea.

> oddly, there is another recipe that seems to do the same thing, but
> in
> a very different way, meta-oe/recipes-support/ne10/ne10_1.2.1.bb:
> 
>   COMPATIBLE_MACHINE_aarch64 = "(.*)"
>   COMPATIBLE_MACHINE_armv7a = "(.*)"
> 
>   python () {
>     if any(t.startswith('armv7') for t in
> d.getVar('TUNE_FEATURES').split()):
>         d.setVar('NE10_TARGET_ARCH', 'armv7')
>         bb.debug(2, 'Building Ne10 for armv7')
>     elif any(t.startswith('aarch64') for t in
> d.getVar('TUNE_FEATURES').split()):
>         d.setVar('NE10_TARGET_ARCH', 'aarch64')
>         bb.debug(2, 'Building Ne10 for aarch64')
>     else:
>         raise bb.parse.SkipPackage("Incompatible with archs other
> than armv7 and aarch64")
>   }

The COMPATIBLE_MACHINE declarations there do seem completely useless
and redundant.  I can only assume that the author of this recipe tried
to use COMPATIBLE_MACHINE to get what they wanted, found they couldn't
(which is true, the COMPATIBLE_MACHINE semantics are full of suck, and
even COMPATIBLE_HOST has a fairly high suckage quotient) and resorted
to writing python to express their requirements.

> now, i can see that that anonymous python routine refines the
> machine compatibility even further but, to speed things up, why not
> first start with just:
> 
>   COMPATIBLE_MACHINE = "(aarch64|armv7a)"
> 
> or (once again), am i misunderstanding something?

No, that will lose unless your MACHINE happens to be literally named
"aarch64", which it probably isn't.  But in any case there is no magic
associated with COMPATIBLE_MACHINE, it is just processed by a piece of
anonymous python which is not entirely dissimilar to that bit you
quoted above.

p.




More information about the Openembedded-core mailing list