summaryrefslogtreecommitdiffstats
path: root/recipes-containers/lxc
diff options
context:
space:
mode:
authorMark Asselstine <mark.asselstine@windriver.com>2017-02-02 12:01:13 -0500
committerBruce Ashfield <bruce.ashfield@windriver.com>2017-02-02 15:55:38 -0500
commita9616ca504892a714cae26f6a531637d97f03764 (patch)
tree8dd100b8f84efe7a723ecf8ef6f2fdde4e520267 /recipes-containers/lxc
parent31522fd94295d6d1c7b6c27b4cd913c8f34e7582 (diff)
downloadmeta-virtualization-a9616ca504892a714cae26f6a531637d97f03764.tar.gz
lxc: fixup builds with newer glibc
The poky/oe-core commit [glibc: Upgrade to 2.25 snapshot] brought with it a change that has apparently been in the works for a while, to move major() and minor() definitions from <sys/types.h> to <sys/sysmacros.h>. This version of glibc took the step of adding a warning about this change which results in the build failure of lxc since we build with -Werror: | lxclvm.c:139:13: error: In the GNU C Library, "major" is defined | by <sys/sysmacros.h>. For historical compatibility, it is | currently defined by <sys/types.h> as well, but we plan to | remove this soon. To use "major", include <sys/sysmacros.h> | directly. If you did not intend to use a system-defined macro | "major", you should undefine it after including <sys/types.h>. [-Werror] | major(statbuf.st_rdev), minor(statbuf.st_rdev)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Instead of dropping -Werror we are opting instead to apply the upstream fix for this since it is available and applies relatively cleanly. Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'recipes-containers/lxc')
-rw-r--r--recipes-containers/lxc/files/Use-AC_HEADER_MAJOR-to-detect-major-minor-makedev.patch119
-rw-r--r--recipes-containers/lxc/lxc_2.0.0.bb1
2 files changed, 120 insertions, 0 deletions
diff --git a/recipes-containers/lxc/files/Use-AC_HEADER_MAJOR-to-detect-major-minor-makedev.patch b/recipes-containers/lxc/files/Use-AC_HEADER_MAJOR-to-detect-major-minor-makedev.patch
new file mode 100644
index 00000000..f9cecc07
--- /dev/null
+++ b/recipes-containers/lxc/files/Use-AC_HEADER_MAJOR-to-detect-major-minor-makedev.patch
@@ -0,0 +1,119 @@
1From 5c957671a511441b112b137b88bf0b1f31adac20 Mon Sep 17 00:00:00 2001
2From: Sergei Trofimovich <siarheit@google.com>
3Date: Sat, 21 Jan 2017 11:57:13 +0000
4Subject: [PATCH] Use AC_HEADER_MAJOR to detect major()/minor()/makedev()
5
6commit af6824fce9c9536fbcabef8d5547f6c486f55fdf from
7git://github.com/lxc/lxc.git
8
9Before the change build failed on Gentoo as:
10
11 bdev/lxclvm.c: In function 'lvm_detect':
12 bdev/lxclvm.c:140:4: error: implicit declaration of function 'major' [-Werror=implicit-function-declaration]
13 major(statbuf.st_rdev), minor(statbuf.st_rdev));
14 ^~~~~
15 bdev/lxclvm.c:140:28: error: implicit declaration of function 'minor' [-Werror=implicit-function-declaration]
16 major(statbuf.st_rdev), minor(statbuf.st_rdev));
17 ^~~~~
18
19glibc plans to remove <sys/sysmacros.h> from glibc's <sys/types.h>:
20 https://sourceware.org/ml/libc-alpha/2015-11/msg00253.html
21
22Gentoo already applied glibc patch to experimental glibc-2.24
23to start preparingfor the change.
24
25Autoconf has AC_HEADER_MAJOR to find out which header defines
26reqiured macros:
27 https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Particular-Headers.html
28
29This change should also increase portability across other libcs.
30
31Bug: https://bugs.gentoo.org/604360
32Signed-off-by: Sergei Trofimovich <siarheit@google.com>
33Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
34---
35 configure.ac | 3 +++
36 src/lxc/bdev/lxclvm.c | 9 +++++++++
37 src/lxc/conf.c | 8 ++++++++
38 src/lxc/lxccontainer.c | 8 ++++++++
39 4 files changed, 28 insertions(+)
40
41diff --git a/configure.ac b/configure.ac
42index 8f31c29..924baa1 100644
43--- a/configure.ac
44+++ b/configure.ac
45@@ -601,6 +601,9 @@ AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include <sys/prctl.h>])
46 # Check for some headers
47 AC_CHECK_HEADERS([sys/signalfd.h pty.h ifaddrs.h sys/capability.h sys/personality.h utmpx.h sys/timerfd.h])
48
49+# lookup major()/minor()/makedev()
50+AC_HEADER_MAJOR
51+
52 # Check for some syscalls functions
53 AC_CHECK_FUNCS([setns pivot_root sethostname unshare rand_r confstr faccessat])
54
55diff --git a/src/lxc/bdev/lxclvm.c b/src/lxc/bdev/lxclvm.c
56index 3d41b10..419d1c2 100644
57--- a/src/lxc/bdev/lxclvm.c
58+++ b/src/lxc/bdev/lxclvm.c
59@@ -32,10 +32,19 @@
60 #include <sys/wait.h>
61
62 #include "bdev.h"
63+#include "config.h"
64 #include "log.h"
65 #include "lxclvm.h"
66 #include "utils.h"
67
68+/* major()/minor() */
69+#ifdef MAJOR_IN_MKDEV
70+# include <sys/mkdev.h>
71+#endif
72+#ifdef MAJOR_IN_SYSMACROS
73+# include <sys/sysmacros.h>
74+#endif
75+
76 lxc_log_define(lxclvm, lxc);
77
78 extern char *dir_new_path(char *src, const char *oldname, const char *name,
79diff --git a/src/lxc/conf.c b/src/lxc/conf.c
80index 3b023ef..53406ca 100644
81--- a/src/lxc/conf.c
82+++ b/src/lxc/conf.c
83@@ -39,6 +39,14 @@
84 #include <grp.h>
85 #include <time.h>
86
87+/* makedev() */
88+#ifdef MAJOR_IN_MKDEV
89+# include <sys/mkdev.h>
90+#endif
91+#ifdef MAJOR_IN_SYSMACROS
92+# include <sys/sysmacros.h>
93+#endif
94+
95 #ifdef HAVE_STATVFS
96 #include <sys/statvfs.h>
97 #endif
98diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
99index 9f12ca2..aa02833 100644
100--- a/src/lxc/lxccontainer.c
101+++ b/src/lxc/lxccontainer.c
102@@ -61,6 +61,14 @@
103 #include "utils.h"
104 #include "version.h"
105
106+/* major()/minor() */
107+#ifdef MAJOR_IN_MKDEV
108+# include <sys/mkdev.h>
109+#endif
110+#ifdef MAJOR_IN_SYSMACROS
111+# include <sys/sysmacros.h>
112+#endif
113+
114 #if HAVE_IFADDRS_H
115 #include <ifaddrs.h>
116 #else
117--
1182.7.4
119
diff --git a/recipes-containers/lxc/lxc_2.0.0.bb b/recipes-containers/lxc/lxc_2.0.0.bb
index dcbd171b..f34d9bca 100644
--- a/recipes-containers/lxc/lxc_2.0.0.bb
+++ b/recipes-containers/lxc/lxc_2.0.0.bb
@@ -31,6 +31,7 @@ SRC_URI = "http://linuxcontainers.org/downloads/${BPN}-${PV}.tar.gz \
31 file://lxc-fix-B-S.patch \ 31 file://lxc-fix-B-S.patch \
32 file://lxc-doc-upgrade-to-use-docbook-3.1-DTD.patch \ 32 file://lxc-doc-upgrade-to-use-docbook-3.1-DTD.patch \
33 file://logs-optionally-use-base-filenames-to-report-src-fil.patch \ 33 file://logs-optionally-use-base-filenames-to-report-src-fil.patch \
34 file://Use-AC_HEADER_MAJOR-to-detect-major-minor-makedev.patch \
34 " 35 "
35 36
36SRC_URI[md5sum] = "04a7245a614cd3296b0ae9ceeeb83fbb" 37SRC_URI[md5sum] = "04a7245a614cd3296b0ae9ceeeb83fbb"