systemd: fix build systemd-resolved with musl
PATCH 1/1 systemd: fix build systemd-resolved with musl
From: Nicola Lunghi <[email protected]>
systemd-resolved build was broken with musl because musl was missing the nss.h header and some symbol (NETDB_INTERNAL and NETDB_SUCCESS)
Add a patch to define those symbol to fix the build
Signed-off-by Nicola Lunghi <[email protected]>
--- ...systemd-resolved-fix-build-with-musl.patch | 67 +++++++++++++++++++ meta/recipes-core/systemd/systemd_237.bb | 2 +- 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-core/systemd/systemd/0037-systemd-resolved-fix-build-with-musl.patch
meta/recipes-core/systemd/systemd/0037-systemd-resolved-fix-build-with-musl.patch new file +67 -0
@@ -0,0 +1,67 @@ +From 7ebcea5054d11f28c9a6601c6613bcef741df576 Mon Sep 17 00:00:00 2001 +From: Nicola Lunghi <[email protected]> +Date: Mon, 16 Jul 2018 17:32:55 +0000 +Subject: [PATCH] systemd-resolve: fix build with musl + +musl doesn't provide nss.h and the symbol +NETDB_INTERNAL and NETDB_SUCCESS. +define those symbol to permit compilation of systemd-resolved + +Signed-off-by: Nicola Lunghi <[email protected]> +--- + src/basic/nss-util.h | 19 +++++++++++++++++++ + src/nss-resolve/nss-resolve.c | 7 ++++++- + 2 files changed, 25 insertions(+), 1 deletion(-) + +diff --git a/src/basic/nss-util.h b/src/basic/nss-util.h +index 4fc676395..111834d62 100644 +--- a/src/basic/nss-util.h ++++ b/src/basic/nss-util.h +@@ -22,7 +22,26 @@ + + #include <grp.h> + #include <netdb.h> ++#ifdef __GLIBC__ + #include <nss.h> ++#else ++#include <stdint.h> ++enum nss_status { ++ NSS_STATUS_TRYAGAIN = -2, ++ NSS_STATUS_UNAVAIL, ++ NSS_STATUS_NOTFOUND, ++ NSS_STATUS_SUCCESS, ++ NSS_STATUS_RETURN ++}; ++/* Data structure used for the 'gethostbyname4_r' function. */ ++struct gaih_addrtuple { ++ struct gaih_addrtuple *next; ++ char *name; ++ int family; ++ uint32_t addr[4]; ++ uint32_t scopeid; ++}; ++#endif + #include <pwd.h> + #include <resolv.h> + +diff --git a/src/nss-resolve/nss-resolve.c b/src/nss-resolve/nss-resolve.c +index fe6ce4cbb..67ce1d9ea 100644 +--- a/src/nss-resolve/nss-resolve.c ++++ b/src/nss-resolve/nss-resolve.c +@@ -20,7 +20,12 @@ + + #include <errno.h> + #include <netdb.h> +-#include <nss.h> ++#ifndef NETDB_INTERNAL ++#define NETDB_INTERNAL (-1) ++#endif ++#ifndef NETDB_SUCCESS ++#define NETDB_SUCCESS (0) ++#endif + #include <stdlib.h> + #include <string.h> + +-- +2.17.1 +
meta/recipes-core/systemd/systemd_237.bb +1 -1
@@ -55,6 +55,7 @@ SRC_URI += "file://touchscreen.rules \ file://0034-Fix-format-truncation-compile-failure-by-typecasting.patch \ file://0035-Define-glibc-compatible-basename-for-non-glibc-syste.patch \ file://0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch \ + file://0037-systemd-resolved-fix-build-with-musl.patch \ " SRC_URI_append_qemuall = " file://0001-core-device.c-Change-the-default-device-timeout-to-2.patch"
@@ -101,7 +102,6 @@ PACKAGECONFIG_remove_libc-musl = " \ localed \ myhostname \ nss \ - resolved \ selinux \ smack \ sysusers \
Signature · 1 line
2.17.1