Skip to contentSkip to conversation

pseudo: Tell makewrappers the target architecture

PATCH Superseded [email protected] 1 participant 2 messages Oct 29

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pseudo: Tell makewrappers the target architecture

From: Sunil Dora <[email protected]>

makewrappers chooses the architecture specific entries in wrapfuncs.in (e.g. the GLIBC_2.17 symbol versions for the xattr wrappers on aarch64) based on platform.machine(), i.e. the machine running the build rather than the machine pseudo is being built for. The result is that pseudo built for qemux86-64 on an aarch64 autobuilder worker ends up with GLIBC_2.17 instead of GLIBC_2.3 and the pseudo packages aren't reproducible between the x86_64 and aarch64 workers.

Add the upstream patch which allows MAKEWRAPPERS_ARCH to override this and set it to TARGET_ARCH. pseudo-native is unaffected since TARGET_ARCH is BUILD_ARCH there.

[YOCTO #16376]

---
 ...ow-the-wrapper-architecture-to-be-se.patch | 88 +++++++++++++++++++
 meta/recipes-devtools/pseudo/pseudo.inc       |  5 ++
 meta/recipes-devtools/pseudo/pseudo_git.bb    |  1 +
 3 files changed, 94 insertions(+)
 create mode 100644 meta/recipes-devtools/pseudo/files/0001-makewrappers-Allow-the-wrapper-architecture-to-be-se.patch
meta/recipes-devtools/pseudo/files/0001-makewrappers-Allow-the-wrapper-architecture-to-be-se.patch new file +88 -0
new file mode 100644
index 0000000000..7bc897b7e5
@@ -0,0 +1,88 @@
+From 43c81997fbe3b39ca5529c1fa3a80695c48f2af6 Mon Sep 17 00:00:00 2001
+From: Sunil Dora <[email protected]>
+Date: Thu, 29 Oct 2026 06:55:15 -0700
+Subject: [PATCH] makewrappers: Allow the wrapper architecture to be set for
+ cross builds
+
+Architecture specific modifiers in wrapfuncs.in, such as
+version-aarch64="GLIBC_2.17" on the xattr wrappers, are selected with
+platform.machine(), so they follow the machine running the script
+rather than the one pseudo is built for. An aarch64 pseudo cross built
+on x86_64 ends up with GLIBC_2.3 and the reverse with GLIBC_2.17, which
+shows up as pseudo not being reproducible between x86_64 and aarch64
+builders.
+
+Add a MAKEWRAPPERS_ARCH variable the build can set and pass it through
+from the Makefile. Unset, the build machine is used as before.
+
+Upstream-Status: Submitted [https://lists.yoctoproject.org/g/yocto-patches/message/5183]
+
+Signed-off-by: Sunil Dora <[email protected]>
+---
+ Makefile.in  | 5 ++++-
+ makewrappers | 9 +++++++--
+ 2 files changed, 11 insertions(+), 3 deletions(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index 6640a73..bc2ab92 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -34,6 +34,9 @@ BITS=@BITS@
+ ARCH_FLAGS=@ARCH_FLAGS@
+ MARK64=@MARK64@
+ RPATH=@RPATH@
++# Architecture the wrappers are generated for, as a uname -m name.
++# Empty means the build machine; set it when cross compiling.
++MAKEWRAPPERS_ARCH ?=
+ VERSION=1.99.0
+ 
+ LIB=@LIB@
+@@ -146,7 +149,7 @@ tables: enums/*.in maketables templatefile.py $(TABLES)
+ 	./maketables enums/*.in
+ 
+ wrappers: makewrappers templatefile.py $(TEMPLATES) ports/*/wrapfuncs.in
+-	CC="$(CC) $(CFLAGS) $(CFLAGS_PSEUDO)" ./makewrappers "xattr=$(XATTR)"
++	CC="$(CC) $(CFLAGS) $(CFLAGS_PSEUDO)" MAKEWRAPPERS_ARCH="$(MAKEWRAPPERS_ARCH)" ./makewrappers "xattr=$(XATTR)"
+ 
+ .SECONDARY: tables wrappers
+ 
+diff --git a/makewrappers b/makewrappers
+index 19508fa..c90f5c7 100755
+--- a/makewrappers
++++ b/makewrappers
+@@ -15,6 +15,10 @@ import platform
+ import subprocess
+ from templatefile import TemplateFile
+ 
++def wrapper_arch():
++    """Architecture the wrappers are built for: MAKEWRAPPERS_ARCH or the build machine."""
++    return os.environ.get("MAKEWRAPPERS_ARCH", "").strip() or platform.machine()
++
+ class ArgumentList:
+     """A (possibly empty) list of arguments"""
+ 
+@@ -319,11 +323,11 @@ class Function:
+             # Strip all leading/trailing whitespace
+             modifiers = {k.strip():v.strip() for k, v in modifiers.items()}
+ 
+-            arch = "-" + platform.machine()
++            arch = "-" + wrapper_arch()
+             # Sorted so that versions-foo appear after versions, so overrides are easy
+             for key in sorted(modifiers):
+                 value = modifiers[key].replace('<equals>', '==')
+-                # If the key is version-arm64 and we're on arm64 then rename this to version
++                # If the key is version-arm64 and we're building for arm64 then rename this to version
+                 if key.endswith(arch):
+                     key = key.replace(arch, "")
+                 setattr(self, key, value)
+@@ -702,6 +706,7 @@ def main(argv):
+     port = Port('common', sources)
+ 
+     # the per-function stuff
++    print("Architecture for wrapper modifiers: %s" % wrapper_arch())
+     print("Writing functions...")
+     all_funcs = port.functions()
+     for name in sorted(all_funcs.keys()):
+-- 
+2.49.0
+
meta/recipes-devtools/pseudo/pseudo.inc +5 -0
index ba946ef9c9..526830207d 100644
@@ -30,6 +30,11 @@ NO32LIBS:class-nativesdk = "1"
 
 PSEUDO_EXTRA_OPTS ?= "--enable-force-async --without-passwd-fallback --enable-epoll --enable-xattr"
 
+# makewrappers picks architecture specific wrapper modifiers from the machine
+# it runs on (platform.machine()), which is wrong when cross compiling. Tell it
+# the target instead. pseudo-native is unchanged: TARGET_ARCH is BUILD_ARCH.
+export MAKEWRAPPERS_ARCH = "${TARGET_ARCH}"
+
 # Compile for the local machine arch...
 do_compile () {
 	if [ "${SITEINFO_BITS}" = "64" ]; then
meta/recipes-devtools/pseudo/pseudo_git.bb +1 -0
index c0332dc9e2..f8903dbb63 100644
@@ -3,6 +3,7 @@ require pseudo.inc
 SRC_URI = "git://git.yoctoproject.org/pseudo;branch=master;protocol=https \
            file://fallback-passwd \
            file://fallback-group \
+           file://0001-makewrappers-Allow-the-wrapper-architecture-to-be-se.patch \
            "
 SRC_URI:append:class-native = " \
     http://downloads.yoctoproject.org/mirror/sources/pseudo-prebuilt-2.33.tar.xz;subdir=${BB_GIT_DEFAULT_DESTSUFFIX}/prebuilt;name=prebuilt \
Signature · 1 line
2.49.0