libdex: Link with libucontext on musl
PATCH 1/4 libdex: Link with libucontext on musl
Fixes errors like below
x86_64-yoe-linux-musl-ld.lld: error: undefined symbol: getcontext
Signed-off-by Khem Raj <[email protected]>
--- meta-gnome/recipes-gnome/libdex/libdex_0.8.1.bb | 3 +++ 1 file changed, 3 insertions(+)
meta-gnome/recipes-gnome/libdex/libdex_0.8.1.bb +3 -0
@@ -7,6 +7,9 @@ inherit features_check gnomebase upstream-version-is-even gobject-introspection DEPENDS += " \ glib-2.0 \ " +DEPENDS:append:libc-musl = " libucontext" + +LDFLAGS:append:libc-musl = " -lucontext" SRC_URI[archive.sha256sum] = "955475ad3e43aabd6f6f70435264b5ee77bd265bd95545211fee026b08d378a0"
PATCH 2/4 taisei: Fix build with musl
This patch fixed issue on glibc but regressed on musl
Signed-off-by Khem Raj <[email protected]>
--- ...armful-Use-overloadable-func-attribu.patch | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-)
meta-oe/dynamic-layers/multimedia-layer/recipes-graphics/taisei/taisei/0001-util-consideredharmful-Use-overloadable-func-attribu.patch +23 -5
@@ -20,21 +20,39 @@ Signed-off-by: Khem Raj <[email protected]> src/util/consideredharmful.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -diff --git a/src/util/consideredharmful.h b/src/util/consideredharmful.h -index 3fe1f047..c6771956 100644 --- a/src/util/consideredharmful.h +++ b/src/util/consideredharmful.h -@@ -30,11 +30,11 @@ FILE* fopen(); +@@ -8,6 +8,7 @@ + + #pragma once + #include "taisei.h" ++#include "util/compat.h" + + #include <stdio.h> + +@@ -24,17 +25,23 @@ PRAGMA(GCC diagnostic ignored "-Wstrict- + // clang generates lots of these warnings with _FORTIFY_SOURCE + PRAGMA(GCC diagnostic ignored "-Wignored-attributes") + ++#ifdef __GLIBC__ ++#define OVERLOADABLE __attribute__((overloadable)) ++#else ++#define OVERLOADABLE ++#endif ++ + #undef fopen + attr_deprecated("Use vfs_open or SDL_RWFromFile instead") + FILE* fopen(); #undef strncat attr_deprecated("This function likely doesn't do what you expect, use strlcat") -char* strncat(); -+char* __attribute__((overloadable)) strncat(); ++char* OVERLOADABLE strncat(); #undef strncpy attr_deprecated("This function likely doesn't do what you expect, use strlcpy") -char* strncpy(); -+char* __attribute__((overloadable)) strncpy(); ++char* OVERLOADABLE strncpy(); #undef errx attr_deprecated("Use log_fatal instead")
PATCH 3/4 canopenterm: Fix build with musl
In reply to Khem RajSigned-off-by Khem Raj <[email protected]>
--- ...-initialize-msghdr-in-a-portable-way.patch | 42 +++++++++++++++++++ .../canopenterm/canopenterm_1.0.8.bb | 4 +- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 meta-oe/recipes-extended/canopenterm/canopenterm/0001-can_linux-initialize-msghdr-in-a-portable-way.patch
meta-oe/recipes-extended/canopenterm/canopenterm/0001-can_linux-initialize-msghdr-in-a-portable-way.patch new file +42 -0
@@ -0,0 +1,42 @@ +From 464ed82087b0514694ab69e2808e859cb6f13833 Mon Sep 17 00:00:00 2001 +From: Khem Raj <[email protected]> +Date: Fri, 22 Nov 2024 10:35:12 -0800 +Subject: [PATCH] can_linux: initialize msghdr in a portable way + +musl has padding bytes inside the msghdr struct which means initializing +full structure will cause wrong assignments, doing partial assignment is +more portable and assign the elements after that + +Fixes +src/core/can_linux.c:362:71: error: incompatible pointer to integer conversion initializing 'int' with an expression of type 'void *' [-Wint-conversion] + | struct msghdr msg = { &sa, sizeof(sa), &iov, 1, NULL, 0, 0 }; + | ^~~~ + +Upstream-Status: Submitted [https://github.com/CANopenTerm/CANopenTerm/pull/70] +Signed-off-by: Khem Raj <[email protected]> +--- + src/core/can_linux.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/src/core/can_linux.c b/src/core/can_linux.c +index d8824be..b4e7907 100644 +--- a/src/core/can_linux.c ++++ b/src/core/can_linux.c +@@ -359,11 +359,16 @@ static char** get_can_interfaces(int* count) + int fd; + char buf[BUFFER_SIZE] = { 0 }; + struct iovec iov = { buf, sizeof(buf) }; +- struct msghdr msg = { &sa, sizeof(sa), &iov, 1, NULL, 0, 0 }; ++ struct msghdr msg = { 0 }; + int len; + int max_interfaces = 10; + int can_count = 0; + char** can_interfaces = (char**)os_calloc(max_interfaces * sizeof(char*), sizeof(char)); ++ ++ msg.msg_name = &sa; ++ msg.msg_namelen = sizeof(sa); ++ msg.msg_iov = &iov; ++ msg.msg_iovlen = 1; + + struct + {
meta-oe/recipes-extended/canopenterm/canopenterm_1.0.8.bb +3 -1
@@ -15,7 +15,9 @@ LIC_FILES_CHKSUM = "file://LICENSE.md;md5=10e84ea70e8c3a1fbc462f5424806474" DEPENDS = "libinih libsdl2 lua libsocketcan pocketpy" -SRC_URI = "git://github.com/CANopenTerm/CANopenTerm.git;protocol=https;branch=main" +SRC_URI = "git://github.com/CANopenTerm/CANopenTerm.git;protocol=https;branch=main \ + file://0001-can_linux-initialize-msghdr-in-a-portable-way.patch \ + " SRCREV = "5bc04e09351f68e889381e1912b0445c4f18ee32" S = "${WORKDIR}/git"
PATCH 4/4 keepalived: Backport fix to build with musl
In reply to Khem RajSigned-off-by Khem Raj <[email protected]>
--- ...clude-linux-if_ether.h-if-not-needed.patch | 34 +++++++++++++++++++ .../keepalived/keepalived_2.3.2.bb | 1 + 2 files changed, 35 insertions(+) create mode 100644 meta-networking/recipes-daemons/keepalived/keepalived/0001-vrrp-Don-t-include-linux-if_ether.h-if-not-needed.patch
meta-networking/recipes-daemons/keepalived/keepalived/0001-vrrp-Don-t-include-linux-if_ether.h-if-not-needed.patch new file +34 -0
@@ -0,0 +1,34 @@ +From f129c588f7c8a66e595d8ae96a43d585018e79cd Mon Sep 17 00:00:00 2001 +From: Quentin Armitage <[email protected]> +Date: Thu, 7 Nov 2024 11:09:43 +0000 +Subject: [PATCH] vrrp: Don't include <linux/if_ether.h> if not needed + +The musl headers do not allow including both <linux/if_ether.h> and +<net/ethernet.h> since they both define struct ethhdr. + +It is likely that we do not need to include <linux/if_ether.h> at all +since with both glibc and musl including <net/ethernet.h> is sufficient, +but removing <linux/if_ether.h> is for another day. + +Upstream-Status: Backport [https://github.com/acassen/keepalived/commit/f129c588f7c8a66e595d8ae96a43d585018e79cd] +Signed-off-by: Quentin Armitage <[email protected]> +--- + keepalived/vrrp/vrrp.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/keepalived/vrrp/vrrp.c b/keepalived/vrrp/vrrp.c +index 96b2c4c8..4b06e387 100644 +--- a/keepalived/vrrp/vrrp.c ++++ b/keepalived/vrrp/vrrp.c +@@ -40,8 +40,10 @@ + #include <netinet/ip6.h> + #include <stdint.h> + #include <net/if_arp.h> +-#include <linux/if_ether.h> + #include <net/ethernet.h> ++#if !defined ETH_HLEN || !defined ETH_ZLEN ++#include <linux/if_ether.h> /* This may not be needed at all - try removing and see if any issues raised */ ++#endif + #ifdef _NETWORK_TIMESTAMP_ + #include <linux/net_tstamp.h> + #endif
meta-networking/recipes-daemons/keepalived/keepalived_2.3.2.bb +1 -0
@@ -12,6 +12,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" SRC_URI = "http://www.keepalived.org/software/${BP}.tar.gz \ file://0001-configure.ac-Do-not-emit-compiler-flags-into-object-.patch \ + file://0001-vrrp-Don-t-include-linux-if_ether.h-if-not-needed.patch \ " SRC_URI[sha256sum] = "77f4a22e5a23fa8e49b8916acdfb584c864e72905a2f1de2a7f62ed40a896160" UPSTREAM_CHECK_URI = "https://github.com/acassen/keepalived/releases"