Android13 开发学习2—编译问题记录

2 篇文章 0 订阅
1 篇文章 0 订阅

一、未安装fdtget

报错信息

./scripts/fit-core.sh: 行 615: fdtget: 未找到命令
Build uboot failed!

解决方法:重新安装fdtget

user@mac:~/Android$ sudo apt install device-tree-compiler

二、没有lz4

报错信息

LZ4C    arch/arm64/boot/Image.lz4
/bin/sh: 1: lz4: not found

解决方法:拷贝lz4到、/bin/sh 目录下

user@mac:~/Android$ ls /usr/bin/lz4 -l
-rwxr-xr-x 1 root root 1042096 7月  25 18:05 /usr/bin/lz4*

user@mac:~/Android$ 

三、实体内存不足16GB

报错信息

14:41:24 ************************************************************
14:41:24 You are building on a machine with 9.73GB of RAM
14:41:24 
14:41:24 The minimum required amount of free memory is around 16GB,
14:41:24 and even with that, some configurations may not work.
14:41:24 
14:41:24 If you run into segfaults or other errors, try reducing your
14:41:24 -j value.
14:41:24 ************************************************************
……………………(中间省略)
Killed
14:43:13 soong bootstrap failed with: exit status 1
ninja: build stopped: subcommand failed.

#### failed to build some targets (01:57 (mm:ss)) ####

user@mac:~/Android$ 

解决方法: 日志已经告诉:所需的最低可用内存量约为16GB所以修改虚拟机实体内存到16GB以上。

四、不能使用root账户编译

报错信息

build/make/core/dex_preopt_config.mk:159: error: fopen failed.
17:46:00 dumpvars failed with: exit status 1

#### failed to build some targets (1 seconds) ####

root@mac:/home/user/Android/# 

五、ninja编译时间很长且报错

报错信息

analyzing Android.bp files and generating ninja file at out/soong/build.ninja
FAILED: out/soong/build.ninja
……………………(中间省略)
Killed
12:25:51 soong bootstrap failed with: exit status 1
ninja: build stopped: subcommand failed.

#### failed to build some targets (03:16 (mm:ss)) ####

Build android failed!
user@mac:~/Android$ 

解决方法:扩展swap内存到20G以上解决。

#创建swapfile文件
user@mac:~$ sudo dd if=/dev/zero of=swapfile bs=1G count=20
记录了20+0 的读入
记录了20+0 的写出
21474836480 bytes (21 GB, 20 GiB) copied, 56.2701 s, 382 MB/s

#修改文件权限为600
user@mac:~$ sudo chmod 600 swapfile

#激活swap空间
user@mac:~$ sudo mkswap swapfile
正在设置交换空间版本 1,大小 = 20 GiB (21474832384  个字节)
无标签, UUID=ffbb9944-b150-4a3b-96e1-5f9407ad902e

#开启swap空间
user@mac:~$ sudo swapon swapfile
#开启前后对比
ak@mac:~$ free -h 
              总计         已用        空闲      共享    缓冲/缓存    可用
内存:         17G        7.3G        1.2G         76M        9.1G        9.9G
交换:        947M          0B        947M
ak@mac:~$ free -h
              总计         已用        空闲      共享    缓冲/缓存    可用
内存:         17G        7.3G        1.2G         76M        9.1G        9.9G
交换:         20G          0B         20G
#设置开机启动
#在/etc/fstab文件里添加语句
/swapfile	swap	swap	defaults	0	0
  • 3
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值