Skip to contentSkip to conversation

fex: force use of bundled fmt to fix build against fmt 12.2.0

PATCH New Khem Raj 1 participant 2 messages Jul 11

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/2 fex: force use of bundled fmt to fix build against fmt 12.2.0

FEX-2607 formats std::byte spans via fmt::join, which its pinned bundled fmt 12.1.0 supports but oe-core's fmt 12.2.0 rejects, breaking do_compile:

fmt/base.h: error: implicit instantiation of undefined template 'fmt::detail::type_is_unformattable_for<fmt::join_view<...std::byte*...>, char>'
ninja: build stopped: subcommand failed.

The recipe already dropped fmt from DEPENDS to build the bundled copy, but FEX only falls back to External/fmt when find_package(fmt) fails. fmt-native is still pulled in as a transitive native dependency, and OE's CMAKE_FIND_ROOT_PATH includes the native sysroot for packages, so find_package(fmt) resolves against recipe-sysroot-native and the target compile picks up the incompatible fmt 12.2.0 headers.

Set CMAKE_DISABLE_FIND_PACKAGE_fmt=ON so find_package(fmt) reports not-found and FEX builds the bundled fmt 12.1.0.

---
 meta-oe/recipes-devtools/fex/fex_2607.bb | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
meta-oe/recipes-devtools/fex/fex_2607.bb +5 -1
index 4737c9fd0e..387fb7e8eb 100644
@@ -34,7 +34,10 @@ SRCREV_range-v3 = "ca1388fb9da8e69314dda222dc7b139ca84e092f"
 
 # fmt is built from the bundled External/fmt submodule rather than the system
 # copy: FEX-2607 formats std::byte spans via fmt::join, which its pinned fmt
-# 12.1.0 supports but oe-core's newer fmt (12.2.0) rejects.
+# 12.1.0 supports but oe-core's newer fmt (12.2.0) rejects. FEX only falls
+# back to the bundled copy when find_package(fmt) fails, so
+# CMAKE_DISABLE_FIND_PACKAGE_fmt is set below to stop it from picking up
+# fmt-native (a transitive native dependency) from the native sysroot.
 DEPENDS = " \
     catch2 \
     libdrm  \
@@ -50,6 +53,7 @@ EXTRA_OECMAKE += " \
 	-DENABLE_CCACHE=OFF \
 	-DENABLE_VIXL_DISASSEMBLER=OFF \
 	-DENABLE_VIXL_SIMULATOR=OFF \
+	-DCMAKE_DISABLE_FIND_PACKAGE_fmt=ON \
 	-DDATA_DIRECTORY=${datadir} \
 	-DQT_HOST_PATH:PATH=${RECIPE_SYSROOT_NATIVE}${prefix_native} \
 "
author
#1 lore raw

PATCH 2/2 uim: fix cross-build segfault by loading native plugins in uim-module-manager

The target build runs uim-module-manager (from uim-native, via PATH) to generate scm/installed-modules.scm. Module registration makes the tool uim_init() and dlopen the uim C plugins found in LIBUIM_PLUGIN_LIB_DIR, which scm/Makefile hardcodes to the target build's uim/.libs. The native uim-module-manager therefore loads target objects (and, transitively, the target libuim) into the native process, which crashes do_compile when the build host ABI differs from the target:

make[1]: *** [Makefile:869: installed-modules.scm] Segmentation fault

seen building for x86-64-v3-poky-linux on an x86-64 host.

Make LIBUIM_PLUGIN_LIB_DIR overridable in scm/Makefile.am and point it at the native plugin directory (${STAGING_LIBDIR_NATIVE}/uim/plugin) for the target build, so the native tool loads compatible native plugins. The generated installed-modules.scm is architecture independent, so the result is unchanged. The native build is unaffected (the patch and override are class-target only).

---
 .../uim/uim/uim-module-manager.patch          | 34 ++++++++++++++-----
 meta-oe/recipes-support/uim/uim_1.9.6.bb      |  7 ++++
 2 files changed, 33 insertions(+), 8 deletions(-)
meta-oe/recipes-support/uim/uim/uim-module-manager.patch +26 -8
index 0e2fb687b6..ea3a959ea7 100644
@@ -1,21 +1,39 @@
-From d61495d3fb039842b82df44184c67eb3c1256136 Mon Sep 17 00:00:00 2001
-From: Bian Naimeng <[email protected]>
-Date: Fri, 26 Jun 2015 12:57:48 +0900
+From: Khem Raj <[email protected]>
+Date: Fri, 10 Jul 2026 00:00:00 +0000
+Subject: [PATCH] uim: run the native uim-module-manager against native plugins
 
----
-Upstream-Status: Pending
+When cross compiling, scm/Makefile runs uim-module-manager to generate
+installed-modules.scm. Use the uim-module-manager from PATH (provided by
+uim-native) instead of the freshly cross-built one, and make its plugin
+search directory (LIBUIM_PLUGIN_LIB_DIR) overridable. Registration makes
+the tool dlopen the uim C plugins; if that points at the target .libs the
+native tool loads target objects and segfaults on a build host whose ABI
+differs from the target (e.g. x86-64 host, x86-64-v3 target). The recipe
+overrides UIM_PLUGIN_LIB_DIR to the native plugin directory.
+
+This extends the original scm/Makefile.am change by Bian Naimeng
+<[email protected]>.
 
- scm/Makefile.am | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
+Upstream-Status: Inappropriate [cross-compile specific]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ scm/Makefile.am | 3 ++-
+ 1 file changed, 3 insertions(+), 2 deletions(-)
 
 --- a/scm/Makefile.am
 +++ b/scm/Makefile.am
-@@ -115,7 +115,7 @@ if EXPAT
+@@ -115,11 +115,12 @@
    module_names += "yahoo-jp"
  endif
 
 -UIM_MODULE_MANAGER = $(top_builddir)/uim/uim-module-manager
++UIM_PLUGIN_LIB_DIR = $(abs_top_builddir)/uim/.libs
 +UIM_MODULE_MANAGER = uim-module-manager
  UIM_MODULE_MANAGER_ENV = \
          LIBUIM_SYSTEM_SCM_FILES=$(abs_top_srcdir)/sigscheme/lib \
          LIBUIM_SCM_FILES=$(abs_srcdir) \
+-        LIBUIM_PLUGIN_LIB_DIR=$(abs_top_builddir)/uim/.libs \
++        LIBUIM_PLUGIN_LIB_DIR=$(UIM_PLUGIN_LIB_DIR) \
+         UIM_DISABLE_NOTIFY=1
+
+ loader.scm: installed-modules.scm
meta-oe/recipes-support/uim/uim_1.9.6.bb +7 -0
index 6e6ed522d8..ac2e1118f4 100644
@@ -43,6 +43,13 @@ EXTRA_OECONF += "--disable-emacs \
 
 CONFIGUREOPTS:remove:class-target = "--disable-silent-rules"
 
+# The target build runs the native uim-module-manager (from uim-native) to
+# generate installed-modules.scm. Registration dlopens the uim C plugins, so
+# point the loader at the native plugin directory; otherwise the native tool
+# loads the target plugins and crashes on hosts whose ABI differs from the
+# target. See uim-module-manager.patch.
+EXTRA_OEMAKE:append:class-target = " UIM_PLUGIN_LIB_DIR=${STAGING_LIBDIR_NATIVE}/uim/plugin"
+
 # https://github.com/uim/uim/issues/44
 PARALLEL_MAKE = ""