Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame^] | 1 | From 3d1307735667758f44378585482fe421db086af8 Mon Sep 17 00:00:00 2001 |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 2 | From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com> |
| 3 | Date: Mon, 8 Apr 2019 23:10:43 +0200 |
| 4 | Subject: [PATCH 2/2] Fix build with musl |
| 5 | MIME-Version: 1.0 |
| 6 | Content-Type: text/plain; charset=UTF-8 |
| 7 | Content-Transfer-Encoding: 8bit |
| 8 | |
| 9 | The build issues caused by definition conflicts musl vs linux-libc headers |
| 10 | (error: redefinition of ...) can be reduced to two headers: |
| 11 | |
| 12 | 1. 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 |
| 19 | 2. 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 | |
| 23 | Note: |
| 24 | Be aware that this is still nasty business: We have to trust that musl headers |
| 25 | define same signatures as linux would do - just because musl-makers consider |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame^] | 26 | linux-libc headers 'notoriously broken for userspace' [2] (search for |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 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 | |
| 32 | Upstream-Status: Pending |
| 33 | |
| 34 | Signed-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 | |
| 43 | diff --git a/clients/tui/nmt-device-entry.c b/clients/tui/nmt-device-entry.c |
| 44 | index 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 | |
| 55 | diff --git a/libnm-core/nm-utils.h b/libnm-core/nm-utils.h |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame^] | 56 | index 2b5baba..f7abab6 100644 |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 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> |
| 70 | diff --git a/shared/nm-default.h b/shared/nm-default.h |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame^] | 71 | index 54e9916..26e9f4e 100644 |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 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 | |
| 84 | diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame^] | 85 | index bd4fbcc..f70b309 100644 |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 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 | |
| 104 | diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame^] | 105 | index d4b0115..22a3a90 100644 |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 106 | --- a/src/platform/nm-linux-platform.c |
| 107 | +++ b/src/platform/nm-linux-platform.c |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame^] | 108 | @@ -28,7 +28,6 @@ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 109 | #include <libudev.h> |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame^] | 110 | #include <linux/fib_rules.h> |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 111 | #include <linux/ip.h> |
| 112 | -#include <linux/if_arp.h> |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame^] | 113 | #include <linux/if_bridge.h> |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 114 | #include <linux/if_link.h> |
| 115 | #include <linux/if_tun.h> |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 116 | -- |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame^] | 117 | 2.17.1 |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 118 | |