public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Uladzimir Bely <ubely@ilbers.de>
To: Jan Kiszka <jan.kiszka@siemens.com>,
	isar-users <isar-users@googlegroups.com>
Subject: Re: [PATCH v2] base: Fix HOST_ARCH for native builds
Date: Fri, 29 Sep 2023 20:25:57 +0300	[thread overview]
Message-ID: <2086e64361cb3fdc602f358e53a27310a182f3f5.camel@ilbers.de> (raw)
In-Reply-To: <6c5308f8c43513ce66e462f6125d40009e5f7390.camel@ilbers.de>

On Fri, 2023-09-29 at 19:36 +0300, Uladzimir Bely wrote:
> On Mon, 2023-09-25 at 13:41 +0200, Jan Kiszka wrote:
> > From: Jan Kiszka <jan.kiszka@siemens.com>
> > 
> > HOST_ARCH must be DISTRO_ARCH when we are not cross-building.
> > Otherwise,
> > recipes that set PACKAGE_ARCH to it will fail in native builds.
> > 
> > Use late expansion for ISAR_CROSS_COMPILE to avoid recursion
> > issues.
> > 
> > Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> > ---
> > 
> > That "expand=False" seems to work fine, so let's move forward with
> > it.
> > 
> >  meta/classes/base.bbclass | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
> > index 88004120..8ca089a2 100644
> > --- a/meta/classes/base.bbclass
> > +++ b/meta/classes/base.bbclass
> > @@ -49,13 +49,15 @@ def oe_import(d):
> >  # We need the oe module name space early (before INHERITs get
> > added)
> >  OE_IMPORTED := "${@oe_import(d)}"
> >  
> > -def get_deb_host_arch():
> > +def get_deb_host_arch(d):
> >      import subprocess
> > +    if d.getVar("ISAR_CROSS_COMPILE", expand=False) != "1":
> > +        return d.getVar("DISTRO_ARCH")
> >      host_arch = subprocess.check_output(
> >          ["dpkg", "--print-architecture"]
> >      ).decode('utf-8').strip()
> >      return host_arch
> > -HOST_ARCH ??= "${@get_deb_host_arch()}"
> > +HOST_ARCH ??= "${@get_deb_host_arch(d)}"
> >  HOST_DISTRO ??= "${DISTRO}"
> >  
> >  die() {
> 
> For some reason this doesn't properly work for some targets in case
> of
> cross-compile mode.
> 
> Without patch (default local.conf with ISAR_CROSS_COMPILE set):
> ```
> bitbake mc:qemuarm64-focal:isar-image-base -e | grep "^HOST_ARCH="
> HOST_ARCH="amd64"
> bitbake mc:rpi-arm64-v8-bullseye:isar-image-base -e | grep
> "^HOST_ARCH="
> HOST_ARCH="amd64"
> bitbake mc:rpi-arm-v7-bullseye:isar-image-base -e | grep
> "^HOST_ARCH="
> HOST_ARCH="amd64"
> bitbake mc:stm32mp15x-bullseye:isar-image-base -e | grep
> "^HOST_ARCH="
> HOST_ARCH="amd64"
> ```
> 
> With patch:
> ```
> bitbake mc:qemuarm64-focal:isar-image-base -e | grep "^HOST_ARCH="
> HOST_ARCH="amd64"
> bitbake mc:rpi-arm64-v8-bullseye:isar-image-base -e | grep
> "^HOST_ARCH="
> HOST_ARCH="amd64"
> bitbake mc:rpi-arm-v7-bullseye:isar-image-base -e | grep
> "^HOST_ARCH="
> HOST_ARCH="armhf"
> bitbake mc:stm32mp15x-bullseye:isar-image-base -e | grep
> "^HOST_ARCH="
> HOST_ARCH="armhf"
> ```
> 
> For some reasons this affects only "armhf" targets...
> 

... And it looks to be caused by line 69 in "imagetypes.bbclass":
ISAR_CROSS_COMPILE:armhf = "${@bb.utils.contains('IMAGE_BASETYPES',
'ubifs', '1', '${THIS_ISAR_CROSS_COMPILE}', d)}"

With (,"expand=False") in case of armhf the wrong DISTRO_ARCH value
assigned to HOST_ARCH.

> As a result, in case of rpi-arm-v7 ${DL_DIR}/deb/debian-bullseye/ has
> wrongly imported non-debian packages and second (cached from base-
> apt)
> build does not work since it can't resolve the dependencies.
> 


  reply	other threads:[~2023-09-29 17:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-25 11:41 Jan Kiszka
2023-09-29 16:36 ` Uladzimir Bely
2023-09-29 17:25   ` Uladzimir Bely [this message]
2023-09-29 17:33     ` Uladzimir Bely
2023-10-01  8:17       ` Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2086e64361cb3fdc602f358e53a27310a182f3f5.camel@ilbers.de \
    --to=ubely@ilbers.de \
    --cc=isar-users@googlegroups.com \
    --cc=jan.kiszka@siemens.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox