Message ID | 20250627140633.354460-1-skandigraun@gmail.com |
---|---|
State | New |
Headers | show |
Series | [meta-oe] nodejs: inherit qemu class conditionally | expand |
On Fri, 27 Jun 2025 at 16:06, Gyorgy Sarvari via lists.openembedded.org <skandigraun=gmail.com@lists.openembedded.org> wrote: > The recipe unconditionally inherits the qemu class, because it executes > some target binaries when it is cross-compiled and the bit-width of the > build host and the target host are different. > > Since it is unconditional, it also means that it is inherited for native > and nativesdk builds also. The qemu class uses some qemu options that are > always derived from the target machine's configuration, even when the > recipe is built for class-native. This means that some of the variables > used by the recipe changes (e.g. QEMU_OPTIONS), and the shared state cache > is invalidated when the target machine changes, even when nodejs-native is > being built - and it triggers a full rebuild of nodejs-native unnecessarily. > > To avoid this, inherit the qemu class conditionally, only in case it is > used (when the target and build arch's bit-widths are different). > > Also, inherit qemu-native based on the same condition, and move around the > qemu-dependent code a bit, so it will be only executed when the qemu class > is inherited. This doesn't quite look right. Plenty of other recipes inherit qemu unconditionally, including some pretty foundational ones like python3, and they do not need this fix, or do they? I think something else is going on here, and that issue needs to be properly investigated. Can you describe the steps needed to observe the issue? Can you take those steps for e.g. python3-native? Alex
diff --git a/meta-oe/recipes-devtools/nodejs/nodejs_22.16.0.bb b/meta-oe/recipes-devtools/nodejs/nodejs_22.16.0.bb index 4bc829f140..162c9607d2 100644 --- a/meta-oe/recipes-devtools/nodejs/nodejs_22.16.0.bb +++ b/meta-oe/recipes-devtools/nodejs/nodejs_22.16.0.bb @@ -9,7 +9,9 @@ DEPENDS = "openssl openssl-native file-replacement-native python3-packaging-nati DEPENDS:append:class-target = " qemu-native" DEPENDS:append:class-native = " c-ares-native" -inherit pkgconfig python3native qemu ptest siteinfo +inherit pkgconfig python3native ptest siteinfo +inherit_defer ${@bb.utils.contains('HOST_AND_TARGET_SAME_WIDTH', '0', 'qemu', '', d)} + COMPATIBLE_MACHINE:armv4 = "(!.*armv4).*" COMPATIBLE_MACHINE:armv5 = "(!.*armv5).*" @@ -108,11 +110,11 @@ python do_create_v8_qemu_wrapper () { on the host.""" qemu_libdirs = [d.expand('${STAGING_DIR_HOST}${libdir}'), d.expand('${STAGING_DIR_HOST}${base_libdir}')] - qemu_cmd = qemu_wrapper_cmdline(d, d.getVar('STAGING_DIR_HOST'), - qemu_libdirs) + qemu_cmd = "" - if d.getVar("HOST_AND_TARGET_SAME_WIDTH") == "1": - qemu_cmd = "" + if d.getVar("HOST_AND_TARGET_SAME_WIDTH") == "0": + qemu_cmd = qemu_wrapper_cmdline(d, d.getVar('STAGING_DIR_HOST'), + qemu_libdirs) wrapper_path = d.expand('${B}/v8-qemu-wrapper.sh') with open(wrapper_path, 'w') as wrapper_file: @@ -209,6 +211,7 @@ python __anonymous () { # 32 bit target and 64 bit host (x86-64 or aarch64) have different bit width if d.getVar("SITEINFO_BITS") == "32" and "64" in d.getVar("BUILD_ARCH"): d.setVar("HOST_AND_TARGET_SAME_WIDTH", "0") + d.appendVar("DEPENDS:class-target", " qemu-native") else: d.setVar("HOST_AND_TARGET_SAME_WIDTH", "1") }
The recipe unconditionally inherits the qemu class, because it executes some target binaries when it is cross-compiled and the bit-width of the build host and the target host are different. Since it is unconditional, it also means that it is inherited for native and nativesdk builds also. The qemu class uses some qemu options that are always derived from the target machine's configuration, even when the recipe is built for class-native. This means that some of the variables used by the recipe changes (e.g. QEMU_OPTIONS), and the shared state cache is invalidated when the target machine changes, even when nodejs-native is being built - and it triggers a full rebuild of nodejs-native unnecessarily. To avoid this, inherit the qemu class conditionally, only in case it is used (when the target and build arch's bit-widths are different). Also, inherit qemu-native based on the same condition, and move around the qemu-dependent code a bit, so it will be only executed when the qemu class is inherited. Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> --- meta-oe/recipes-devtools/nodejs/nodejs_22.16.0.bb | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)