Ubuntu20 android编译环境踩坑日记 -- kernel

Ubuntu20 android编译环境踩坑日记 – kernel

ubuntu20 最新的kernel版本

$ cat /proc/version
Linux version 5.4.0-42-generic (buildd@lgw01-amd64-038) (gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)) #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020

在编译 android Q 的kernel4-19 的时候,会提示找不到 <linux/compiler_types.h> 头文件.
该头文件的引用关系:

/usr/include/sys/stat.h --> /usr/include/bits/statx.h --> linux/stat.h(android工程里的) --> linux/types.h --> linux/posix_types.h --> linux/stddef.h --> linux/compiler_types.h

但是在kernel-4.19的uapi/linux 下没有这个文件.对比 ubuntu14 的 stat.h 文件,发现没有 include statx.h,因此我们怀疑是 ubuntu20 的 kernel 版本号太高导致,如果不想对主机的kernel进行降级,那么可以在 /usr/include/sys/stat.h 中注释调 statx.h 来规避问题.

// /usr/include/sys/stat.h
/*#ifdef __USE_GNU
# include <bits/statx.h>
#endif*/

猜你喜欢

转载自blog.csdn.net/qq_40211991/article/details/108094822