Skip to contentSkip to conversation

uftrace: Fix build failure on x86

PATCH New Khem Raj 1 participant 1 message Jul 16, 2025

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 uftrace: Fix build failure on x86

Do not inherit autotools bbclass, the configure script is hand-written and not a autoconf generated one.

Backport a fix to build on 32bit x86
Fixes

| i686-yoe-linux-ld.lld: error: undefined symbol: uftrace_arch_ops
| >>> referenced by symbol.c:586 (utils/symbol.c:586)
| >>>               /mnt/b/yoe/master/build/tmp/work/core2-32-yoe-linux/uftrace/0.18/sources/uftrace-0.18/libmcount/symbol.op:(load_elf_dynsymtab)
---
 ...0001-build-Fix-a-build-error-on-i386.patch | 26 +++++++++++++++++++
 .../recipes-devtools/uftrace/uftrace_0.18.bb  | 23 +++++++++++-----
 2 files changed, 43 insertions(+), 6 deletions(-)
 create mode 100644 meta-oe/recipes-devtools/uftrace/uftrace/0001-build-Fix-a-build-error-on-i386.patch
meta-oe/recipes-devtools/uftrace/uftrace/0001-build-Fix-a-build-error-on-i386.patch new file +26 -0
new file mode 100644
index 0000000000..c6bc8473b9
@@ -0,0 +1,26 @@
+From ea53a7f42c1c5da688ef79e53731dcc3810a1256 Mon Sep 17 00:00:00 2001
+From: Namhyung Kim <[email protected]>
+Date: Sun, 6 Jul 2025 15:13:30 -0700
+Subject: [PATCH] build: Fix a build error on i386
+
+It happened to have common.S as well as common.c, so it picked the .S
+before .c for the uftrace-arch.a.  And it caused undefined symbols.
+
+  /usr/bin/ld: libmcount/symbol.op: in function `load_dynsymtab':
+  utils/symbol.c:722:(.text+0x2b19): undefined reference to `uftrace_arch_ops'
+  libmcount/symbol.op: in function `load_elf_dynsymtab':
+  utils/symbol.c:586:(.text+0x184a): undefined reference to `uftrace_arch_ops'
+
+Fixed: #2010
+
+Upstream-Status: Backport [https://github.com/namhyung/uftrace/commit/ea53a7f42c1c5da688ef79e53731dcc3810a1256]
+Signed-off-by: Namhyung Kim <[email protected]>
+---
+ arch/i386/{common.S => thunk.S} | 0
+ 1 file changed, 0 insertions(+), 0 deletions(-)
+ rename arch/i386/{common.S => thunk.S} (100%)
+
+diff --git a/arch/i386/common.S b/arch/i386/thunk.S
+similarity index 100%
+rename from arch/i386/common.S
+rename to arch/i386/thunk.S
meta-oe/recipes-devtools/uftrace/uftrace_0.18.bb +17 -6
index f82dc17071..7ba2dcadc9 100644
@@ -8,11 +8,11 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
 DEPENDS = "elfutils"
 DEPENDS:append:libc-musl = " argp-standalone"
 
-inherit autotools
-
 SRCREV = "8ccd4f627569b0af122c8d1df98dc6813ab97a40"
 SRC_URI = "git://github.com/namhyung/${BPN};branch=master;protocol=https;tag=v${PV} \
-           file://0001-include-libgen.h-for-basename.patch"
+           file://0001-include-libgen.h-for-basename.patch \
+           file://0001-build-Fix-a-build-error-on-i386.patch \
+          "
 
 LDFLAGS:append:libc-musl = " -largp"
 
@@ -26,11 +26,22 @@ def set_target_arch(d):
     else:
         return arch
 
-EXTRA_UFTRACE_OECONF = "ARCH=${@set_target_arch(d)} \
-                        with_elfutils=/use/libelf/from/sysroot"
 
 do_configure() {
-    ${S}/configure ${EXTRA_UFTRACE_OECONF}
+    ${S}/configure --prefix=${prefix} \
+    --objdir=${B} \
+    --cflags='${CFLAGS}' \
+    --ldflags='${LDFLAGS}' \
+    --arch='${@set_target_arch(d)}' \
+    --with-elfutils=${STAGING_EXECPREFIXDIR}
+}
+
+do_compile() {
+    oe_runmake V=1
+}
+
+do_install() {
+    oe_runmake DESTDIR=${D}
 }
 
 FILES_SOLIBSDEV = ""