diff mbox series

[2/2] toolchain-scripts/meta-environment: use each variant's own site files

Message ID 20260928014613.2399839-2-mark.yang@lge.com
State New
Headers show
Series [1/2] siteinfo: add siteinfo_get_files_for_machine() | expand

Commit Message

mark.yang Sept. 28, 2026, 1:46 a.m. UTC
From: "mark.yang" <mark.yang@lge.com>

Compute TOOLCHAIN_CONFIGSITE_NOCACHE for TARGET_ARCH and TARGET_OS
instead of HOST_ARCH and HOST_OS, so each multilib variant's
site-config matches its own tune.

Commit 1e13d1fd22 ("meta-environment: ensure corret
TOOLCHAIN_CONFIGSITE_NOCACHE value") expanded the variable with :=
before cross-canadian changes HOST_ARCH to SDK_ARCH. Since then, every
multilib variant has used the default tune's site files.

On qemux86-64 with the multilib-x86-lib32 fragment, the lib32
site-config has:

  before: ac_cv_sizeof_long=${ac_cv_sizeof_long=8}
  after:  ac_cv_sizeof_long=${ac_cv_sizeof_long=4}

An i686 configure run that loads it uses the cached 8 instead of
running the compile test.

Drop the := as it is no longer needed. Collect
do_generate_content[file-checksums] with all_multilib_tune_values(),
as the [depends] flag does, instead of in an anonymous function that
covered one variant only.

Signed-off-by: mark.yang <mark.yang@lge.com>
---
 meta/classes-recipe/toolchain-scripts.bbclass | 3 ++-
 meta/recipes-core/meta/meta-environment.bb    | 9 ++-------
 2 files changed, 4 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/meta/classes-recipe/toolchain-scripts.bbclass b/meta/classes-recipe/toolchain-scripts.bbclass
index e971b9a270..fe7333afa2 100644
--- a/meta/classes-recipe/toolchain-scripts.bbclass
+++ b/meta/classes-recipe/toolchain-scripts.bbclass
@@ -213,7 +213,8 @@  EOF
 }
 
 #we get the cached site config in the runtime
-TOOLCHAIN_CONFIGSITE_NOCACHE = "${@' '.join(siteinfo_get_files(d)[0])}"
+# cross-canadian changes HOST_ARCH/HOST_OS to the SDK host
+TOOLCHAIN_CONFIGSITE_NOCACHE = "${@' '.join(siteinfo_get_files_for_machine(d.getVar('TARGET_ARCH'), d.getVar('TARGET_OS'), d)[0])}"
 TOOLCHAIN_NEED_CONFIGSITE_CACHE ??= "virtual/${MLPREFIX}libc ncurses"
 DEPENDS += "${TOOLCHAIN_NEED_CONFIGSITE_CACHE}"
 
diff --git a/meta/recipes-core/meta/meta-environment.bb b/meta/recipes-core/meta/meta-environment.bb
index f814061281..8162b70294 100644
--- a/meta/recipes-core/meta/meta-environment.bb
+++ b/meta/recipes-core/meta/meta-environment.bb
@@ -9,8 +9,6 @@  REAL_MULTIMACH_TARGET_SYS = "${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS}"
 
 inherit toolchain-scripts
 TOOLCHAIN_NEED_CONFIGSITE_CACHE:append = " zlib"
-# Need to expand here before cross-candian changes HOST_ARCH -> SDK_ARCH
-TOOLCHAIN_CONFIGSITE_NOCACHE := "${TOOLCHAIN_CONFIGSITE_NOCACHE}"
 
 SDK_DIR = "${WORKDIR}/sdk"
 SDK_OUTPUT = "${SDK_DIR}/image"
@@ -22,6 +20,8 @@  do_generate_content[cleandirs] = "${SDK_OUTPUT}"
 do_generate_content[dirs] = "${SDK_OUTPUT}/${SDKPATH}"
 # Need to ensure we have the virtual mappings and site files for all multtilib variants
 do_generate_content[depends] = "${@oe.utils.build_depends_string(oe.utils.all_multilib_tune_values(d, 'TOOLCHAIN_NEED_CONFIGSITE_CACHE'), 'do_populate_sysroot')}"
+TOOLCHAIN_CONFIGSITE_SEARCHED = "${@' '.join(siteinfo_get_files_for_machine(d.getVar('TARGET_ARCH'), d.getVar('TARGET_OS'), d)[1])}"
+do_generate_content[file-checksums] += "${@oe.utils.all_multilib_tune_values(d, 'TOOLCHAIN_CONFIGSITE_SEARCHED')}"
 python do_generate_content() {
     # Handle multilibs in the SDK environment, siteconfig, etc files...
     localdata = bb.data.createCopy(d)
@@ -46,11 +46,6 @@  python do_generate_content() {
 }
 addtask generate_content before do_install after do_compile
 
-python () {
-    sitefiles, searched = siteinfo_get_files(d, sysrootcache=False)
-    d.appendVarFlag("do_generate_content", "file-checksums", " " + " ".join(searched))
-}
-
 create_sdk_files() {
 	# Setup site file for external use
 	toolchain_create_sdk_siteconfig ${SDK_OUTPUT}/${SDKPATH}/site-config-${REAL_MULTIMACH_TARGET_SYS}