Skip to contentSkip to conversation

mutter: Fix build without remote desktop support

PATCH New Khem Raj 1 participant 5 messages Oct 20

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/5 mutter: Fix build without remote desktop support

The clipboard session is always built, as input capture uses it, but the remote selection source it calls into was only built with -Dremote_desktop=true, so libmutter failed to link with the default PACKAGECONFIG:

ld.lld: error: undefined symbol: meta_selection_source_remote_new

Build the remote selection source unconditionally.

AI-Generated: Uses Claude Code

---
 ...ection-source-without-remote-desktop.patch | 42 +++++++++++++++++++
 .../recipes-gnome/mutter/mutter_51.0.bb       |  4 +-
 2 files changed, 45 insertions(+), 1 deletion(-)
 create mode 100644 meta-gnome/recipes-gnome/mutter/files/0002-build-Build-remote-selection-source-without-remote-desktop.patch
meta-gnome/recipes-gnome/mutter/files/0002-build-Build-remote-selection-source-without-remote-desktop.patch new file +42 -0
new file mode 100644
index 0000000000..094270536e
@@ -0,0 +1,42 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sun, 18 Oct 2026 17:50:00 -0700
+Subject: [PATCH] build: Build remote selection source without remote desktop
+
+meta-clipboard-session.c is built unconditionally, as input capture
+uses it, but it calls into meta-selection-source-remote.c, which is only
+built with remote desktop support. Linking libmutter with
+-Dremote_desktop=false fails:
+
+  ld.lld: error: undefined symbol: meta_selection_source_remote_new
+
+The remote selection source has no remote desktop dependencies, so
+build it unconditionally as well.
+
+Upstream-Status: Pending
+AI-Generated: Uses Claude Code
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/meson.build | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/src/meson.build
++++ b/src/meson.build
+@@ -345,6 +345,8 @@
+   'core/meta-selection.c',
+   'core/meta-selection-source.c',
+   'core/meta-selection-source-memory.c',
++  'core/meta-selection-source-remote.c',
++  'core/meta-selection-source-remote.h',
+   'core/meta-session-manager.c',
+   'core/meta-session-state.c',
+   'core/meta-sound-player.c',
+@@ -470,8 +472,6 @@
+     'backends/meta-stream-window.h',
+     'backends/meta-stream.c',
+     'backends/meta-stream.h',
+-    'core/meta-selection-source-remote.c',
+-    'core/meta-selection-source-remote.h',
+   ]
+ endif
+
meta-gnome/recipes-gnome/mutter/mutter_51.0.bb +3 -1
index 66a4666c55..4213e2cc06 100644
@@ -35,7 +35,9 @@ DEPENDS = " \
 
 inherit gnomebase gsettings gobject-introspection gettext features_check
 
-SRC_URI += "file://0001-Dont-use-system-sysprof-dbus-folder.patch"
+SRC_URI += "file://0001-Dont-use-system-sysprof-dbus-folder.patch \
+            file://0002-build-Build-remote-selection-source-without-remote-desktop.patch \
+            "
 SRC_URI[archive.sha256sum] = "5d28f3ae225692428fcafb96500d673f34328b698b86960c9c1460d0b1d983b3"
 
 REQUIRED_DISTRO_FEATURES = "wayland polkit"
author
#1 lore raw

PATCH 2/5 librice: Point bindgen at the target sysroot

rice-c/build.rs runs bindgen without any target flags, so libclang parsed the build host headers in /usr/include, which fails when cross compiling, e.g. for riscv64/musl:

/usr/include/bits/floatn.h:97:9: error: __float128 is not supported on this target

Pass the target arch flags, sysroot and triple via BINDGEN_EXTRA_CLANG_ARGS, as thin-provisioning-tools does.

AI-Generated: Uses Claude Code

---
 meta-oe/recipes-support/librice/librice_0.4.3.bb | 5 +++++
 1 file changed, 5 insertions(+)
meta-oe/recipes-support/librice/librice_0.4.3.bb +5 -0
index 4017b58271..61934acd88 100644
@@ -16,6 +16,11 @@ CARGO_BUILD_FLAGS += " --workspace"
 
 export LIBCLANG_PATH = "${STAGING_LIBDIR_NATIVE}/libclang.so"
 
+# rice-c/build.rs runs bindgen, point libclang at the target sysroot instead
+# of the build host headers in /usr/include
+BINDGEN_EXTRA_CLANG_ARGS = "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} --target=${TARGET_SYS}"
+export BINDGEN_EXTRA_CLANG_ARGS
+
 # rice-c/build.rs builds the internal rice-proto C library in-tree (via
 # "cargo cinstall") and then locates it through system-deps + pkg-config.
 # The generated rice-proto.pc carries an absolute prefix pointing at the
