有关编译嵌入式android的swap空间不够导致的编译错误和解决办法

由于android包括了java的很大一部分组成,而嵌入式开发,编译往往需要考虑内存的多少,而且,很多时候,连开发工具本身也是虚拟机,这就造成编译出现很多问题.

系统; vmware(ubuntu14 + arma9)


1 解决办法:

1.1 确定ubuntu环境

• 内存设置至少为1.5 G

• 设置交换内存至少为3G

1.2 设置swap内存 

先看看swap大小:
work01@ubuntu:~$ free -m
             total       used       free     shared    buffers     cached
Mem:          1994       1917         77          7         16       1382
-/+ buffers/cache:        517       1477
Swap:         1020          0       1020

执行如下命令设置swap 内存:

在路径/下,设置名为swp的文件

sudo dd if=/dev/zero of=/swp bs=10M count=300

300+0 records in
300+0 records out
3145728000 bytes (3.1 GB) copied, 92.7942 s, 33.9 MB/s

将新建文件设置为swap交换区域

sudo mkswap /swp

Setting up swapspace version 1, size = 3071996 KiB
no label, UUID=25d599c8-f252-4644-8748-3152f8ba9d05

打开swap功能

sudo swapon /swp

再次查看 free -m 的结果。

 work01@ubuntu:~$ free -m
             total       used       free     shared    buffers     cached
Mem:          1994       1911         82          7         13       1378
-/+ buffers/cache:        520       1474
Swap:         4020          0       4020

如果需要卸载这个 swap 文件,可以进入建立的 swap 文件目录。执行下列命令。

sudo swapoff /swp

http://it.china-b.com/linux/xtgl/20090525/21754_1.html 

 

如果需要一直保持这个 swap ,可以换到root

然后把它写入 /etc/fstab 文件。 

 

/swp[swapfilepath] swap swap defaults 0 0




appendix:

1 mkswap 

mkswap - set up a Linux swap area


2 swapon 

NAME
       swapon, swapoff - enable/disable devices and files for paging and swap‐
       ping


SYNOPSIS
       Get info:
            swapon -s [-h] [-V]


       Enable/disable:
            swapon [-d] [-f] [-p priority] [-v] specialfile...
            swapoff [-v] specialfile...


       Enable/disable all:
            swapon -a [-e] [-f] [-v]
            swapoff -a [-v]


ref:

1. /etc/fstab 文件解释

http://ckc620.blog.51cto.com/631254/394238


XP下虚拟机编译 android4.0 内存不够

http://bbs.eeworld.com.cn/thread-375785-1-1.html


  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Franklin

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值