[2/2] change Makefile in order to pass build under Android NDK

Submitted by Zhang, Ning A on April 1, 2019, 3:18 a.m.

Details

Message ID 20190401031831.18675-3-ning.a.zhang@intel.com
State New
Series "another fixes for build under Android NDK"
Headers show

Commit Message

Zhang, Ning A April 1, 2019, 3:18 a.m.
From: Zhang Ning <ning.a.zhang@intel.com>

1, disable some warning
2, do not hardcode libnl's cflags
3, remove link to rt

Cc: Chen Hu <hu1.chen@intel.com>
Signed-off-by: Zhang Ning <ning.a.zhang@intel.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..2ee46e3a 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 -Wno-macro-redefined
 
 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 1, 2019, 6:39 p.m.
Hi Zhang,

On 4/1/19 4:18 AM, ning.a.zhang@intel.com wrote:
> From: Zhang Ning <ning.a.zhang@intel.com>
> 
> 1, disable some warning
> 2, do not hardcode libnl's cflags
> 3, remove link to rt
> 
> Cc: Chen Hu <hu1.chen@intel.com>
> Signed-off-by: Zhang Ning <ning.a.zhang@intel.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..2ee46e3a 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 -Wno-macro-redefined

Looking at man(gcc):
: -Wimplicit-function-declaration (C and Objective-C only)
:      Give a warning whenever a function is used before being declared.

I wonder if we have those hits.. Do you observe many of them?
I believe they are against code style (imho), could we rather fix them
(if the amount is not hundreds)?

And for "-Wno-macro-redefined" - it seems to be clang-specific flag..
Could you tell why it's needed? (IOW, what does it fix?)
Have you checked that compilation is giving you more warnings with gcc?
On my machine compiling random source with the flag gives me:
: At global scope:
: cc1plus: warning: unrecognized command line option ‘-Wno-macro-redefined

Thanks,
          Dmitry
Dmitry Safonov April 1, 2019, 7:55 p.m.
On 4/1/19 7:39 PM, Dmitry Safonov wrote:
> Hi Zhang,
> 
> On 4/1/19 4:18 AM, ning.a.zhang@intel.com wrote:
>> From: Zhang Ning <ning.a.zhang@intel.com>
>>
>> 1, disable some warning
>> 2, do not hardcode libnl's cflags
>> 3, remove link to rt
>>
>> Cc: Chen Hu <hu1.chen@intel.com>
>> Signed-off-by: Zhang Ning <ning.a.zhang@intel.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..2ee46e3a 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 -Wno-macro-redefined
> 
> Looking at man(gcc):
> : -Wimplicit-function-declaration (C and Objective-C only)
> :      Give a warning whenever a function is used before being declared.
> 
> I wonder if we have those hits.. Do you observe many of them?
> I believe they are against code style (imho), could we rather fix them
> (if the amount is not hundreds)?
> 
> And for "-Wno-macro-redefined" - it seems to be clang-specific flag..
> Could you tell why it's needed? (IOW, what does it fix?)
> Have you checked that compilation is giving you more warnings with gcc?


> On my machine compiling random source with the flag gives me:
> : At global scope:
> : cc1plus: warning: unrecognized command line option ‘-Wno-macro-redefined

Actually, I mistakenly did gcc over .cpp file and it's used g++.
For .c it ignores the option.
But details why the option added - are needed to justify the patch.

Thanks,
          Dmitry