lkml.org 
[lkml]   [2021]   [Dec]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] Fix compilation errors when using special directory
Date
From: xu xin <xu.xin16@zte.com.cn>

When we compile the kernel with cross compilers, if CROSS_COMPILE is
specified by the path containing special directory like '~', some
compilation error will occurs.

Here's an example:

$ make ARCH=x86_64
CROSS_COMPILE=~/x86_64_gcc9.2.0_glibc2.31.0/bin/x86_64-pc-linux-gnu- all

error:./scripts/mkcompile_h: line 64:
~/x86_64_gcc9.2.0_glibc2.31.0/bin/x86_64-pc-linux-gnu-ld: No such file or
directory

Since there are many other similar scripts using these variables, in
order to solve the problem from the source, add realpath in makefile to
turn these variables into absolute paths.

Signed-off-by: xu xin <xu.xin16@zte.com.cn>
---
Makefile | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index fe5a4d8e4ac5..cdbb747787ac 100644
--- a/Makefile
+++ b/Makefile
@@ -459,14 +459,14 @@ OBJDUMP = llvm-objdump
READELF = llvm-readelf
STRIP = llvm-strip
else
-CC = $(CROSS_COMPILE)gcc
-LD = $(CROSS_COMPILE)ld
-AR = $(CROSS_COMPILE)ar
-NM = $(CROSS_COMPILE)nm
-OBJCOPY = $(CROSS_COMPILE)objcopy
-OBJDUMP = $(CROSS_COMPILE)objdump
-READELF = $(CROSS_COMPILE)readelf
-STRIP = $(CROSS_COMPILE)strip
+CC = $(realpath $(CROSS_COMPILE))gcc
+LD = $(realpath $(CROSS_COMPILE))ld
+AR = $(realpath $(CROSS_COMPILE))ar
+NM = $(realpath $(CROSS_COMPILE))nm
+OBJCOPY = $(realpath $(CROSS_COMPILE))objcopy
+OBJDUMP = $(realpath $(CROSS_COMPILE))objdump
+READELF = $(realpath $(CROSS_COMPILE))readelf
+STRIP = $(realpath $(CROSS_COMPILE))strip
endif
RUSTC = rustc
RUSTDOC = rustdoc
--
2.25.1
\
 
 \ /
  Last update: 2021-12-31 08:57    [W:0.037 / U:2.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site