[CRIU] [PATCH] criu: almost fix building on Alpine Linux

Ross Boucher rboucher at gmail.com
Fri Jul 1 05:38:45 PDT 2016


That did it, thanks.

On Fri, Jul 1, 2016 at 3:40 AM Andrew Vagin <avagin at virtuozzo.com> wrote:

> On Fri, Jul 01, 2016 at 12:15:49AM +0000, Ross Boucher wrote:
> > If I checkout your branch locally and try to build (e.g. make -C
> scripts/travis
> > alpine or make -C scripts/build alpine), I end up with a ton of errors.
> Am I
> > missing a step somewhere?
>
> It's strange. It works in travis:
> https://travis-ci.org/avagin/criu/jobs/141267097
>
> Did you checkout the alpine branch? You can try to execute
> "git clean -dxf" before make -C scripts/build alpine.
>
> Thanks,
> Andrew
>
> >
> > On Wed, Jun 29, 2016 at 8:36 PM Andrew Vagin <avagin at virtuozzo.com>
> wrote:
> >
> >
> >     Here is my five cents https://github.com/avagin/criu/commits/alpine
> >
> >     https://travis-ci.org/avagin/criu/jobs/141226345
> >
> >     On Tue, Jun 28, 2016 at 03:10:32PM +0200, Adrian Reber wrote:
> >     > From: Adrian Reber <areber at redhat.com>
> >     >
> >     > It seems that the different libc (musl) which Alpine Linux uses
> produces
> >     > different errors than the usual glibc. This patch fixes most
> include
> >     > errors. Two errors are not yet resolved on Alpine Linux's libc
> (musl):
> >     >
> >     >  * proc_parse.c: In function 'parse_posix_timers':
> >     >    proc_parse.c:2125:34: error: 'SIGEV_THREAD_ID' undeclared
> (first use
> >     in this function)
> >     >         timer->spt.it_sigev_notify = SIGEV_THREAD_ID;
> >     >
> >     >    proc_parse.c:2125:34: note: each undeclared identifier is
> reported
> >     only once for each function it appears in
> >     >
> >     >    Seems difficult to fix as including <linux/signal.h>, which
> provides
> >     >    this #define, generates more different error messages related to
> >     >    time.h and linux/time.h collisions. It is not yet clear if
> additional
> >     >    guards would help in the header files.
> >     >
> >     >  * fsnotify.c: In function 'open_by_handle':
> >     >    fsnotify.c:107:9: error: implicit declaration of function
> >     'open_by_handle_at' [-Werror=implicit-function-declaration]
> >     >      return open_by_handle_at(fd, arg, O_PATH);
> >     >
> >     >    The function open_by_handle_at() is not provided by Alpine
> Linux's
> >     >    libc (musl).
> >     >
> >     > This patch resolves the following errors/warnings and has been
> tested on
> >     > RHEL7(x86_64/powerpc64le) and Fedora 24:
> >     >
> >     > cr-service.c: In function 'cr_service':
> >     > cr-service.c:1082:26: error: passing argument 2 of 'accept' from
> >     incompatible pointer type [-Werror=incompatible-pointer-types]
> >     >    sk = accept(server_fd, &client_addr, &client_addr_len);
> >     >                         ^
> >     > In file included from /usr/include/fortify/sys/socket.h:20:0,
> >     >                  from cr-service.c:11:
> >     > /usr/include/sys/socket.h:301:5: note: expected 'struct sockaddr *
> >     restrict' but argument is of type 'struct sockaddr_un *'
> >     >  int accept (int, struct sockaddr *__restrict, socklen_t
> *__restrict);
> >     >      ^
> >     > cc1: all warnings being treated as errors
> >     >
> >     > files.c: In function 'open_transport_fd':
> >     > files.c:845:19: error: passing argument 2 of 'bind' from
> incompatible
> >     pointer type [-Werror=incompatible-pointer-types]
> >     >   ret = bind(sock, &saddr, sun_len);
> >     >                    ^
> >     > In file included from /usr/include/fortify/sys/socket.h:20:0,
> >     >                  from files.c:12:
> >     > /usr/include/sys/socket.h:298:5: note: expected 'const struct
> sockaddr *'
> >     but argument is of type 'struct sockaddr_un *'
> >     >  int bind (int, const struct sockaddr *, socklen_t);
> >     >      ^
> >     > cc1: all warnings being treated as errors
> >     >
> >     > In file included from fsnotify.c:18:0:
> >     > /usr/include/sys/poll.h:1:2: error: #warning redirecting incorrect
> #
> >     include <sys/poll.h> to <poll.h> [-Werror=cpp]
> >     >  #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
> >     >   ^
> >     > cc1: all warnings being treated as errors
> >     >
> >     > In file included from /root/criu/criu/include/timerfd.h:7:0,
> >     >                  from /root/criu/criu/include/restorer.h:18,
> >     >                  from arch/x86/crtools.c:16:
> >     > /root/criu/criu/include/files.h:43:14: error: field 'stat' has
> incomplete
> >     type
> >     >   struct stat stat;
> >     >
> >     > In file included from arch/x86/vdso-pie.c:6:0:
> >     > /root/criu/criu/include/syscall.h:22:66: error: unknown type name
> >     'loff_t'
> >     >  extern long sys_pread (unsigned int fd, char *buf, size_t count,
> loff_t
> >     pos) ;
> >     >                                                                   ^
> >     > /root/criu/criu/include/syscall.h:83:31: error: unknown type name
> >     'clockid_t'
> >     >  extern long sys_timer_create (clockid_t which_clock, struct
> sigevent
> >     *timer_event_spec, kernel_timer_t *created_timer_id
> >     >                                ^
> >     > /root/criu/criu/include/syscall.h:88:38: error: unknown type name
> >     'clockid_t'
> >     >  extern long sys_clock_gettime (const clockid_t which_clock, const
> struct
> >     timespec *tp) ;
> >     >                                       ^
> >     >
> >     > In file included from netfilter.c:5:0:
> >     > /usr/include/wait.h:1:2: error: #warning redirecting incorrect
> #include
> >     <wait.h> to <sys/wait.h> [-Werror=cpp]
> >     >  #warning redirecting incorrect #include <wait.h> to <sys/wait.h>
> >     >   ^
> >     > cc1: all warnings being treated as errors
> >     >
> >     > pie/restorer.c: In function '__export_restore_task':
> >     > pie/restorer.c:1276:23: error: 'LOCK_EX' undeclared (first use in
> this
> >     function)
> >     >    ret = sys_flock(fd, LOCK_EX);
> >     >                        ^
> >     > pie/restorer.c:1276:23: note: each undeclared identifier is
> reported only
> >     once for each function it appears in
> >     > pie/restorer.c:1310:23: error: 'LOCK_UN' undeclared (first use in
> this
> >     function)
> >     >    ret = sys_flock(fd, LOCK_UN);
> >     >                        ^
> >     >
> >     > sk-unix.c: In function 'open_unixsk_standalone':
> >     > sk-unix.c:1169:19: error: passing argument 2 of 'connect' from
> >     incompatible pointer type [-Werror=incompatible-pointer-types]
> >     >    if (connect(sk, &addr, sizeof(addr.sun_family))) {
> >     >                    ^
> >     > In file included from /usr/include/fortify/sys/socket.h:20:0,
> >     >                  from sk-unix.c:1:
> >     > /usr/include/sys/socket.h:299:5: note: expected 'const struct
> sockaddr *'
> >     but argument is of type 'struct sockaddr_un *'
> >     >  int connect (int, const struct sockaddr *, socklen_t);
> >     >      ^
> >     > cc1: all warnings being treated as errors
> >     >
> >     > c/criu.c: In function 'criu_local_set_parent_images':
> >     > c/criu.c:169:26: error: implicit declaration of function 'strdup'
> >     [-Werror=implicit-function-declaration]
> >     >   opts->rpc->parent_img = strdup(path);
> >     >
> >     > Signed-off-by: Adrian Reber <areber at redhat.com>
> >     > ---
> >     >  criu/cr-service.c            | 2 +-
> >     >  criu/files.c                 | 2 +-
> >     >  criu/fsnotify.c              | 2 +-
> >     >  criu/include/files.h         | 2 ++
> >     >  criu/include/syscall-types.h | 2 ++
> >     >  criu/netfilter.c             | 2 +-
> >     >  criu/pie/restorer.c          | 1 +
> >     >  criu/sk-unix.c               | 2 +-
> >     >  lib/c/criu.c                 | 1 +
> >     >  9 files changed, 11 insertions(+), 5 deletions(-)
> >     >
> >     > diff --git a/criu/cr-service.c b/criu/cr-service.c
> >     > index 64ab8b7..797d704 100644
> >     > --- a/criu/cr-service.c
> >     > +++ b/criu/cr-service.c
> >     > @@ -1103,7 +1103,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
> *)&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 719d0be..54d087c 100644
> >     > --- a/criu/files.c
> >     > +++ b/criu/files.c
> >     > @@ -910,7 +910,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, (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 5e3d6dc..e0b853d 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/netfilter.c b/criu/netfilter.c
> >     > index a105ed7..000f167 100644
> >     > --- a/criu/netfilter.c
> >     > +++ b/criu/netfilter.c
> >     > @@ -2,7 +2,7 @@
> >     >  #include <arpa/inet.h>
> >     >  #include <unistd.h>
> >     >  #include <string.h>
> >     > -#include <wait.h>
> >     > +#include <sys/wait.h>
> >     >  #include <stdlib.h>
> >     >
> >     >  #include "asm/types.h"
> >     > diff --git a/criu/pie/restorer.c b/criu/pie/restorer.c
> >     > index 5910fd0..0da167f 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>
> >     > diff --git a/criu/sk-unix.c b/criu/sk-unix.c
> >     > index ca6673e..5498718 100644
> >     > --- a/criu/sk-unix.c
> >     > +++ b/criu/sk-unix.c
> >     > @@ -1166,7 +1166,7 @@ static int open_unixsk_standalone(struct
> >     unix_sk_info *ui)
> >     >                * The below is hack: we use that connect with
> AF_UNSPEC
> >     >                * clears socket's peer.
> >     >                */
> >     > -             if (connect(sk, &addr, sizeof(addr.sun_family))) {
> >     > +             if (connect(sk, (struct sockaddr *)&addr, sizeof
> >     (addr.sun_family))) {
> >     >                       pr_perror("Can't clear socket's peer");
> >     >                       return -1;
> >     >               }
> >     > diff --git a/lib/c/criu.c b/lib/c/criu.c
> >     > index e75268c..5c65d9f 100644
> >     > --- a/lib/c/criu.c
> >     > +++ b/lib/c/criu.c
> >     > @@ -10,6 +10,7 @@
> >     >  #include <stdlib.h>
> >     >  #include <errno.h>
> >     >  #include <signal.h>
> >     > +#include <string.h>
> >     >
> >     >  #include "criu.h"
> >     >  #include "rpc.pb-c.h"
> >     > --
> >     > 2.7.4
> >     >
> >     > _______________________________________________
> >     > CRIU mailing list
> >     > CRIU at openvz.org
> >     > https://lists.openvz.org/mailman/listinfo/criu
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvz.org/pipermail/criu/attachments/20160701/10a76787/attachment-0001.html>


More information about the CRIU mailing list