Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Nicola Lunghi <nick83ola@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Nicola Lunghi <nicola.lunghi@jci.com>
Subject: [meta-oe][poky][PATCH] systemd: fix build systemd-resolved with musl
Date: Tue, 17 Jul 2018 11:48:42 +0100	[thread overview]
Message-ID: <20180717104842.10111-1-nick83ola@gmail.com> (raw)

From: Nicola Lunghi <nicola.lunghi@jci.com>

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 <nicola.lunghi@jci.com>
---
 ...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

diff --git a/meta/recipes-core/systemd/systemd/0037-systemd-resolved-fix-build-with-musl.patch b/meta/recipes-core/systemd/systemd/0037-systemd-resolved-fix-build-with-musl.patch
new file mode 100644
index 0000000000..dc64214e18
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0037-systemd-resolved-fix-build-with-musl.patch
@@ -0,0 +1,67 @@
+From 7ebcea5054d11f28c9a6601c6613bcef741df576 Mon Sep 17 00:00:00 2001
+From: Nicola Lunghi <nicola.lunghi@jci.com>
+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 <nicola.lunghi@jci.com>
+---
+ 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
+
diff --git a/meta/recipes-core/systemd/systemd_237.bb b/meta/recipes-core/systemd/systemd_237.bb
index bd6dcef637..0a832733fc 100644
--- a/meta/recipes-core/systemd/systemd_237.bb
+++ b/meta/recipes-core/systemd/systemd_237.bb
@@ -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 \
-- 
2.17.1



                 reply	other threads:[~2018-07-17 10:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180717104842.10111-1-nick83ola@gmail.com \
    --to=nick83ola@gmail.com \
    --cc=nicola.lunghi@jci.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox