Browse code

Dockerfile*: bump devmapper library version

Let's use latest lvm2 sources to compile the libdevmapper library.

Initial reason for compiling devmapper lib from sources was a need to
have the static version of the library at hand, in order to build
the static dockerd, but note that the same headers/solib are used
for dynamic build (dynbinary) as well.

The reason for this patch is to enable the deferral removal feature.
The supplied devmapper library (and headers) are too old, lacking the
needed functions, so the daemon is built with 'libdm_no_deferred_remove'
build tag (see the check in hack/make.sh). Because of this, even if the
kernel dm driver is perfectly able to support the feature, it can not
be used. For more details and background story, see [1].

Surely, one can't just change the version number. While at it:
- improve the comments;
- remove obsoleted URLs;
- remove s390 and ppc configure updates that are no longer needed;
- use pkg-config instead of hardcoding the flags (newer lib added
some more dependencies);

[1] https://github.com/moby/moby/issues/34298

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>

Kir Kolyshkin authored on 2017/08/02 09:29:29
Showing 10 changed files
... ...
@@ -72,21 +72,21 @@ RUN apt-get update && apt-get install -y \
72 72
 	zip \
73 73
 	--no-install-recommends \
74 74
 	&& pip install awscli==1.10.15
75
-# Get lvm2 source for compiling statically
76
-ENV LVM2_VERSION 2.02.103
75
+
76
+# Get lvm2 sources to build statically linked devmapper library
77
+ENV LVM2_VERSION 2.02.173
77 78
 RUN mkdir -p /usr/local/lvm2 \
78 79
 	&& curl -fsSL "https://mirrors.kernel.org/sourceware/lvm2/LVM2.${LVM2_VERSION}.tgz" \
79 80
 		| tar -xzC /usr/local/lvm2 --strip-components=1
80
-# See https://git.fedorahosted.org/cgit/lvm2.git/refs/tags for release tags
81 81
 
82
-# Compile and install lvm2
82
+# Compile and install (only the needed library)
83 83
 RUN cd /usr/local/lvm2 \
84 84
 	&& ./configure \
85 85
 		--build="$(gcc -print-multiarch)" \
86 86
 		--enable-static_link \
87
-	&& make device-mapper \
88
-	&& make install_device-mapper
89
-# See https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL
87
+		--enable-pkgconfig \
88
+	&& make -C include \
89
+	&& make -C libdm install_device-mapper
90 90
 
91 91
 # Install seccomp: the version shipped upstream is too old
92 92
 ENV SECCOMP_VERSION 2.3.2
... ...
@@ -54,28 +54,20 @@ RUN apt-get update && apt-get install -y \
54 54
 	vim-common \
55 55
 	--no-install-recommends
56 56
 
57
-# Get lvm2 source for compiling statically
58
-ENV LVM2_VERSION 2.02.103
57
+# Get lvm2 sources to build statically linked devmapper library
58
+ENV LVM2_VERSION 2.02.173
59 59
 RUN mkdir -p /usr/local/lvm2 \
60 60
 	&& curl -fsSL "https://mirrors.kernel.org/sourceware/lvm2/LVM2.${LVM2_VERSION}.tgz" \
61 61
 		| tar -xzC /usr/local/lvm2 --strip-components=1
62
-# See https://git.fedorahosted.org/cgit/lvm2.git/refs/tags for release tags
63 62
 
64
-# Fix platform enablement in lvm2 to support aarch64 properly
65
-RUN set -e \
66
-	&& for f in config.guess config.sub; do \
67
-		curl -fsSL -o "/usr/local/lvm2/autoconf/$f" "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=$f;hb=HEAD"; \
68
-	done
69
-# "arch.c:78:2: error: #error the arch code needs to know about your machine type"
70
-
71
-# Compile and install lvm2
63
+# Compile and install (only the needed library)
72 64
 RUN cd /usr/local/lvm2 \
73 65
 	&& ./configure \
74 66
 		--build="$(gcc -print-multiarch)" \
75 67
 		--enable-static_link \
76
-	&& make device-mapper \
77
-	&& make install_device-mapper
78
-# See https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL
68
+		--enable-pkgconfig \
69
+	&& make -C include \
70
+	&& make -C libdm install_device-mapper
79 71
 
80 72
 # Install seccomp: the version shipped upstream is too old
81 73
 ENV SECCOMP_VERSION 2.3.2
... ...
@@ -53,21 +53,21 @@ RUN apt-get update && apt-get install -y \
53 53
 	--no-install-recommends \
54 54
 	&& pip install awscli==1.10.15
55 55
 
56
-# Get lvm2 source for compiling statically
57
-ENV LVM2_VERSION 2.02.103
56
+# Get lvm2 sources to build statically linked devmapper library
57
+ENV LVM2_VERSION 2.02.173
58 58
 RUN mkdir -p /usr/local/lvm2 \
59 59
 	&& curl -fsSL "https://mirrors.kernel.org/sourceware/lvm2/LVM2.${LVM2_VERSION}.tgz" \
60 60
 		| tar -xzC /usr/local/lvm2 --strip-components=1
61
-# See https://git.fedorahosted.org/cgit/lvm2.git/refs/tags for release tags
62 61
 
63
-# Compile and install lvm2
62
+# Compile and install (only the needed library)
64 63
 RUN cd /usr/local/lvm2 \
65 64
 	&& ./configure \
66 65
 		--build="$(gcc -print-multiarch)" \
67 66
 		--enable-static_link \
68
-	&& make device-mapper \
69
-	&& make install_device-mapper
70
-# See https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL
67
+		--enable-pkgconfig \
68
+	&& make -C include \
69
+	&& make -C libdm install_device-mapper
70
+
71 71
 
72 72
 # Install Go
