]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blob - package/lxc/0002-Fix-compilation-with-static-libcap-and-shared-gnutls.patch
lxc: fix build with static libcap and shared gnutls
[coffee/buildroot.git] / package / lxc / 0002-Fix-compilation-with-static-libcap-and-shared-gnutls.patch
1 From 49bc916b1daa79cffe38fae32059bcdd985c8c8e Mon Sep 17 00:00:00 2001
2 From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
3 Date: Sat, 7 Apr 2018 15:48:46 +0200
4 Subject: [PATCH] Fix compilation with static libcap and shared gnutls
5
6 Commit c06ed219c47098f34485d408410b6ecc94a40877 has broken
7 compilation with a static libcap and a shared gnutls.
8 This results in a build failure on init_lxc_static if gnutls is
9 a shared library as init_lxc_static is built with -all-static option
10 (see src/lxc/Makefile.am) and AC_CHECK_LIB adds gnutls to LIBS.
11
12 This commit fix the issue by removing default behavior of AC_CHECK_LIB
13 and handling manually GNUTLS_LIBS and HAVE_LIBGNUTLS
14
15 Fixes:
16  - http://autobuild.buildroot.net/results/b655d6853c25a195df28d91512b3ffb6c654fc90
17
18 Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
19 Upstream-status: https://github.com/lxc/lxc/commit/49bc916b1daa79cffe38fae32059bcdd985c8c8e
20 ---
21  configure.ac        | 2 +-
22  src/lxc/Makefile.am | 8 ++++++--
23  2 files changed, 7 insertions(+), 3 deletions(-)
24
25 diff --git a/configure.ac b/configure.ac
26 index 50c99836..2467bb54 100644
27 --- a/configure.ac
28 +++ b/configure.ac
29 @@ -263,7 +263,7 @@ AM_CONDITIONAL([ENABLE_GNUTLS], [test "x$enable_gnutls" = "xyes"])
30  
31  AM_COND_IF([ENABLE_GNUTLS],
32         [AC_CHECK_HEADER([gnutls/gnutls.h],[],[AC_MSG_ERROR([You must install the GnuTLS development package in order to compile lxc])])
33 -       AC_CHECK_LIB([gnutls], [gnutls_hash_fast],[],[AC_MSG_ERROR([You must install the GnuTLS development package in order to compile lxc])])
34 +       AC_CHECK_LIB([gnutls], [gnutls_hash_fast],[true],[AC_MSG_ERROR([You must install the GnuTLS development package in order to compile lxc])])
35         AC_SUBST([GNUTLS_LIBS], [-lgnutls])])
36  
37  # SELinux
38 diff --git a/src/lxc/Makefile.am b/src/lxc/Makefile.am
39 index c8d76836..0662d83d 100644
40 --- a/src/lxc/Makefile.am
41 +++ b/src/lxc/Makefile.am
42 @@ -175,6 +175,10 @@ if ENABLE_APPARMOR
43  AM_CFLAGS += -DHAVE_APPARMOR
44  endif
45  
46 +if ENABLE_GNUTLS
47 +AM_CFLAGS += -DHAVE_LIBGNUTLS
48 +endif
49 +
50  if ENABLE_SELINUX
51  AM_CFLAGS += -DHAVE_SELINUX
52  endif
53 @@ -196,7 +200,7 @@ liblxc_la_LDFLAGS = \
54         -Wl,-soname,liblxc.so.$(firstword $(subst ., ,@LXC_ABI@)) \
55         -version-info @LXC_ABI_MAJOR@
56  
57 -liblxc_la_LIBADD = $(CAP_LIBS) $(SELINUX_LIBS) $(SECCOMP_LIBS)
58 +liblxc_la_LIBADD = $(CAP_LIBS) $(GNUTLS_LIBS) $(SELINUX_LIBS) $(SECCOMP_LIBS)
59  
60  bin_SCRIPTS=
61  
62 @@ -243,7 +247,7 @@ AM_LDFLAGS = -Wl,-E
63  if ENABLE_RPATH
64  AM_LDFLAGS += -Wl,-rpath -Wl,$(libdir)
65  endif
66 -LDADD=liblxc.la @CAP_LIBS@ @SELINUX_LIBS@ @SECCOMP_LIBS@
67 +LDADD=liblxc.la @CAP_LIBS@ @GNUTLS_LIBS@ @SELINUX_LIBS@ @SECCOMP_LIBS@
68  
69  if ENABLE_TOOLS
70  lxc_attach_SOURCES = tools/lxc_attach.c tools/arguments.c tools/tool_utils.c
71 -- 
72 2.14.1
73