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

Submitted by Zhang, Ning A on April 2, 2019, 2:43 a.m.

Details

Message ID 20190402024304.9899-6-ning.a.zhang@intel.com
State New
Series "patches for build CRIU with Android NDK"
Headers show

Commit Message

Zhang, Ning A April 2, 2019, 2:43 a.m.
From: Zhang Ning <ning.a.zhang@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.

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

Cc: Chen Hu <hu1.chen@intel.com>
Signed-off-by: Zhang Ning <ning.a.zhang@intel.com>
Reviewed-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 Makefile               | 2 +-
 criu/Makefile          | 2 +-
 criu/Makefile.packages | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

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)

Comments

Dmitry Safonov April 2, 2019, 2:54 p.m.
On Tue, 2 Apr 2019 at 03:44, <ning.a.zhang@intel.com> wrote:
>
> From: Zhang Ning <ning.a.zhang@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@intel.com>
> Signed-off-by: Zhang Ning <ning.a.zhang@intel.com>
> Reviewed-by: Cyrill Gorcunov <gorcunov@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@openvz.org
> https://lists.openvz.org/mailman/listinfo/criu

Thanks,
             Dmitry
Zhang, Ning A April 4, 2019, 2:22 a.m.
From: Zhang Ning <ning.a.zhang@intel.com>

Hi, all

Previous patches I added -Wno-macro-redefined and -Wno-implicit-function-declaration,
in CRIU Makefile or build script to supress error reported by Android NDK/Clang.
this is wrong, pointed out by Dmitry, Thank you.

Thus two new patches are added.

Change log:
remove -Wno-implicit-function-declaration.
add ifndef check for UNIX_PATH_MAX to avoid -Wno-macro-redefined.
add index function declare.
add notes for Android NDK cross compile.

Zhang Ning (4):
  Android NDK: necessary Makefile changes
  Android NDK: UNIX_PATH_MAX is defined in un.h
  Android NDK: no index function in strings.h
  Add notes for Android NDK cross compile

 Documentation/HOWTO.cross-compile | 8 ++++++++
 compel/src/lib/infect.c           | 2 ++
 criu/Makefile                     | 2 +-
 criu/Makefile.packages            | 2 +-
 criu/config.c                     | 2 ++
 criu/include/util-pie.h           | 2 ++
 6 files changed, 16 insertions(+), 2 deletions(-)
Dmitry Safonov April 4, 2019, 3:28 p.m.
On 4/4/19 3:22 AM, ning.a.zhang@intel.com wrote:
> From: Zhang Ning <ning.a.zhang@intel.com>
> 
> Hi, all
> 
> Previous patches I added -Wno-macro-redefined and -Wno-implicit-function-declaration,
> in CRIU Makefile or build script to supress error reported by Android NDK/Clang.
> this is wrong, pointed out by Dmitry, Thank you.
> 
> Thus two new patches are added.
> 
> Change log:
> remove -Wno-implicit-function-declaration.
> add ifndef check for UNIX_PATH_MAX to avoid -Wno-macro-redefined.
> add index function declare.
> add notes for Android NDK cross compile.
> 
> Zhang Ning (4):
>   Android NDK: necessary Makefile changes
>   Android NDK: UNIX_PATH_MAX is defined in un.h
>   Android NDK: no index function in strings.h
>   Add notes for Android NDK cross compile

Thanks for the patches,

Reviewed-by: Dmitry Safonov <0x7f454c46@gmail.com>
Andrei Vagin April 5, 2019, 5:50 a.m.
Applied, thanks!

On Thu, Apr 04, 2019 at 10:22:28AM +0800, ning.a.zhang@intel.com wrote:
> From: Zhang Ning <ning.a.zhang@intel.com>
> 
> Hi, all
> 
> Previous patches I added -Wno-macro-redefined and -Wno-implicit-function-declaration,
> in CRIU Makefile or build script to supress error reported by Android NDK/Clang.
> this is wrong, pointed out by Dmitry, Thank you.
> 
> Thus two new patches are added.
> 
> Change log:
> remove -Wno-implicit-function-declaration.
> add ifndef check for UNIX_PATH_MAX to avoid -Wno-macro-redefined.
> add index function declare.
> add notes for Android NDK cross compile.
> 
> Zhang Ning (4):
>   Android NDK: necessary Makefile changes
>   Android NDK: UNIX_PATH_MAX is defined in un.h
>   Android NDK: no index function in strings.h
>   Add notes for Android NDK cross compile
> 
>  Documentation/HOWTO.cross-compile | 8 ++++++++
>  compel/src/lib/infect.c           | 2 ++
>  criu/Makefile                     | 2 +-
>  criu/Makefile.packages            | 2 +-
>  criu/config.c                     | 2 ++
>  criu/include/util-pie.h           | 2 ++
>  6 files changed, 16 insertions(+), 2 deletions(-)
> 
> -- 
> 2.20.1
> 
> _______________________________________________
> CRIU mailing list
> CRIU@openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
Zhang, Ning A April 8, 2019, 1:22 a.m.
Hi, 

Thanks for merge my patches, but this V3 patches are partial update for
V2. it only updates patch 5 of V2 patches set.

