2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 01:51:51 +00:00
criu/Documentation/HOWTO.cross-compile
Dmitry Safonov 434e6b92db Documentation: Add a hint about docker build
The original/old guide probably doesn't work anymore:
- the patch isn't accessible;
- criu now depends on more libraries not only protobuf

Still, keep it as it might be helpful for someone.

Signed-off-by: Dmitry Safonov <dima@arista.com>
Signed-off-by: Andrei Vagin <avagin@gmail.com>
2020-02-04 12:39:04 -08:00

46 lines
1.9 KiB
Plaintext

How to cross-compile CRIU on x86:
Use the Dockerfile provided:
scripts/build/Dockerfile.armv7-cross
Historical guide how-to do it without docker container:
[Unsupported, may not work anymore!]
1. Download the protobuf sources.
2. Apply the patch http://16918.selcdn.ru/crtools/aarch64/0001-protobuf-added-the-support-for-the-acrchitecture-AAr.patch
3. Configure protobuf to be compiled for the target architecture:
./configure --prefix=$X86_PREFIX --disable-shared --enable-static
4. Compile protobuf.
5. Download protobuf-c sources.
6. Configure protobuf-c for the architecture x86:
export PATH=$PATH:$X86_PREFIX/bin
export PKG_CONFIG_PATH=$X86_PREFIX/lib/pkgconfig
CPPFLAGS=`pkg-config --cflags protobuf` LDFLAGS=`pkg-config --libs protobuf` ./configure --prefix=$X86_PREFIX --disable-shared --enable-static
7. Compile and install protobuf-c.
8. Configure protobuf to be compiled for the target architecture:
./configure --prefix=$ARCH_PREFIX --disable-shared --enable-static --with-protoc=protoc --host=$TARGET
9. Compile and install protobuf.
10. Let PKG_CONFIG_PATH=$ARCH_PREFIX/lib/pkgconfig.
11. Configure protobuf-c to be compiled for the target architecture:
CPPFLAGS=`pkg-config --cflags protobuf` LDFLAGS=`pkg-config --libs protobuf` ./configure --prefix=$ARCH_PREFIX --disable-shared --enable-static --disable-protoc --host=$TARGET
12. Compile and install protobuf-c.
13. Compile CRIU:
ARCH=<target arch> CROSS_COMPILE=$TARGET- CFLAGS=`pkg-config --cflags libprotobuf-c` LDFLAGS="`pkg-config --libs libprotobuf-c`" make
Special notes for Android NDK cross compile:
1, Android NDK doesn't have some headers required by CRIU build, they are <aio.h>, <sys/fanotify.h>
2, Android NDK doesn't have some function required by CRIU build, they are aio*, fanotify_init, fanotify_mark, povit_root, index.
3, in order to pass build with Android NDK, you implement them yourself, and link them to CRIU.