git: 0e60f88992a0 - 2026Q1 - misc/onnxruntime: fix build on armv7 and aarch64

From: Robert Clausecker <fuz_at_FreeBSD.org>
Date: Tue, 24 Mar 2026 19:18:47 UTC
The branch 2026Q1 has been updated by fuz:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0e60f88992a07f0585acbd59179f94b0c2d273b2

commit 0e60f88992a07f0585acbd59179f94b0c2d273b2
Author:     Robert Clausecker <fuz@FreeBSD.org>
AuthorDate: 2026-03-21 09:19:05 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2026-03-24 19:18:14 +0000

    misc/onnxruntime: fix build on armv7 and aarch64
    
    A linux-only structure member of the cpuinfo.h API is used to determine
    CPU affinity on some architectures.  Use the fallback on FreeBSD, as on
    platforms that do not support cpuinfo.h at all.
    
    See also:       https://github.com/microsoft/onnxruntime/issues/23181
    Approved by:    portmgr (build fix blanket)
    MFH:            2026Q1
    
    (cherry picked from commit d8dc35987b95f29185aa53aeb9ddd72020e6b5ff)
---
 misc/onnxruntime/Makefile                                        | 2 --
 .../files/patch-onnxruntime_core_platform_posix_env.cc           | 9 +++++++++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/misc/onnxruntime/Makefile b/misc/onnxruntime/Makefile
index f757427a10ea..4cb56ee922f2 100644
--- a/misc/onnxruntime/Makefile
+++ b/misc/onnxruntime/Makefile
@@ -12,8 +12,6 @@ WWW=		https://onnxruntime.ai/ \
 LICENSE=	MIT
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
-BROKEN_armv7=	compilation fails: error: no member named 'linux_id' in 'cpuinfo_processor', see https://github.com/microsoft/onnxruntime/issues/23181
-BROKEN_aarch64=	compilation fails: error: no member named 'linux_id' in 'cpuinfo_processor', see https://github.com/microsoft/onnxruntime/issues/23181
 BROKEN_i386=	compilation fails: error: requested alignment is less than minimum alignment of 8 for type 'google::protobuf::internal::ThreadSafeArena::CacheAlignedLifecycleIdGenerator'
 
 BUILD_DEPENDS=	gpatch:devel/patch
diff --git a/misc/onnxruntime/files/patch-onnxruntime_core_platform_posix_env.cc b/misc/onnxruntime/files/patch-onnxruntime_core_platform_posix_env.cc
index d05c13253a89..37a10d7fc905 100644
--- a/misc/onnxruntime/files/patch-onnxruntime_core_platform_posix_env.cc
+++ b/misc/onnxruntime/files/patch-onnxruntime_core_platform_posix_env.cc
@@ -24,3 +24,12 @@
                                << ", index: " << p->index
                                << ", mask: " << *p->affinity
                                << ", error code: " << err_no << " error msg: " << err_msg
+@@ -275,7 +276,7 @@ class PosixEnv : public Env {
+ 
+   std::vector<LogicalProcessors> GetDefaultThreadAffinities() const override {
+     std::vector<LogicalProcessors> ret;
+-#ifdef ORT_USE_CPUINFO
++#if defined(ORT_USE_CPUINFO) && defined(__linux__)
+     if (cpuinfo_available_) {
+       auto num_phys_cores = cpuinfo_get_cores_count();
+       ret.reserve(num_phys_cores);