How about rest 5 patches in patches set V2? do I need to send V4?

V2 patches set: https://lists.openvz.org/pipermail/criu/2019-April/0436
97.html
unmerged patches from V2:
https://lists.openvz.org/pipermail/criu/2019-April/043698.html
https://lists.openvz.org/pipermail/criu/2019-April/043699.html
https://lists.openvz.org/pipermail/criu/2019-April/043701.html
https://lists.openvz.org/pipermail/criu/2019-April/043700.html
https://lists.openvz.org/pipermail/criu/2019-April/043702.html

BR.
Ning.


在 2019-04-04四的 22:50 -0700,Andrei Vagin写道:
> Applied, thanks!
> 
> On Thu, Apr 04, 2019 at 10:22:28AM +0800, ning.a.zhang@intel.com
> wrote:
> > From: Zhang Ning <ning.a.zhang@intel.com>
> > 
> > Hi, all
> > 
> > Previous patches I added -Wno-macro-redefined and -Wno-implicit-
> > function-declaration,
> > in CRIU Makefile or build script to supress error reported by
> > Android NDK/Clang.
> > this is wrong, pointed out by Dmitry, Thank you.
> > 
> > Thus two new patches are added.
> > 
> > Change log:
> > remove -Wno-implicit-function-declaration.
> > add ifndef check for UNIX_PATH_MAX to avoid -Wno-macro-redefined.
> > add index function declare.
> > add notes for Android NDK cross compile.
> > 
> > Zhang Ning (4):
> >   Android NDK: necessary Makefile changes
> >   Android NDK: UNIX_PATH_MAX is defined in un.h
> >   Android NDK: no index function in strings.h
> >   Add notes for Android NDK cross compile
> > 
> >  Documentation/HOWTO.cross-compile | 8 ++++++++
> >  compel/src/lib/infect.c           | 2 ++
> >  criu/Makefile                     | 2 +-
> >  criu/Makefile.packages            | 2 +-
> >  criu/config.c                     | 2 ++
> >  criu/include/util-pie.h           | 2 ++
> >  6 files changed, 16 insertions(+), 2 deletions(-)
> > 
> > -- 
> > 2.20.1
> > 
> > _______________________________________________
> > CRIU mailing list
> > CRIU@openvz.org
> > https://lists.openvz.org/mailman/listinfo/criu
>
Andrei Vagin April 8, 2019, 6:11 p.m.
On Sun, Apr 7, 2019 at 6:22 PM Zhang, Ning A <ning.a.zhang@intel.com> wrote:
>
> Hi,
>
> Thanks for merge my patches, but this V3 patches are partial update for
> V2. it only updates patch 5 of V2 patches set.
>
> How about rest 5 patches in patches set V2? do I need to send V4?

Pls send v4. It will be easier. Thanks!

>
> V2 patches set: https://lists.openvz.org/pipermail/criu/2019-April/0436
> 97.html
> unmerged patches from V2:
> https://lists.openvz.org/pipermail/criu/2019-April/043698.html
> https://lists.openvz.org/pipermail/criu/2019-April/043699.html
> https://lists.openvz.org/pipermail/criu/2019-April/043701.html
> https://lists.openvz.org/pipermail/criu/2019-April/043700.html
> https://lists.openvz.org/pipermail/criu/2019-April/043702.html
>
> BR.
> Ning.
>
>
> 在 2019-04-04四的 22:50 -0700,Andrei Vagin写道:
> > Applied, thanks!
> >
> > On Thu, Apr 04, 2019 at 10:22:28AM +0800, ning.a.zhang@intel.com
> > wrote:
> > > From: Zhang Ning <ning.a.zhang@intel.com>
> > >
> > > Hi, all
> > >
> > > Previous patches I added -Wno-macro-redefined and -Wno-implicit-
> > > function-declaration,
> > > in CRIU Makefile or build script to supress error reported by
> > > Android NDK/Clang.
> > > this is wrong, pointed out by Dmitry, Thank you.
> > >
> > > Thus two new patches are added.
> > >
> > > Change log:
> > > remove -Wno-implicit-function-declaration.
> > > add ifndef check for UNIX_PATH_MAX to avoid -Wno-macro-redefined.
> > > add index function declare.
> > > add notes for Android NDK cross compile.
> > >
> > > Zhang Ning (4):
> > >   Android NDK: necessary Makefile changes
> > >   Android NDK: UNIX_PATH_MAX is defined in un.h
> > >   Android NDK: no index function in strings.h
> > >   Add notes for Android NDK cross compile
> > >
> > >  Documentation/HOWTO.cross-compile | 8 ++++++++
> > >  compel/src/lib/infect.c           | 2 ++
> > >  criu/Makefile                     | 2 +-
> > >  criu/Makefile.packages            | 2 +-
> > >  criu/config.c                     | 2 ++
> > >  criu/include/util-pie.h           | 2 ++
> > >  6 files changed, 16 insertions(+), 2 deletions(-)
> > >
> > > --
> > > 2.20.1
> > >
> > > _______________________________________________
> > > CRIU mailing list
> > > CRIU@openvz.org
> > > https://lists.openvz.org/mailman/listinfo/criu
> >