author
#2 lore raw

PATCH 3/5 xdp-tools: Fix embedded BPF objects when linking with lld

In reply to Khem Raj

libxdp turns its BPF programs into linkable objects with a relocatable link of a raw binary input (cc -r -Wl,--format=binary). Because there is no real object among the inputs, lld on riscv64 writes an object with e_flags 0 (soft-float ABI) and a GNU property note with every CFI feature bit set. Linking it then fails with clang:

ld.lld: error: libxdp.a(xdp-dispatcher.embed.o): file has conflicting
properties: GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED and GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_FUNC_SIG
ld.lld: error: libxdp.a(xdp-dispatcher.embed.o): cannot link object
files with different floating-point ABI from Scrt1.o

Build the embed objects from a small .incbin assembly stub instead, so the compiler driver emits them with the correct target ABI.

AI-Generated: Uses Claude Code

---
 ...-BPF-objects-with-.incbin-instead-of.patch | 43 +++++++++++++++++++
 .../xdp-tools/xdp-tools_1.6.3.bb              |  1 +
 2 files changed, 44 insertions(+)
 create mode 100644 meta-oe/recipes-support/xdp-tools/files/0005-lib-libxdp-Embed-BPF-objects-with-.incbin-instead-of.patch
meta-oe/recipes-support/xdp-tools/files/0005-lib-libxdp-Embed-BPF-objects-with-.incbin-instead-of.patch new file +43 -0
new file mode 100644
index 0000000000..1309a84aa1
@@ -0,0 +1,43 @@
+From: Khem Raj <[email protected]>
+Date: Sun, 18 Oct 2026 18:00:00 -0700
+Subject: [PATCH] lib/libxdp: Embed BPF objects with .incbin instead of ld --format=binary
+
+The embedded BPF objects are made with a relocatable link of a raw binary
+input (cc -r -Wl,--format=binary). When the only input is a raw binary,
+the linker has no real object to take target attributes from. With lld on
+riscv64 the result has e_flags 0 (soft-float ABI) and a
+.note.gnu.property where every CFI feature bit is set. Linking it into
+libxdp users then fails:
+
+  ld.lld: error: libxdp.a(xdp-dispatcher.embed.o): file has conflicting
+    properties: GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED and
+    GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_FUNC_SIG
+  ld.lld: error: libxdp.a(xdp-dispatcher.embed.o): cannot link object
+    files with different floating-point ABI from Scrt1.o
+
+Instead, assemble a small stub that pulls in the BPF object with .incbin.
+The compiler driver then emits a normal object for the target ABI. The
+_binary_<name>_start/_end symbol names that libxdp.c uses stay the same.
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ lib/libxdp/Makefile | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/lib/libxdp/Makefile b/lib/libxdp/Makefile
+--- a/lib/libxdp/Makefile
++++ b/lib/libxdp/Makefile
+@@ -134,8 +134,10 @@
+ 	$(QUIET_M4)$(M4) $(DEFINES) $< > $@ || ( ret=$$?; rm -f $@; exit $$ret )
+
+ $(EMBEDDED_XDP_OBJS): %.embed.o: %.o
+-	$(QUIET_CC)$(CC) -r -nostdlib -Wl,-z,noexecstack,--format=binary $(LDFLAGS) -o $@ $<
+-	$(Q)$(OBJCOPY)  --rename-section .data=.rodata,alloc,load,readonly,data,contents $@
++	$(QUIET_CC)SYM=_binary_$$(echo '$<' | sed 's/[^A-Za-z0-9_]/_/g'); \
++	printf '\t.section .rodata,"a"\n\t.balign 8\n\t.globl %s_start\n%s_start:\n\t.incbin "%s"\n\t.globl %s_end\n%s_end:\n' \
++		$$SYM $$SYM '$<' $$SYM $$SYM | \
++	$(CC) -c -x assembler -Wa,--noexecstack -o $@ -
+
+ $(XDP_OBJS): %.o: %.c $(BPF_HEADERS) $(LIBMK)
+ 	$(QUIET_CLANG)$(CLANG) -target $(BPF_TARGET) $(BPF_CFLAGS) -O2 -c -g -o $@ $<
meta-oe/recipes-support/xdp-tools/xdp-tools_1.6.3.bb +1 -0
index bcaa8c91c4..577a7b39d5 100644
@@ -18,6 +18,7 @@ SRC_URI = " \
     file://0002-lib-libxdp-Makefile-use-cp-fRd-to-preserve-symlinks-.patch \
     file://0003-lib-util-avoid-struct-ethhdr-redefinition-on-musl.patch \
     file://0004-xdp-filter-xdp-dump-avoid-struct-ethhdr-redefinitio.patch \
+    file://0005-lib-libxdp-Embed-BPF-objects-with-.incbin-instead-of.patch \
 "
 SRCREV = "8fbad9f0af621a22aa87ff2520b3735915b1f0fd"
 
