From: Sunil Dora <[email protected]> opkg sets HOST_CPU_STR from the build machine's CPU, so libopkg built for aarch64 contains "x86_64" on an x86_64 worker and "aarch64" on an aarch64 worker. Carry the upstream fix, which uses CMAKE_SYSTEM_PROCESSOR (HOST_ARCH via cmake.bbclass).
[YOCTO #15784] [YOCTO #16376] Signed-off-by: Sunil Dora <[email protected]> --- ...the-default-architecture-from-the-ta.patch | 45 +++++++++++++++++++ meta/recipes-devtools/opkg/opkg_0.10.0.bb | 1 + 2 files changed, 46 insertions(+) create mode 100644 meta/recipes-devtools/opkg/opkg/0003-CMakeLists-take-the-default-architecture-from-the-ta.patch diff --git a/meta/recipes-devtools/opkg/opkg/0003-CMakeLists-take-the-default-architecture-from-the-ta.patch b/meta/recipes-devtools/opkg/opkg/0003-CMakeLists-take-the-default-architecture-from-the-ta.patch new file mode 100644 index 0000000000..ee7d35e34c --- /dev/null +++ b/meta/recipes-devtools/opkg/opkg/0003-CMakeLists-take-the-default-architecture-from-the-ta.patch @@ -0,0 +1,45 @@ +From fd8b3359e9e26a6a81f5f7cb04346c7bf44de279 Mon Sep 17 00:00:00 2001 +From: Sunil Dora <[email protected]> +Date: Tue, 29 Sep 2026 23:55:32 -0700 +Subject: [PATCH] CMakeLists: take the default architecture from the target CPU + +HOST_CPU_STR is the default architecture opkg accepts when no "arch" +lines are configured. It is set from CMAKE_HOST_SYSTEM_PROCESSOR, which +is the CPU of the build machine, so a cross-compiled opkg gets the wrong +default and libopkg differs depending on the machine it was built on. + +Use CMAKE_SYSTEM_PROCESSOR, which CMake sets for native builds and the +toolchain file sets when cross-compiling, and stop with an error if a +cross build doesn't set it. + +Fixes Bugzilla: #15784 + +Upstream-Status: Submitted [https://lists.yoctoproject.org/g/opkg/message/218] + +Suggested-by: Alex Stewart <[email protected]> +Signed-off-by: Sunil Dora <[email protected]> +--- + CMakeLists.txt | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e6deba8..7da091d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -45,8 +45,11 @@ option(WITH_GPGME "Enable signature checking with gpgme" ON) + set(DATADIR "/share" CACHE STRING "datadir") + set(SYSCONFDIR "/etc" CACHE STRING "sysconfdir") + set(VARDIR "/var" CACHE STRING "vardir") +-# This was ported from autoconf (it used to be "host_cpu"), but it should be target_cpu: https://bugzilla.yoctoproject.org/show_bug.cgi?id=15784 +-set(HOST_CPU_STR ${CMAKE_HOST_SYSTEM_PROCESSOR} CACHE STRING "Host CPU architecture") ++# Default architecture: the CPU opkg runs on, not the build machine ++if(CMAKE_CROSSCOMPILING AND NOT CMAKE_SYSTEM_PROCESSOR) ++ message(FATAL_ERROR "Cross-compiling requires CMAKE_SYSTEM_PROCESSOR") ++endif() ++set(HOST_CPU_STR "${CMAKE_SYSTEM_PROCESSOR}" CACHE STRING "Default package architecture") + + configure_file(config.h.in config.h) + configure_file(libopkg.pc.in libopkg.pc @ONLY) +-- +2.49.0 + diff --git a/meta/recipes-devtools/opkg/opkg_0.10.0.bb b/meta/recipes-devtools/opkg/opkg_0.10.0.bb index 0631868a30..8563c85780 100644 --- a/meta/recipes-devtools/opkg/opkg_0.10.0.bb +++ b/meta/recipes-devtools/opkg/opkg_0.10.0.bb @@ -16,6 +16,7 @@ SRC_URI = "http://downloads.yoctoproject.org/releases/${BPN}/${BPN}-${PV}.tar.gz file://opkg.conf \ file://0001-opkg_conf-create-opkg.lock-in-run-instead-of-var-run.patch \ file://0002-config.h.in-add-missing-WITH_SHA256-define.patch \ + file://0003-CMakeLists-take-the-default-architecture-from-the-ta.patch \ file://run-ptest \ " -- 2.49.0
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#246961): https://lists.openembedded.org/g/openembedded-core/message/246961 Mute This Topic: https://lists.openembedded.org/mt/121506642/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
