summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2017-07-22 09:50:43 -0700
committerArmin Kuster <akuster808@gmail.com>2017-09-13 18:20:09 -0700
commit14135847192a18777f4d8744ed172aba073062c8 (patch)
tree2f6c94630af943864360c63d708cde1775a0d2da
parentad50bde57469a8febaed9fd6f5b983c88ccf0e1f (diff)
downloadmeta-openembedded-14135847192a18777f4d8744ed172aba073062c8.tar.gz
openflow: Fix build with musl
Regenerate configure before running oe_runconf Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com> (cherry picked from commit a669e44708e985f717b6af876fe5e5e24e9afa17) Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--meta-networking/recipes-protocols/openflow/openflow.inc3
-rw-r--r--meta-networking/recipes-protocols/openflow/openflow/0001-Check-and-use-strlcpy-from-libc-before-defining-own.patch64
-rw-r--r--meta-networking/recipes-protocols/openflow/openflow/0002-lib-netdev-Adjust-header-include-sequence.patch59
-rw-r--r--meta-networking/recipes-protocols/openflow/openflow_git.bb5
4 files changed, 129 insertions, 2 deletions
diff --git a/meta-networking/recipes-protocols/openflow/openflow.inc b/meta-networking/recipes-protocols/openflow/openflow.inc
index 0ae2d1f1d..cccbfa19a 100644
--- a/meta-networking/recipes-protocols/openflow/openflow.inc
+++ b/meta-networking/recipes-protocols/openflow/openflow.inc
@@ -27,9 +27,8 @@ S = "${WORKDIR}/git"
27 27
28inherit autotools-brokensep pkgconfig 28inherit autotools-brokensep pkgconfig
29 29
30do_configure() { 30do_configure_prepend() {
31 ./boot.sh 31 ./boot.sh
32 oe_runconf
33} 32}
34 33
35do_install_append() { 34do_install_append() {
diff --git a/meta-networking/recipes-protocols/openflow/openflow/0001-Check-and-use-strlcpy-from-libc-before-defining-own.patch b/meta-networking/recipes-protocols/openflow/openflow/0001-Check-and-use-strlcpy-from-libc-before-defining-own.patch
new file mode 100644
index 000000000..952274bb9
--- /dev/null
+++ b/meta-networking/recipes-protocols/openflow/openflow/0001-Check-and-use-strlcpy-from-libc-before-defining-own.patch
@@ -0,0 +1,64 @@
1From 7b62e5884353b247f542844d1e4687d0e9211999 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 20 Jul 2017 04:27:32 -0700
4Subject: [PATCH 1/2] Check and use strlcpy from libc before defining own
5
6This is required especially on musl where
7function prototype conflicts and causes build
8failures.
9
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 configure.ac | 2 +-
13 lib/util.c | 2 ++
14 lib/util.h | 1 +
15 3 files changed, 4 insertions(+), 1 deletion(-)
16
17diff --git a/configure.ac b/configure.ac
18index 13064f6..596c43f 100644
19--- a/configure.ac
20+++ b/configure.ac
21@@ -57,7 +57,7 @@ OFP_CHECK_HWTABLES
22 OFP_CHECK_HWLIBS
23 AC_SYS_LARGEFILE
24
25-AC_CHECK_FUNCS([strsignal])
26+AC_CHECK_FUNCS([strlcpy strsignal])
27
28 AC_ARG_VAR(KARCH, [Kernel Architecture String])
29 AC_SUBST(KARCH)
30diff --git a/lib/util.c b/lib/util.c
31index 21cc28d..1f341b1 100644
32--- a/lib/util.c
33+++ b/lib/util.c
34@@ -138,6 +138,7 @@ xasprintf(const char *format, ...)
35 return s;
36 }
37
38+#ifndef HAVE_STRLCPY
39 void
40 strlcpy(char *dst, const char *src, size_t size)
41 {
42@@ -148,6 +149,7 @@ strlcpy(char *dst, const char *src, size_t size)
43 dst[n_copy] = '\0';
44 }
45 }
46+#endif
47
48 void
49 ofp_fatal(int err_no, const char *format, ...)
50diff --git a/lib/util.h b/lib/util.h
51index fde681f..9e45ea9 100644
52--- a/lib/util.h
53+++ b/lib/util.h
54@@ -41,6 +41,7 @@
55 #include <stdio.h>
56 #include <string.h>
57 #include "compiler.h"
58+#include "config.h"
59
60 #ifndef va_copy
61 #ifdef __va_copy
62--
632.13.3
64
diff --git a/meta-networking/recipes-protocols/openflow/openflow/0002-lib-netdev-Adjust-header-include-sequence.patch b/meta-networking/recipes-protocols/openflow/openflow/0002-lib-netdev-Adjust-header-include-sequence.patch
new file mode 100644
index 000000000..75180fe32
--- /dev/null
+++ b/meta-networking/recipes-protocols/openflow/openflow/0002-lib-netdev-Adjust-header-include-sequence.patch
@@ -0,0 +1,59 @@
1From 5bba224edea38607e8732081f86679ffd8b218ab Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 20 Jul 2017 04:29:04 -0700
4Subject: [PATCH 2/2] lib/netdev: Adjust header include sequence
5
6Specify libc headers before kernel UAPIs
7this helps compiling with musl where otherwise
8it uses the definition from kernel and complains
9about double definition in libc headers
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 lib/netdev.c | 11 +++++------
14 1 file changed, 5 insertions(+), 6 deletions(-)
15
16diff --git a/lib/netdev.c b/lib/netdev.c
17index 3b6fbc5..c7de25e 100644
18--- a/lib/netdev.c
19+++ b/lib/netdev.c
20@@ -39,7 +39,6 @@
21 #include <fcntl.h>
22 #include <arpa/inet.h>
23 #include <inttypes.h>
24-#include <linux/if_tun.h>
25
26 /* Fix for some compile issues we were experiencing when setting up openwrt
27 * with the 2.4 kernel. linux/ethtool.h seems to use kernel-style inttypes,
28@@ -57,10 +56,6 @@
29 #define s64 __s64
30 #endif
31
32-#include <linux/ethtool.h>
33-#include <linux/rtnetlink.h>
34-#include <linux/sockios.h>
35-#include <linux/version.h>
36 #include <sys/types.h>
37 #include <sys/ioctl.h>
38 #include <sys/socket.h>
39@@ -68,12 +63,16 @@
40 #include <net/ethernet.h>
41 #include <net/if.h>
42 #include <net/if_arp.h>
43-#include <net/if_packet.h>
44 #include <net/route.h>
45 #include <netinet/in.h>
46 #include <stdlib.h>
47 #include <string.h>
48 #include <unistd.h>
49+#include <linux/ethtool.h>
50+#include <linux/rtnetlink.h>
51+#include <linux/sockios.h>
52+#include <linux/version.h>
53+#include <linux/if_tun.h>
54
55 #include "fatal-signal.h"
56 #include "list.h"
57--
582.13.3
59
diff --git a/meta-networking/recipes-protocols/openflow/openflow_git.bb b/meta-networking/recipes-protocols/openflow/openflow_git.bb
index 6403bfb22..eceb45e94 100644
--- a/meta-networking/recipes-protocols/openflow/openflow_git.bb
+++ b/meta-networking/recipes-protocols/openflow/openflow_git.bb
@@ -2,3 +2,8 @@ include ${BPN}.inc
2 2
3SRCREV = "c84f33f09d5dbcfc9b489f64cb30475bf36f653a" 3SRCREV = "c84f33f09d5dbcfc9b489f64cb30475bf36f653a"
4PV = "1.0+git${SRCPV}" 4PV = "1.0+git${SRCPV}"
5
6SRC_URI += "\
7 file://0001-Check-and-use-strlcpy-from-libc-before-defining-own.patch \
8 file://0002-lib-netdev-Adjust-header-include-sequence.patch \
9 "