[CRIU] Android cross-compilation

Pavel Emelyanov xemul at virtuozzo.com
Fri Sep 22 11:33:27 MSK 2017


On 09/21/2017 12:04 AM, Domenico Iezzi wrote:
> Hi everyone,
> 
> I want to ask you if it's possible to cross-compile criu for android 
> (arm-linux-androideabi).

We're not aware if anyone tried to :)

> I am trying to cross-compile it with the android ndk, following the 
> instructions both on the wiki and on github. For the ndk, I'm using the 
> script 'make_standalone_toolchain.sh' inside the build/tools folder, 
> which prepares an environment similar to the linaro toolchain, but the 
> compilation results in some errors related to redefined or non-existant 
> variables, like this:
> 
>    CC       compel/plugins/std/std.o
>    CC       compel/plugins/std/fds.o
> In file included from compel/plugins/std/fds.c:10:0:
> include/common/compiler.h:25:0: error: "__section" redefined [-Werror]
>   #define __section(S)  __attribute__ ((__section__(#S)))
>   ^
> In file included from /build/cross/sysroot/usr/include/errno.h:31:0,
>                   from compel/plugins/std/fds.c:1:
> /build/cross/sysroot/usr/include/sys/cdefs.h:209:0: note: this is the 
> location of the previous definition
>   #define __section(x) __attribute__((__section__(x)))
>   ^
> In file included from compel/plugins/std/fds.c:10:0:
> include/common/compiler.h:42:0: error: "__aligned" redefined [-Werror]
>   #define __aligned(x)  __attribute__((aligned(x)))
>   ^
> In file included from /build/cross/sysroot/usr/include/errno.h:31:0,
>                   from compel/plugins/std/fds.c:1:
> /build/cross/sysroot/usr/include/sys/cdefs.h:208:0: note: this is the 
> location of the previous definition
>   #define __aligned(x) __attribute__((__aligned__(x)))
>   ^
> cc1: all warnings being treated as errors
> make[1]: *** [compel/plugins/std/fds.o] Error 1
> make: *** [compel/plugins/std.lib.a] Error 2
> make: *** Waiting for unfinished jobs....
>    PBCC     images/autofs.pb-c.c
> 
> Can you point me in the right direction? Here [0] are the file I use to 
> cross-compile.

Well, I guess some work is to be done to make criu compile on android. If
you're ready, we can walk this way with you :)

In particular, the above errors are purely about re-defining the stuff, that
is standard for android. Just wrap them right in the criu code with ifndef-s
and we'll merge this patch.

> Many thanks
> 
> Domenico Iezzi
> 
> [0] https://github.com/NoMore201/criu-android-build
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
> .
> 



More information about the CRIU mailing list