73 73
 # IMPORTANT: When updating this please note that stdlib archive/tar pkg is vendored
... ...
@@ -53,28 +53,20 @@ RUN apt-get update && apt-get install -y \
53 53
 	vim-common \
54 54
 	--no-install-recommends
55 55
 
56
-# Get lvm2 source for compiling statically
57
-ENV LVM2_VERSION 2.02.103
56
+# Get lvm2 sources to build statically linked devmapper library
57
+ENV LVM2_VERSION 2.02.173
58 58
 RUN mkdir -p /usr/local/lvm2 \
59 59
 	&& curl -fsSL "https://mirrors.kernel.org/sourceware/lvm2/LVM2.${LVM2_VERSION}.tgz" \
60 60
 		| tar -xzC /usr/local/lvm2 --strip-components=1
61
-# See https://git.fedorahosted.org/cgit/lvm2.git/refs/tags for release tags
62 61
 
63
-# Fix platform enablement in lvm2 to support ppc64le properly
64
-RUN set -e \
65
-	&& for f in config.guess config.sub; do \
66
-		curl -fsSL -o "/usr/local/lvm2/autoconf/$f" "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=$f;hb=HEAD"; \
67
-	done
68
-# "arch.c:78:2: error: #error the arch code needs to know about your machine type"
69
-
70
-# Compile and install lvm2
62
+# Compile and install (only the needed library)
71 63
 RUN cd /usr/local/lvm2 \
72 64
 	&& ./configure \
73 65
 		--build="$(gcc -print-multiarch)" \
74 66
 		--enable-static_link \
75
-	&& make device-mapper \
76
-	&& make install_device-mapper
77
-# See https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL
67
+		--enable-pkgconfig \
68
+	&& make -C include \
69
+	&& make -C libdm install_device-mapper
78 70
 
79 71
 # Install seccomp: the version shipped upstream is too old
80 72
 ENV SECCOMP_VERSION 2.3.2
... ...
@@ -64,28 +64,20 @@ RUN set -x \
64 64
 	) \
65 65
 	&& rm -rf "$SECCOMP_PATH"
66 66
 
67
-# Get lvm2 source for compiling statically
68
-ENV LVM2_VERSION 2.02.103
67
+# Get lvm2 sources to build statically linked devmapper library
68
+ENV LVM2_VERSION 2.02.173
69 69
 RUN mkdir -p /usr/local/lvm2 \
70 70
 	&& curl -fsSL "https://mirrors.kernel.org/sourceware/lvm2/LVM2.${LVM2_VERSION}.tgz" \
71 71
 		| tar -xzC /usr/local/lvm2 --strip-components=1
72
-# See https://git.fedorahosted.org/cgit/lvm2.git/refs/tags for release tags
73 72
 
74
-# Fix platform enablement in lvm2 to support s390x properly
75
-RUN set -e \
76
-	&& for f in config.guess config.sub; do \
77
-		curl -fsSL -o "/usr/local/lvm2/autoconf/$f" "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=$f;hb=HEAD"; \
78
-	done
79
-# "arch.c:78:2: error: #error the arch code needs to know about your machine type"
80
-
81
-# Compile and install lvm2
73
+# Compile and install (only the needed library)
82 74
 RUN cd /usr/local/lvm2 \
83 75
 	&& ./configure \
84 76
 		--build="$(gcc -print-multiarch)" \
85 77
 		--enable-static_link \
86
-	&& make device-mapper \
87
-	&& make install_device-mapper
88
-# See https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL
78
+		--enable-pkgconfig \
79
+	&& make -C include \
80
+	&& make -C libdm install_device-mapper
89 81
 
90 82
 # IMPORTANT: When updating this please note that stdlib archive/tar pkg is vendored
91 83
 ENV GO_VERSION 1.8.3
... ...
@@ -130,7 +130,7 @@ fi
130 130
 # functionality.
131 131
 if \
132 132
 	command -v gcc &> /dev/null \
133
-	&& ! ( echo -e  '#include <libdevmapper.h>\nint main() { dm_task_deferred_remove(NULL); }'| gcc -xc - -o /dev/null -ldevmapper &> /dev/null ) \
133
+	&& ! ( echo -e  '#include <libdevmapper.h>\nint main() { dm_task_deferred_remove(NULL); }'| gcc -xc - -o /dev/null $(pkg-config --libs devmapper) &> /dev/null ) \
134 134
 ; then
135 135
 	DOCKER_BUILDTAGS+=' libdm_no_deferred_remove'
136 136
 fi
... ...
@@ -3,7 +3,6 @@
3 3
 package devicemapper
4 4
 
5 5
 /*
6
-#cgo LDFLAGS: -L. -ldevmapper
7 6
 #define _GNU_SOURCE
8 7
 #include <libdevmapper.h>
9 8
 #include <linux/fs.h>   // FIXME: present only for BLKGETSIZE64, maybe we can remove it?
... ...
@@ -2,10 +2,7 @@
2 2
 
3 3
 package devicemapper
4 4
 
5
-/*
6
-#cgo LDFLAGS: -L. -ldevmapper
7
-#include <libdevmapper.h>
8
-*/
5
+// #include <libdevmapper.h>
9 6
 import "C"
10 7
 
11 8
 // LibraryDeferredRemovalSupport tells if the feature is enabled in the build
12 9
new file mode 100644
... ...
@@ -0,0 +1,6 @@
0
+// +build linux,cgo,!static_build
1
+
2
+package devicemapper
3
+
4
+// #cgo pkg-config: devmapper
5
+import "C"
0 6
new file mode 100644
... ...
@@ -0,0 +1,6 @@
0
+// +build linux,cgo,static_build
1
+
2
+package devicemapper
3
+
4
+// #cgo pkg-config: --static devmapper
5
+import "C"