[CRIU] alpine linux

Adrian Reber adrian at lisas.de
Mon Jun 27 05:27:09 PDT 2016


On Mon, Jun 27, 2016 at 12:48:00AM +0000, Ross Boucher wrote:
> If you want to try to reproduce what I'm seeing you can run this Dockerfile
> from the criu src directory:
> 
> FROM alpine:3.2
> 
> RUN apk update && apk add \
>                 build-base \
>                 protobuf-c-dev \
>                 protobuf-dev \
>                 python \
>                 libaio-dev \
>                 libcap-dev \
>                 libnl3-dev \
>                 pkgconfig
> 
> COPY . /criu
> WORKDIR /criu
> 
> RUN make clean && make -j $(nproc)
> 
> 
> On Sun, Jun 26, 2016 at 5:35 PM Ross Boucher <rboucher at gmail.com> wrote:
> 
> > Has anyone tried or succeeded in building CRIU on alpine linux? I'm not
> > able to get it to compile (error below but probably not that useful).
> >
> > -Ross
> >
> > /root/criu-2.3/criu/include/files.h:43:14: error: field 'stat' has
> > incomplete type
> >   struct stat stat;

Trying to build CRIU in LXC alpine container I can get further than you
by adding additional includes and casts but it later fails in fsnotify.c
where CRIU wants to use the syscall open_by_handle_at() which does not
exist in alpine's libc (musl).

So at least open_by_handle_at() support must be added to musl to
continue.

See my diff to get this far. Not sure how useful it would be to submit
this as a real patch to CRIU.

		Adrian



diff --git a/criu/cr-service.c b/criu/cr-service.c
index 219a986..3634022 100644
--- a/criu/cr-service.c
+++ b/criu/cr-service.c
@@ -1079,7 +1079,7 @@ int cr_service(bool daemon_mode)
 
 		pr_info("Waiting for connection...\n");
 
-		sk = accept(server_fd, &client_addr, &client_addr_len);
+		sk = accept(server_fd, (struct sockaddr * restrict)&client_addr, &client_addr_len);
 		if (sk == -1) {
 			pr_perror("Can't accept connection");
 			goto err;
diff --git a/criu/files.c b/criu/files.c
index a3bc78e..eb4810b 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -842,7 +842,7 @@ static int open_transport_fd(int pid, struct fdinfo_list_entry *fle)
 		pr_perror("Can't create socket");
 		return -1;
 	}
-	ret = bind(sock, &saddr, sun_len);
+	ret = bind(sock, (const struct sockaddr *)&saddr, sun_len);
 	if (ret < 0) {
 		pr_perror("Can't bind unix socket %s", saddr.sun_path + 1);
 		goto err;
diff --git a/criu/fsnotify.c b/criu/fsnotify.c
index 4035506..aafffae 100644
--- a/criu/fsnotify.c
+++ b/criu/fsnotify.c
@@ -15,7 +15,7 @@
 #include <sys/vfs.h>
 #include <linux/magic.h>
 #include <sys/wait.h>
-#include <sys/poll.h>
+#include <poll.h>
 #include <sys/mman.h>
 #include <sys/mount.h>
 #include <aio.h>
diff --git a/criu/include/files.h b/criu/include/files.h
index a48ce96..1824964 100644
--- a/criu/include/files.h
+++ b/criu/include/files.h
@@ -1,6 +1,8 @@
 #ifndef __CR_FILES_H__
 #define __CR_FILES_H__
 
+#include <sys/stat.h>
+
 #include "compiler.h"
 #include "asm/types.h"
 #include "fcntl.h"
diff --git a/criu/include/syscall-types.h b/criu/include/syscall-types.h
index 49798fa..db0dbc0 100644
--- a/criu/include/syscall-types.h
+++ b/criu/include/syscall-types.h
@@ -11,6 +11,8 @@
 #include <sys/time.h>
 #include <arpa/inet.h>
 #include <sched.h>
+#include <time.h>
+#include <fcntl.h>
 
 #include "asm/types.h"
 
diff --git a/criu/pie/restorer.c b/criu/pie/restorer.c
index 24dd58b..793f547 100644
--- a/criu/pie/restorer.c
+++ b/criu/pie/restorer.c
@@ -6,6 +6,7 @@
 #include <linux/aio_abi.h>
 #include <sys/types.h>
 #include <sys/mman.h>
+#include <sys/file.h>
 #include <sys/stat.h>
 #include <sys/wait.h>
 #include <sys/time.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 811 bytes
Desc: not available
URL: <http://lists.openvz.org/pipermail/criu/attachments/20160627/5ec86c14/attachment.sig>


More information about the CRIU mailing list