[CRIU] [V2 5/6] Android NDK: necessary Makefile changes

Dmitry Safonov 0x7f454c46 at gmail.com
Tue Apr 2 17:54:05 MSK 2019


On Tue, 2 Apr 2019 at 03:44, <ning.a.zhang at intel.com> wrote:
>
> From: Zhang Ning <ning.a.zhang at intel.com>
>
> 1, disable warning
>     -Wno-implicit-function-declaration
>         this is due to Android NDK missing index functin in strings.h,
>         it will report -Wimplicit-function-declaration error.
>         disable this warning to pass build, and your need to add
>         additional library which has index function to pass link.

I wonder if it's just one function, can we rather add an extern declaration
for it? I think, removing the warnings is a bit too big hammer here.
In my point of view, the flag is valuable as it results in cleaner includes
and also provides warning on compile-time rather than an error on linking.

> 2, do not hardcode libnl's cflags
>     when cross compile CRIU, libnl's header file should not point to host.
>
> 3, remove link to rt
>     Android NDK doesn't have library rt, and CRIU is not really need it,
>     so disable it to pass link

Agree on 2 and 3.

>
> Cc: Chen Hu <hu1.chen at intel.com>
> Signed-off-by: Zhang Ning <ning.a.zhang at intel.com>
> Reviewed-by: Cyrill Gorcunov <gorcunov at gmail.com>
> ---
>  Makefile               | 2 +-
>  criu/Makefile          | 2 +-
>  criu/Makefile.packages | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 38887da9..d5dae703 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -89,7 +89,7 @@ export PROTOUFIX DEFINES
>  DEFINES                        += -D_FILE_OFFSET_BITS=64
>  DEFINES                        += -D_GNU_SOURCE
>
> -WARNINGS               := -Wall -Wformat-security
> +WARNINGS               := -Wall -Wformat-security -Wno-implicit-function-declaration
>
>  CFLAGS-GCOV            := --coverage -fno-exceptions -fno-inline -fprofile-update=atomic
>  export CFLAGS-GCOV
> diff --git a/criu/Makefile b/criu/Makefile
> index bcfb7162..79787817 100644
> --- a/criu/Makefile
> +++ b/criu/Makefile
> @@ -26,7 +26,7 @@ ccflags-y             += -iquote include
>  ccflags-y              += -iquote images
>  ccflags-y              += -iquote $(ARCH_DIR)/include
>  ccflags-y              += -iquote .
> -ccflags-y              += -I/usr/include/libnl3
> +ccflags-y              += $(shell pkg-config --cflags libnl-3.0)
>  ccflags-y              += $(COMPEL_UAPI_INCLUDES)
>  ccflags-y              += $(CONFIG-DEFINES)
>
> diff --git a/criu/Makefile.packages b/criu/Makefile.packages
> index d828cb61..b01b4b04 100644
> --- a/criu/Makefile.packages
> +++ b/criu/Makefile.packages
> @@ -32,7 +32,7 @@ REQ-DEB-PKG-NAMES     += python-future
>  REQ-RPM-PKG-TEST-NAMES += $(PYTHON)-pyyaml
>  endif
>
> -export LIBS            += -lrt -lprotobuf-c -ldl -lnl-3 -lsoccr -Lsoccr/ -lnet
> +export LIBS            += -lprotobuf-c -ldl -lnl-3 -lsoccr -Lsoccr/ -lnet
>
>  check-packages-failed:
>         $(warning Can not find some of the required libraries)
> --
> 2.20.1
>
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu

Thanks,
             Dmitry


More information about the CRIU mailing list