主要在kernel编译报错如下
n file included from xxx/kernel-4.19/init/version.c:9:
./include/generated/compile.h:7:24: warning: missing terminating '"' character [-Winvalid-pp-token]
#define LINUX_COMPILER "Android (6443078 based on r383902) clang version 11.0.1 (https://android.googlesource.com/toolchain/llvm-project b397f81060ce6d701042b782172ed13bee898b79)
^
./include/generated/compile.h:8:1: error: unknown type name 'Found'
Found CUDA installation: /usr/local/cuda, version 7.0, LLD 11.0.1 (/buildbot/tmp/tmp6_m7QH b397f81060ce6d701042b782172ed13bee898b79)"
^
./include/generated/compile.h:8:11: error: expected ';' after top level declarator
Found CUDA installation: /usr/local/cuda, version 7.0, LLD 11.0.1 (/buildbot/tmp/tmp6_m7QH b397f81060ce6d701042b782172ed13bee898b79)"
^
;
./include/generated/compile.h:8:133: warning: missing terminating '"' character [-Winvalid-pp-token]
Found CUDA installation: /usr/local/cuda, version 7.0, LLD 11.0.1 (/buildbot/tmp/tmp6_m7QH b397f81060ce6d701042b782172ed13bee898b79)"
。。。。。。
xxx/kernel-4.19/include/asm-generic/int-ll64.h:16:9: error: unknown type name '__s8'; did you mean '__u8'?
typedef __s8 s8;
^~~~
__u8
xxx/kernel-4.19/include/uapi/asm-generic/int-ll64.h:21:23: note: '__u8' declared here
typedef unsigned char __u8;
^
AS usr/initramfs_data.o
AR usr/built-in.a
CC arch/arm64/kernel/probes/kprobes.o
xxx/kernel-4.19/init/version.c:47:26: error: expected ';' after top level declarator
LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n";
^
;
xxx/kernel-4.19/init/version.c:55:6: error: expected ';' after top level declarator
" (" LINUX_COMPILER ") %s\n";
^
;
2 warnings and 5 errors generated.
这和编译环境没有关系,是因为生成中间h文件时读取系统信息里读取到了cuda的环境信息,导致内容多了一个回车,出现语法错误,详细信息可以直接看out目录下的./include/generated/compile.h,修改办法如下
位置在kernel目录下,直接把那个需要显示的信息干掉,这个信息主要是编译环境信息,理论对系统运行不会构成什么影响。
scripts/mkcompile_h
Index: scripts/mkcompile_h
===================================================================
--- scripts/mkcompile_h (版本 16555)
+++ scripts/mkcompile_h (工作副本)
@@ -76,7 +76,7 @@
CC_VERSION=$($CC -v 2>&1 | grep ' version ' | sed 's/[[:space:]]*$//')
LD_VERSION=$($LD -v | head -n1 | sed 's/(compatible with [^)]*)//' \
| sed 's/[[:space:]]*$//')
- printf '#define LINUX_COMPILER "%s"\n' "$CC_VERSION, $LD_VERSION"
+ printf '#define LINUX_COMPILER "%s"' # "$CC_VERSION, $LD_VERSION" # \n
) > .tmpcompile
# Only replace the real compile.h if the new one is different,