summaryrefslogtreecommitdiffstats
path: root/meta-networking
diff options
context:
space:
mode:
authorAndreas Müller <schnitzeltony@gmail.com>2019-04-10 20:23:28 +0200
committerKhem Raj <raj.khem@gmail.com>2019-04-11 11:30:35 -0700
commitfc144a1428cdff292d2dc9d1a7440acd1e712aa0 (patch)
tree4f45498d12594423e9e1b48412bf2af9e7d277fa /meta-networking
parenta5806d71cb91acf4b69891f955ef6264d9f21aa3 (diff)
downloadmeta-openembedded-fc144a1428cdff292d2dc9d1a7440acd1e712aa0.tar.gz
networkmanager: rework musl build
patches: * Split out systemd specifics * Simplfy patch to fix musl / linux-libc definition conflicts. This makes future maintenance less pain and fixes build for recipes depending on networkmanager. For further background read patch description in 0002-Fix-build-with-musl.patch musl CFLAGS: * -D__USE_POSIX199309 removed - could not find any trace of it * CFLAGS_libc-musl_append -> CFLAGS_append_libc-musl gobject-introspection: * enable - it builds perfectly fine Build tested (musl/glibc) with all dependents found in my layers: * network-manager-applet * networkmanager-openvpn * python-networkmanager * networkmanager-qt * plasma-nm * liri-networkmanager Signed-off-by: Andreas Müller <schnitzeltony@gmail.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-networking')
-rw-r--r--meta-networking/recipes-connectivity/networkmanager/networkmanager/musl/0001-Fix-build-with-musl-systemd-specific.patch (renamed from meta-networking/recipes-connectivity/networkmanager/networkmanager/musl/0001-Fix-build-with-musl.patch)196
-rw-r--r--meta-networking/recipes-connectivity/networkmanager/networkmanager/musl/0002-Fix-build-with-musl.patch118
-rw-r--r--meta-networking/recipes-connectivity/networkmanager/networkmanager_1.16.0.bb26
3 files changed, 148 insertions, 192 deletions
diff --git a/meta-networking/recipes-connectivity/networkmanager/networkmanager/musl/0001-Fix-build-with-musl.patch b/meta-networking/recipes-connectivity/networkmanager/networkmanager/musl/0001-Fix-build-with-musl-systemd-specific.patch
index b3f93ff92..accd2f256 100644
--- a/meta-networking/recipes-connectivity/networkmanager/networkmanager/musl/0001-Fix-build-with-musl.patch
+++ b/meta-networking/recipes-connectivity/networkmanager/networkmanager/musl/0001-Fix-build-with-musl-systemd-specific.patch
@@ -1,75 +1,26 @@
1From f43c9a5b07832a91383e59d655bc3c8a9f48c451 Mon Sep 17 00:00:00 2001 1From 7b09945585e6ce65049fa4039f26caee8daa44b9 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com> 2From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com>
3Date: Tue, 2 Apr 2019 01:34:35 +0200 3Date: Tue, 2 Apr 2019 01:34:35 +0200
4Subject: [PATCH] Fix build with musl 4Subject: [PATCH 1/2] Fix build with musl - systemd specific
5MIME-Version: 1.0 5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8 6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit 7Content-Transfer-Encoding: 8bit
8 8
9Networkmanager imported some code from systemd. This requires some adjustments
10for musl.
11
9Upstream-Status: Pending 12Upstream-Status: Pending
10 13
11Signed-off-by: Andreas Müller <schnitzeltony@gmail.com> 14Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
12--- 15---
13 clients/cli/connections.c | 1 - 16 shared/systemd/src/basic/in-addr-util.c | 1 +
14 libnm-core/nm-utils.c | 2 +- 17 shared/systemd/src/basic/process-util.c | 9 ++++++++
15 shared/n-acd/src/n-acd.c | 1 - 18 shared/systemd/src/basic/socket-util.h | 6 +++++
16 shared/systemd/src/basic/in-addr-util.c | 1 + 19 shared/systemd/src/basic/stdio-util.h | 2 ++
17 shared/systemd/src/basic/process-util.c | 9 ++++++ 20 shared/systemd/src/basic/string-util.h | 5 +++++
18 shared/systemd/src/basic/socket-util.h | 6 ++++ 21 shared/systemd/src/basic/util.h | 29 +++++--------------------
19 shared/systemd/src/basic/stdio-util.h | 2 ++ 22 6 files changed, 28 insertions(+), 24 deletions(-)
20 shared/systemd/src/basic/string-util.h | 5 ++++
21 shared/systemd/src/basic/util.h | 29 ++++----------------
22 src/platform/wifi/nm-wifi-utils.h | 4 +++
23 src/platform/wpan/nm-wpan-utils.h | 2 --
24 src/settings/nm-settings-connection.h | 2 --
25 src/systemd/src/libsystemd-network/sd-lldp.c | 1 +
26 src/systemd/src/systemd/sd-dhcp-client.h | 2 ++
27 src/systemd/src/systemd/sd-dhcp-lease.h | 2 ++
28 src/systemd/src/systemd/sd-dhcp6-client.h | 2 ++
29 src/systemd/src/systemd/sd-ipv4ll.h | 2 ++
30 src/systemd/src/systemd/sd-lldp.h | 2 +-
31 19 files changed, 44 insertions(+), 32 deletions(-)
32 23
33diff --git a/clients/cli/connections.c b/clients/cli/connections.c
34index 6db44f8..36e51cc 100644
35--- a/clients/cli/connections.c
36+++ b/clients/cli/connections.c
37@@ -25,7 +25,6 @@
38 #include <stdlib.h>
39 #include <unistd.h>
40 #include <signal.h>
41-#include <netinet/ether.h>
42 #include <readline/readline.h>
43 #include <readline/history.h>
44 #include <fcntl.h>
45diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c
46index d276cfe..2aec785 100644
47--- a/libnm-core/nm-utils.c
48+++ b/libnm-core/nm-utils.c
49@@ -21,10 +21,10 @@
50
51 #include "nm-default.h"
52
53+#include <netinet/ether.h>
54 #include "nm-utils.h"
55
56 #include <stdlib.h>
57-#include <netinet/ether.h>
58 #include <arpa/inet.h>
59 #include <uuid/uuid.h>
60 #include <libintl.h>
61diff --git a/shared/n-acd/src/n-acd.c b/shared/n-acd/src/n-acd.c
62index def56a2..dd4eb78 100644
63--- a/shared/n-acd/src/n-acd.c
64+++ b/shared/n-acd/src/n-acd.c
65@@ -11,7 +11,6 @@
66 #include <inttypes.h>
67 #include <limits.h>
68 #include <linux/if_packet.h>
69-#include <netinet/if_ether.h>
70 #include <netinet/in.h>
71 #include <stdlib.h>
72 #include <string.h>
73diff --git a/shared/systemd/src/basic/in-addr-util.c b/shared/systemd/src/basic/in-addr-util.c 24diff --git a/shared/systemd/src/basic/in-addr-util.c b/shared/systemd/src/basic/in-addr-util.c
74index 5ced350..c6b52b8 100644 25index 5ced350..c6b52b8 100644
75--- a/shared/systemd/src/basic/in-addr-util.c 26--- a/shared/systemd/src/basic/in-addr-util.c
@@ -223,129 +174,6 @@ index dc33d66..cc768e9 100644
223 /* Normal memcpy requires src to be nonnull. We do nothing if n is 0. */ 174 /* Normal memcpy requires src to be nonnull. We do nothing if n is 0. */
224 static inline void memcpy_safe(void *dst, const void *src, size_t n) { 175 static inline void memcpy_safe(void *dst, const void *src, size_t n) {
225 if (n == 0) 176 if (n == 0)
226diff --git a/src/platform/wifi/nm-wifi-utils.h b/src/platform/wifi/nm-wifi-utils.h
227index 36148b5..d282eb2 100644
228--- a/src/platform/wifi/nm-wifi-utils.h
229+++ b/src/platform/wifi/nm-wifi-utils.h
230@@ -22,7 +22,11 @@
231 #ifndef __WIFI_UTILS_H__
232 #define __WIFI_UTILS_H__
233
234+#if defined(__GLIBC__)
235 #include <net/ethernet.h>
236+#else /* musl libc */
237+#define ETH_ALEN 6 /* Octets in one ethernet addr */
238+#endif
239
240 #include "nm-dbus-interface.h"
241 #include "nm-setting-wireless.h"
242diff --git a/src/platform/wpan/nm-wpan-utils.h b/src/platform/wpan/nm-wpan-utils.h
243index 1b54ec4..ed39938 100644
244--- a/src/platform/wpan/nm-wpan-utils.h
245+++ b/src/platform/wpan/nm-wpan-utils.h
246@@ -20,8 +20,6 @@
247 #ifndef __WPAN_UTILS_H__
248 #define __WPAN_UTILS_H__
249
250-#include <net/ethernet.h>
251-
252 #include "nm-dbus-interface.h"
253 #include "platform/nm-netlink.h"
254
255diff --git a/src/settings/nm-settings-connection.h b/src/settings/nm-settings-connection.h
256index e796b71..c01fef6 100644
257--- a/src/settings/nm-settings-connection.h
258+++ b/src/settings/nm-settings-connection.h
259@@ -22,8 +22,6 @@
260 #ifndef __NETWORKMANAGER_SETTINGS_CONNECTION_H__
261 #define __NETWORKMANAGER_SETTINGS_CONNECTION_H__
262
263-#include <net/ethernet.h>
264-
265 #include "nm-dbus-object.h"
266 #include "nm-connection.h"
267
268diff --git a/src/systemd/src/libsystemd-network/sd-lldp.c b/src/systemd/src/libsystemd-network/sd-lldp.c
269index 741128e..62914ae 100644
270--- a/src/systemd/src/libsystemd-network/sd-lldp.c
271+++ b/src/systemd/src/libsystemd-network/sd-lldp.c
272@@ -3,6 +3,7 @@
273 #include "nm-sd-adapt-core.h"
274
275 #include <arpa/inet.h>
276+#include <net/ethernet.h>
277 #include <linux/sockios.h>
278 #include <sys/ioctl.h>
279
280diff --git a/src/systemd/src/systemd/sd-dhcp-client.h b/src/systemd/src/systemd/sd-dhcp-client.h
281index bd0d429..c935fe1 100644
282--- a/src/systemd/src/systemd/sd-dhcp-client.h
283+++ b/src/systemd/src/systemd/sd-dhcp-client.h
284@@ -20,7 +20,9 @@
285 ***/
286
287 #include <inttypes.h>
288+#if defined(__GLIBC__)
289 #include <net/ethernet.h>
290+#endif
291 #include <netinet/in.h>
292 #include <sys/types.h>
293 #include <stdbool.h>
294diff --git a/src/systemd/src/systemd/sd-dhcp-lease.h b/src/systemd/src/systemd/sd-dhcp-lease.h
295index d299c79..991e67e 100644
296--- a/src/systemd/src/systemd/sd-dhcp-lease.h
297+++ b/src/systemd/src/systemd/sd-dhcp-lease.h
298@@ -19,7 +19,9 @@
299 ***/
300
301 #include <inttypes.h>
302+#if defined(__GLIBC__)
303 #include <net/ethernet.h>
304+#endif
305 #include <netinet/in.h>
306 #include <sys/types.h>
307
308diff --git a/src/systemd/src/systemd/sd-dhcp6-client.h b/src/systemd/src/systemd/sd-dhcp6-client.h
309index 43d38f5..57ab487 100644
310--- a/src/systemd/src/systemd/sd-dhcp6-client.h
311+++ b/src/systemd/src/systemd/sd-dhcp6-client.h
312@@ -20,7 +20,9 @@
313 ***/
314
315 #include <inttypes.h>
316+#if defined(__GLIBC__)
317 #include <net/ethernet.h>
318+#endif
319 #include <sys/types.h>
320
321 #include "sd-dhcp6-lease.h"
322diff --git a/src/systemd/src/systemd/sd-ipv4ll.h b/src/systemd/src/systemd/sd-ipv4ll.h
323index 71bd4cf..1c667ba 100644
324--- a/src/systemd/src/systemd/sd-ipv4ll.h
325+++ b/src/systemd/src/systemd/sd-ipv4ll.h
326@@ -19,7 +19,9 @@
327 along with systemd; If not, see <http://www.gnu.org/licenses/>.
328 ***/
329
330+#if defined(__GLIBC__)
331 #include <net/ethernet.h>
332+#endif
333 #include <netinet/in.h>
334
335 #include "sd-event.h"
336diff --git a/src/systemd/src/systemd/sd-lldp.h b/src/systemd/src/systemd/sd-lldp.h
337index bf3afad..4cace87 100644
338--- a/src/systemd/src/systemd/sd-lldp.h
339+++ b/src/systemd/src/systemd/sd-lldp.h
340@@ -18,7 +18,7 @@
341 ***/
342
343 #include <inttypes.h>
344-#include <net/ethernet.h>
345+//#include <net/ethernet.h>
346 #include <sys/types.h>
347
348 #include "sd-event.h"
349-- 177--
3502.20.1 1782.20.1
351 179
diff --git a/meta-networking/recipes-connectivity/networkmanager/networkmanager/musl/0002-Fix-build-with-musl.patch b/meta-networking/recipes-connectivity/networkmanager/networkmanager/musl/0002-Fix-build-with-musl.patch
new file mode 100644
index 000000000..25f9a4a00
--- /dev/null
+++ b/meta-networking/recipes-connectivity/networkmanager/networkmanager/musl/0002-Fix-build-with-musl.patch
@@ -0,0 +1,118 @@
1From 0b0f2d5abe27b2c9587f449795f0ae3568fc3e38 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com>
3Date: Mon, 8 Apr 2019 23:10:43 +0200
4Subject: [PATCH 2/2] Fix build with musl
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9The build issues caused by definition conflicts musl vs linux-libc headers
10(error: redefinition of ...) can be reduced to two headers:
11
121. netinet/if_ether.h <-> linux/if_ether.h: linux-libc header plays well with
13 glibc and musl headers in case libc's variant (netinet/if_ether.h) is
14 included BEFORE linux variant [1]. We add include at two positions:
15 1. shared/nm-default.h: This is a global which used for networkmanager and
16 is included at the very beginning of all c-files.
17 2. libnm-core/nm-utils.h: This file makes it into installation and is used
18 by dependent packages as network-manager-applet
192. net/if_arp. <-> linux/if_ether.h: linux-libc: Unfortunaly these files do
20 not play together in harmony. Therefore the libc variant is included early in
21 shared/nm-default.h and occurances linux/if_arp.h are removed.
22
23Note:
24Be aware that this is still nasty business: We have to trust that musl headers
25define same signatures as linux would do - just because musl-makers consider
26linux-libc headers 'notoriously broken for userspace' [2] (search for
27'error: redefinition of').
28
29[1] http://lists.openembedded.org/pipermail/openembedded-core/2019-March/280440.html
30[2] https://wiki.musl-libc.org/faq.html
31
32Upstream-Status: Pending
33
34Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
35---
36 clients/tui/nmt-device-entry.c | 1 -
37 libnm-core/nm-utils.h | 4 ++++
38 shared/nm-default.h | 3 +++
39 src/devices/nm-device.c | 2 +-
40 src/platform/nm-linux-platform.c | 1 -
41 5 files changed, 8 insertions(+), 3 deletions(-)
42
43diff --git a/clients/tui/nmt-device-entry.c b/clients/tui/nmt-device-entry.c
44index 43fbbc1..3eae286 100644
45--- a/clients/tui/nmt-device-entry.c
46+++ b/clients/tui/nmt-device-entry.c
47@@ -39,7 +39,6 @@
48 #include "nmt-device-entry.h"
49
50 #include <sys/socket.h>
51-#include <linux/if_arp.h>
52
53 #include "nmtui.h"
54
55diff --git a/libnm-core/nm-utils.h b/libnm-core/nm-utils.h
56index 2b5baba..8a50131 100644
57--- a/libnm-core/nm-utils.h
58+++ b/libnm-core/nm-utils.h
59@@ -25,6 +25,10 @@
60 #error "Only <NetworkManager.h> can be included directly."
61 #endif
62
63+/* include as early as possible for musl */
64+#include <netinet/if_ether.h>
65+/* #include <net/if_arp.h> - uncoment for broken dependents?? */
66+
67 #include <glib.h>
68
69 #include <netinet/in.h>
70diff --git a/shared/nm-default.h b/shared/nm-default.h
71index 26d6476..b29e8af 100644
72--- a/shared/nm-default.h
73+++ b/shared/nm-default.h
74@@ -211,6 +211,9 @@
75 #endif
76
77 #include <stdlib.h>
78+/* include as early as possible for musl */
79+#include <netinet/if_ether.h>
80+#include <net/if_arp.h>
81
82 /*****************************************************************************/
83
84diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
85index 7514fa7..d305fa5 100644
86--- a/src/devices/nm-device.c
87+++ b/src/devices/nm-device.c
88@@ -24,6 +24,7 @@
89 #include "nm-device.h"
90
91 #include <netinet/in.h>
92+#include <net/if.h>
93 #include <unistd.h>
94 #include <sys/ioctl.h>
95 #include <signal.h>
96@@ -32,7 +33,6 @@
97 #include <arpa/inet.h>
98 #include <fcntl.h>
99 #include <linux/if_addr.h>
100-#include <linux/if_arp.h>
101 #include <linux/rtnetlink.h>
102 #include <linux/pkt_sched.h>
103
104diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
105index 2f5c75b..d6ca6d9 100644
106--- a/src/platform/nm-linux-platform.c
107+++ b/src/platform/nm-linux-platform.c
108@@ -27,7 +27,6 @@
109 #include <fcntl.h>
110 #include <libudev.h>
111 #include <linux/ip.h>
112-#include <linux/if_arp.h>
113 #include <linux/if_link.h>
114 #include <linux/if_tun.h>
115 #include <linux/if_tunnel.h>
116--
1172.20.1
118
diff --git a/meta-networking/recipes-connectivity/networkmanager/networkmanager_1.16.0.bb b/meta-networking/recipes-connectivity/networkmanager/networkmanager_1.16.0.bb
index 9f57908e9..9f01f1bc1 100644
--- a/meta-networking/recipes-connectivity/networkmanager/networkmanager_1.16.0.bb
+++ b/meta-networking/recipes-connectivity/networkmanager/networkmanager_1.16.0.bb
@@ -28,7 +28,10 @@ SRC_URI = " \
28 file://0002-Do-not-create-settings-settings-property-documentati.patch \ 28 file://0002-Do-not-create-settings-settings-property-documentati.patch \
29 file://0003-dlopen-failure.patch \ 29 file://0003-dlopen-failure.patch \
30" 30"
31SRC_URI_append_libc-musl = " file://musl/0001-Fix-build-with-musl.patch" 31SRC_URI_append_libc-musl = " \
32 file://musl/0001-Fix-build-with-musl-systemd-specific.patch \
33 file://musl/0002-Fix-build-with-musl.patch \
34"
32 35
33SRC_URI[md5sum] = "10abacaafb162a67d2942adf03e7e9e4" 36SRC_URI[md5sum] = "10abacaafb162a67d2942adf03e7e9e4"
34SRC_URI[sha256sum] = "8e962833b6ca03edda1bc57ed6614a7b8c2339531b44acef098d05f2324c5d2c" 37SRC_URI[sha256sum] = "8e962833b6ca03edda1bc57ed6614a7b8c2339531b44acef098d05f2324c5d2c"
@@ -47,13 +50,20 @@ EXTRA_OECONF = " \
47 --with-udev-dir=${nonarch_base_libdir}/udev \ 50 --with-udev-dir=${nonarch_base_libdir}/udev \
48" 51"
49 52
50# gobject-introspection related 53# stolen from https://github.com/void-linux/void-packages/blob/master/srcpkgs/NetworkManager/template
51GI_DATA_ENABLED_libc-musl = "False" 54# avoids:
52 55# | ../NetworkManager-1.16.0/libnm-core/nm-json.c:106:50: error: 'RTLD_DEEPBIND' undeclared (first use in this function); did you mean 'RTLD_DEFAULT'?
53# stolen from https://github.com/voidlinux/void-packages/blob/master/srcpkgs/NetworkManager/template 56#
54CFLAGS_libc-musl_append = " \ 57# and
55 -DHAVE_SECURE_GETENV -Dsecure_getenv=getenv \ 58#
56 -D__USE_POSIX199309 -DRTLD_DEEPBIND=0 \ 59# | In file included from ../NetworkManager-1.16.0/src/systemd/nm-sd-utils-core.c:25:
60# | ../NetworkManager-1.16.0/src/systemd/sd-adapt-core/nm-sd-adapt-core.h:68:6: error: #error neither secure_getenv nor __secure_getenv is available
61# | # error neither secure_getenv nor __secure_getenv is available
62# | ^~~~~
63CFLAGS_append_libc-musl = " \
64 -DRTLD_DEEPBIND=0 \
65 -DHAVE_SECURE_GETENV \
66 -Dsecure_getenv=getenv \
57" 67"
58 68
59do_compile_prepend() { 69do_compile_prepend() {