author
#3 lore raw

PATCH 4/5 dlm: Define __always_inline for musl

In reply to Khem Raj

dlm_controld's rbtree headers were copied from the kernel and use __always_inline. glibc defines it in <sys/cdefs.h>, but musl does not, so the build fails on musl:

./rbtree.h:153:8: error: unknown type name '__always_inline'

Add a patch that provides a fallback definition in linux_helpers.h.

AI-Generated: Uses Claude Code

---
 ...ine-__always_inline-when-libc-does-n.patch | 34 +++++++++++++++++++
 .../recipes-extended/dlm/dlm_4.3.0.bb         |  1 +
 2 files changed, 35 insertions(+)
 create mode 100644 meta-networking/recipes-extended/dlm/dlm/0002-dlm_controld-Define-__always_inline-when-libc-does-n.patch
meta-networking/recipes-extended/dlm/dlm/0002-dlm_controld-Define-__always_inline-when-libc-does-n.patch new file +34 -0
new file mode 100644
index 0000000000..bddfbf9453
@@ -0,0 +1,34 @@
+From: Khem Raj <[email protected]>
+Date: Sun, 18 Oct 2026 18:30:00 -0700
+Subject: [PATCH] dlm_controld: Define __always_inline when libc does not
+
+rbtree.h and rbtree_augmented.h were copied from the kernel and use
+__always_inline. glibc defines it in <sys/cdefs.h>, but musl does not,
+so the build fails on musl:
+
+  ./rbtree.h:153:8: error: unknown type name '__always_inline'
+
+Add a fallback definition to linux_helpers.h, which rbtree.h already
+includes.
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ dlm_controld/linux_helpers.h | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/dlm_controld/linux_helpers.h b/dlm_controld/linux_helpers.h
+--- a/dlm_controld/linux_helpers.h
++++ b/dlm_controld/linux_helpers.h
+@@ -3,6 +3,11 @@
+ #ifndef __DLM_LINUX_HELPERS__
+ #define __DLM_LINUX_HELPERS__
+
++/* glibc provides this in <sys/cdefs.h>, but musl does not */
++#ifndef __always_inline
++#define __always_inline inline __attribute__((__always_inline__))
++#endif
++
+ /*
+  * static_assert - check integer constant expression at build time
+  *
meta-networking/recipes-extended/dlm/dlm_4.3.0.bb +1 -0
index 1c09a35d0a..fab31c1b99 100644
@@ -8,6 +8,7 @@ REQUIRED_DISTRO_FEATURES = "systemd"
 SRC_URI = "https://pagure.io/dlm/archive/dlm-${PV}/dlm-dlm-${PV}.tar.gz \
            file://0001-Include-sys-sysmacros.h-for-major-minor-macros-in-gl.patch \
            file://0001-make-Replace-cp-a-with-mode-preserving-options.patch \
+           file://0002-dlm_controld-Define-__always_inline-when-libc-does-n.patch \
            "
 
 SRC_URI[sha256sum] = "8dc23b97390236032a2fe19068c7dad23f82fb624732c9bff6898b6996c9b700"
author
#4 lore raw

PATCH 5/5 tiobench: Allow large file support with musl

In reply to Khem Raj

USE_LARGEFILES requires _LFS64_LARGEFILE, which musl does not define because its off_t is always 64-bit, so the build fails on musl:

./constants.h:36:2: error: no large file support available, remove -DLARGEFILES from makefile

Add a patch that only requires a 64-bit off_t in that case. It also replaces the %L length modifier on integer conversions with the standard %ll, which musl's printf requires.

AI-Generated: Uses Claude Code

---
 ...1-Allow-large-file-support-with-musl.patch | 90 +++++++++++++++++++
 .../tiobench/tiobench_0.4.2+git.bb            |  4 +-
 2 files changed, 93 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-benchmark/tiobench/tiobench/0001-Allow-large-file-support-with-musl.patch
meta-oe/recipes-benchmark/tiobench/tiobench/0001-Allow-large-file-support-with-musl.patch new file +90 -0
new file mode 100644
index 0000000000..632553c066
@@ -0,0 +1,90 @@
+From: Khem Raj <[email protected]>
+Date: Sun, 18 Oct 2026 19:00:00 -0700
+Subject: [PATCH] Allow large file support with musl
+
+USE_LARGEFILES requires the libc to define _LFS64_LARGEFILE and errors
+out otherwise. musl does not define it: its off_t is always 64-bit and
+lseek64(), mmap64() and friends are aliases of the plain interfaces.
+So the build fails on musl:
+
+  ./constants.h:36:2: error: no large file support available, remove -DLARGEFILES from makefile
+
+When _LFS64_LARGEFILE is missing, only require a 64-bit off_t.
+
+Also replace the %L length modifier on integer conversions with the
+standard %ll. %L is only defined for long double, and musl's printf
+rejects it with integer conversions.
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ constants.h       | 9 +++++++--
+ test_largefiles.c | 6 +++---
+ tiotest.c         | 2 +-
+ 3 files changed, 11 insertions(+), 6 deletions(-)
+
+--- a/constants.h
++++ b/constants.h
+@@ -33,7 +33,12 @@
+
+ #ifdef USE_LARGEFILES
+ #ifndef _LFS64_LARGEFILE
+-#error no large file support available, remove -DLARGEFILES from makefile
++/*
++ * musl does not define _LFS64_LARGEFILE: its off_t is always 64-bit and
++ * the *64 interfaces are plain aliases, so only require a 64-bit off_t.
++ */
++_Static_assert(sizeof(off_t) >= 8,
++	"no large file support available, remove -DLARGEFILES from makefile");
+ #endif
+ #endif
+
+@@ -83,7 +88,7 @@
+ #define TIO_ftruncate  ftruncate64
+ #define TIO_pread      pread64
+ #define TIO_pwrite     pwrite64
+-#define OFFSET_FORMAT  "0x%Lx"
++#define OFFSET_FORMAT  "0x%llx"
+ #else
+ typedef off_t          TIO_off_t;
+ #define TIO_lseek      lseek
+--- a/tiotest.c
++++ b/tiotest.c
+@@ -1411,7 +1411,7 @@
+
+ 			if(crc != d->bufferCrc)
+ 			{
+-				fprintf(stderr, "Thread(%lu) consistency check failed at offset %Lu\n", d->myNumber, (long long unsigned int)offset);
++				fprintf(stderr, "Thread(%lu) consistency check failed at offset %llu\n", d->myNumber, (long long unsigned int)offset);
+ 				return -1;
+ 			}
+ 		}
+--- a/test_largefiles.c
++++ b/test_largefiles.c
+@@ -57,7 +57,7 @@
+         exit(1);
+     }
+
+-    printf( xstr(TIO_ftruncate) "()'ing large test file to size %Lx\n", LARGEFILE_SIZE);
++    printf( xstr(TIO_ftruncate) "()'ing large test file to size %llx\n", LARGEFILE_SIZE);
+     rc = TIO_ftruncate(fd, LARGEFILE_SIZE); /* pre-allocate space */
+     if(rc != 0)
+     {
+@@ -67,7 +67,7 @@
+
+     for(offset = (TIO_off_t)0; offset + CHUNK_SIZE <= LARGEFILE_SIZE; offset += CHUNK_SIZE) {
+
+-        printf(xstr(TIO_lseek) "()ing to offset %Lx\n", offset);
++        printf(xstr(TIO_lseek) "()ing to offset %llx\n", offset);
+         offset_ret = TIO_lseek(fd, offset, SEEK_SET);
+         if (offset_ret != offset) {
+             perror("Error " xstr(TIO_lseek) "()ing");
+@@ -105,7 +105,7 @@
+         }
+         data = 0;
+
+-        printf(xstr(TIO_mmap) "()ing chunk of size %Lx at offset %Lx\n", CHUNK_SIZE, offset);
++        printf(xstr(TIO_mmap) "()ing chunk of size %llx at offset %llx\n", CHUNK_SIZE, offset);
+         file_loc = TIO_mmap((caddr_t )0, CHUNK_SIZE,
+                  PROT_READ | PROT_WRITE, MAP_SHARED, fd, (TIO_off_t)offset);
+         if (file_loc == MAP_FAILED) {
meta-oe/recipes-benchmark/tiobench/tiobench_0.4.2+git.bb +3 -1
index b42982686c..c773a8cc53 100644
@@ -3,7 +3,9 @@ HOMEPAGE = "https://github.com/mkuoppal/tiobench"
 LICENSE = "GPL-2.0-only"
 LIC_FILES_CHKSUM = "file://COPYING;md5=c93c0550bd3173f4504b2cbd8991e50b"
 
-SRC_URI = "git://github.com/mkuoppal/tiobench.git;protocol=https;branch=master"
+SRC_URI = "git://github.com/mkuoppal/tiobench.git;protocol=https;branch=master \
+           file://0001-Allow-large-file-support-with-musl.patch \
+           "
 
 SRCREV = "11c965c8c0f37927423fb4ea590df6c093cf2f1e"