[V2,6/6] tools.mk: support override CC/LD command line

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

Details

Message ID 20190402024304.9899-7-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>

due to Android NDK's clang is x86_64-linux-android28-clang --sysroot ${SYSROOT_PATH}
and it's ld is x86_64-linux-android-ld,
it's not able to use a single pattern to discript clang and ld.

and there is a error for x86_64-linux-android-ld.
x86_64-linux-android-ld  -L/home/ning/source/criu/protobuf-c/../target/lib -lprotobuf-c -r -z noexecstack -T ./compel/arch/x86/scripts/compel-pack.lds.S  -o criu/pie/parasite.built-in.o  criu/pie/parasite.o criu/pie/pie.lib.a ./compel/plugins/std.lib.a
./compel/compel-host hgen -f criu/pie/parasite.built-in.o -o criu/pie/parasite-blob.h
Error (compel/src/lib/handle-elf-host.c:335): Unexpected undefined symbol: `'. External symbol in PIE?
criu/pie/Makefile:49: recipe for target 'criu/pie/parasite-blob.h' failed

rebuild with host ld, can pass build.

so support override CC/LD from command line can pass build.

Cc: Chen Hu <hu1.chen@intel.com>
Signed-off-by: Zhang Ning <ning.a.zhang@intel.com>
---
 scripts/nmk/scripts/tools.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/scripts/nmk/scripts/tools.mk b/scripts/nmk/scripts/tools.mk
index 485fe9f2..d756358d 100644
--- a/scripts/nmk/scripts/tools.mk
+++ b/scripts/nmk/scripts/tools.mk
@@ -4,9 +4,9 @@  ifndef ____nmk_defined__tools
 # System tools shorthands
 RM		:= rm -f
 HOSTLD		?= ld
-LD		:= $(CROSS_COMPILE)$(HOSTLD)
+LD		?= $(CROSS_COMPILE)$(HOSTLD)
 HOSTCC		?= gcc
-CC		:= $(CROSS_COMPILE)$(HOSTCC)
+CC		?= $(CROSS_COMPILE)$(HOSTCC)
 CPP		:= $(CC) -E
 AS		:= $(CROSS_COMPILE)as
 AR		:= $(CROSS_COMPILE)ar

Comments

Dmitry Safonov April 2, 2019, 2:56 p.m.
On Tue, 2 Apr 2019 at 03:44, <ning.a.zhang@intel.com> wrote:
>
> From: Zhang Ning <ning.a.zhang@intel.com>
>
> due to Android NDK's clang is x86_64-linux-android28-clang --sysroot ${SYSROOT_PATH}
> and it's ld is x86_64-linux-android-ld,
> it's not able to use a single pattern to discript clang and ld.
>
> and there is a error for x86_64-linux-android-ld.
> x86_64-linux-android-ld  -L/home/ning/source/criu/protobuf-c/../target/lib -lprotobuf-c -r -z noexecstack -T ./compel/arch/x86/scripts/compel-pack.lds.S  -o criu/pie/parasite.built-in.o  criu/pie/parasite.o criu/pie/pie.lib.a ./compel/plugins/std.lib.a
> ./compel/compel-host hgen -f criu/pie/parasite.built-in.o -o criu/pie/parasite-blob.h
> Error (compel/src/lib/handle-elf-host.c:335): Unexpected undefined symbol: `'. External symbol in PIE?
> criu/pie/Makefile:49: recipe for target 'criu/pie/parasite-blob.h' failed
>
> rebuild with host ld, can pass build.
>
> so support override CC/LD from command line can pass build.
>
> Cc: Chen Hu <hu1.chen@intel.com>
> Signed-off-by: Zhang Ning <ning.a.zhang@intel.com>

LGTM,
Reviewed-by: Dmitry Safonov <0x7f454c46@gmail.com>

> ---
>  scripts/nmk/scripts/tools.mk | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/nmk/scripts/tools.mk b/scripts/nmk/scripts/tools.mk
> index 485fe9f2..d756358d 100644
> --- a/scripts/nmk/scripts/tools.mk
> +++ b/scripts/nmk/scripts/tools.mk
> @@ -4,9 +4,9 @@ ifndef ____nmk_defined__tools
>  # System tools shorthands
>  RM             := rm -f
>  HOSTLD         ?= ld
> -LD             := $(CROSS_COMPILE)$(HOSTLD)
> +LD             ?= $(CROSS_COMPILE)$(HOSTLD)
>  HOSTCC         ?= gcc
> -CC             := $(CROSS_COMPILE)$(HOSTCC)
> +CC             ?= $(CROSS_COMPILE)$(HOSTCC)
>  CPP            := $(CC) -E
>  AS             := $(CROSS_COMPILE)as
>  AR             := $(CROSS_COMPILE)ar
> --
> 2.20.1
>
> _______________________________________________
> CRIU mailing list
> CRIU@openvz.org
> https://lists.openvz.org/mailman/listinfo/criu

Thanks,
             Dmitry