第一步:(40条消息) 在ubuntu20.04下配置android P源码编译环境_m0_46702738的博客-优快云博客
第二步:
(40条消息) Ubuntu20 android编译环境踩坑日记 -- kernel_幻界的博客-优快云博客
第三步:
如果遇到前面没有提到的错误,可能是由于错误的把kernel 的 include下面的 linux文件夹导入到 /usr/include/x86_64-linux-gnu 下导致的,网上很多文章会用这种方法解决一些问题,但是会引入新的问题。类似如下:
/usr/include/x86_64-linux-gnu/linux/stddef.h:11:2: error: expected identifier
false = 0,
^
/usr/include/x86_64-linux-gnu/linux/stddef.h:12:2: error: expected identifier
true = 1
^
In file included from VfrUtilityLib.cpp:18:
In file included from ../Common/CommonLib.h:173:
In file included from /usr/include/x86_64-linux-gnu/sys/stat.h:446:
In file included from /usr/include/x86_64-linux-gnu/bits/statx.h:31:
In file included from /usr/include/x86_64-linux-gnu/linux/stat.h:19:
In file included from /usr/include/x86_64-linux-gnu/linux/time.h:5:
/usr/include/x86_64-linux-gnu/linux/cache.h:6:10: fatal error: 'asm/cache.h' file not found
#include <asm/cache.h>
^~~~~~~~~~~~~
7 errors generated.
make[3]: *** [<内置>:VfrUtilityLib.o] 错误 1
解决方法是删除下载的代码,重新编译。原因是在一些文件夹下面有编译中间文件,需要删除,清除中间文件后重新编译,应该就ok了。