Skip to contentSkip to conversation

networkmanager: Fix build with musl

PATCH New Khem Raj 1 participant 2 messages Feb 19, 2023

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/2 networkmanager: Fix build with musl

__assert_fail signature is assuming glibc which is fine for glibc systems but we have to consider musl case too.

---
 ...just-signature-of-_nm_assert_fail_in.patch | 37 +++++++++++++++++++
 .../networkmanager/networkmanager_1.42.0.bb   |  2 +
 2 files changed, 39 insertions(+)
 create mode 100644 meta-networking/recipes-connectivity/networkmanager/networkmanager/0001-libnm-std-aux-Adjust-signature-of-_nm_assert_fail_in.patch
meta-networking/recipes-connectivity/networkmanager/networkmanager/0001-libnm-std-aux-Adjust-signature-of-_nm_assert_fail_in.patch new file +37 -0
new file mode 100644
index 0000000000..6640bce173
@@ -0,0 +1,37 @@
+From 8c8b13768d22f39edfce38e123b740c43d7e31c4 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sat, 18 Feb 2023 17:29:10 -0800
+Subject: [PATCH] libnm-std-aux: Adjust signature of _nm_assert_fail_internal
+
+the LSB states __assert_fail is:
+const char*, const char*, unsigned int, const char*
+https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/baselib---assert-fail-1.html
+
+musl uses a signed int instead. however, this is ok:
+https://www.openwall.com/lists/musl/2019/03/04/6
+
+nevertheless, since the application redefines __assert_fail, we have to make
+the types match. (not upstreamable as the opposite breaks glibc)
+
+Upstream-Status: Inappropriate [musl specific]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/libnm-std-aux/nm-std-aux.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/libnm-std-aux/nm-std-aux.h b/src/libnm-std-aux/nm-std-aux.h
+index e556aa4..0756a7c 100644
+--- a/src/libnm-std-aux/nm-std-aux.h
++++ b/src/libnm-std-aux/nm-std-aux.h
+@@ -230,7 +230,7 @@ typedef uint64_t _nm_bitwise nm_be64_t;
+ _nm_noreturn static inline void
+ _nm_assert_fail_internal(const char  *assertion,
+                          const char  *file,
+-                         unsigned int line,
++                         int line,
+                          const char  *function)
+ {
+     __assert_fail("<dropped>", file, line, "<unknown-fcn>");
+-- 
+2.39.2
+
meta-networking/recipes-connectivity/networkmanager/networkmanager_1.42.0.bb +2 -0
index 856afd7bc8..dabf9a1d36 100644
@@ -30,6 +30,8 @@ SRC_URI = " \
     file://enable-dhcpcd.conf \
     file://enable-iwd.conf \
 "
+SRC_URI:append:libc-musl = " file://0001-libnm-std-aux-Adjust-signature-of-_nm_assert_fail_in.patch"
+
 SRC_URI[sha256sum] = "2f6756d507bb6b46716594b67e6fe7491891e1b5b167bbafc5157dfa7753d5b4"
 
 S = "${WORKDIR}/NetworkManager-${PV}"
Signature · 1 line
2.39.2
author
#1 lore raw

PATCH 2/2 liburing: Update to latest tip of tree

Add a patch to fix build on musl

---
 ...-test-Remove-unused-linux-errqueue.h.patch | 47 +++++++++++++++++++
 .../recipes-support/liburing/liburing_2.3.bb  |  6 ++-
 2 files changed, 51 insertions(+), 2 deletions(-)
 create mode 100644 meta-oe/recipes-support/liburing/liburing/0001-examples-test-Remove-unused-linux-errqueue.h.patch
meta-oe/recipes-support/liburing/liburing/0001-examples-test-Remove-unused-linux-errqueue.h.patch new file +47 -0
new file mode 100644
index 0000000000..21aaf8d991
@@ -0,0 +1,47 @@
+From 0fbcc44fe1fb2dc6807660b2cff1c2995add095b Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sat, 18 Feb 2023 18:01:22 -0800
+Subject: [PATCH] examples,test: Remove unused linux/errqueue.h
+
+This header is not needed therefore remove it, this cleanup also helps
+compiling on musl/clang
+
+/usr/include/linux/errqueue.h:57:20: error: array has incomplete element typ
+e 'struct timespec'
+        struct timespec ts[3];
+                          ^
+
+Upstream-Status: Submitted [https://github.com/axboe/liburing/pull/798]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ examples/send-zerocopy.c | 1 -
+ test/send-zerocopy.c     | 1 -
+ 2 files changed, 2 deletions(-)
+
+diff --git a/examples/send-zerocopy.c b/examples/send-zerocopy.c
+index 6092af9..cf1fa8b 100644
+--- a/examples/send-zerocopy.c
++++ b/examples/send-zerocopy.c
+@@ -13,7 +13,6 @@
+ #include <string.h>
+ 
+ #include <arpa/inet.h>
+-#include <linux/errqueue.h>
+ #include <linux/if_packet.h>
+ #include <linux/ipv6.h>
+ #include <linux/socket.h>
+diff --git a/test/send-zerocopy.c b/test/send-zerocopy.c
+index 86a31cd..5d578c6 100644
+--- a/test/send-zerocopy.c
++++ b/test/send-zerocopy.c
+@@ -11,7 +11,6 @@
+ #include <string.h>
+ 
+ #include <arpa/inet.h>
+-#include <linux/errqueue.h>
+ #include <linux/if_packet.h>
+ #include <linux/ipv6.h>
+ #include <linux/socket.h>
+-- 
+2.39.2
+
meta-oe/recipes-support/liburing/liburing_2.3.bb +4 -2
index b3da4d5e0e..ba9b7480ce 100644
@@ -9,11 +9,13 @@ SECTION = "libs"
 LICENSE = "LGPL-2.1-only | MIT"
 LIC_FILES_CHKSUM = "file://README;beginline=41;endline=44;md5=2b0e9926530c269f5ae95560370195af"
 
-SRC_URI = "git://github.com/axboe/liburing.git;branch=master;protocol=https"
+SRC_URI = "git://github.com/axboe/liburing.git;branch=master;protocol=https \
+           file://0001-examples-test-Remove-unused-linux-errqueue.h.patch"
 SRC_URI:append:libc-musl:riscv64 = " file://0001-do-not-build-examples.patch "
 SRC_URI:append:libc-musl:riscv32 = " file://0001-do-not-build-examples.patch "
-SRCREV = "4915f2af869876d892a1f591ee2c21be21c6fc5c"
+SRCREV = "f5cac78e621ab452d3035902085f66d2bf73243b"
 
+PV .= "+2.4+git${SRCPV}"
 S = "${WORKDIR}/git"
 
 DEPENDS:append:libc-musl = " libucontext"
Signature · 1 line
2.39.2