標籤:
編譯環境:Ubuntu12.04 64位
Android源碼:Android 4.3
以下問題是筆者親自碰到,通過網上查詢整合在一起的。
1.error while loading shared libraries: libz.so.1: cannot open shared object file:No such file or directory
這裡所說不能載入libz.so.1這個包,所以需要下載,筆者使用了幾種方法,以下是自己使用過,測試是OK的.
我們使用命令apt-get search 安裝
apt-get install apt-file
在安裝完後提示你使用apt-file update輸入命名
apt-file 是用來尋找某個命令或者某一個庫所在的包的,具體用法如下
[email protected]:/home/zhenghui# apt-file search libz.so.1
lib32z1: /usr/lib32/libz.so.1
lib32z1: /usr/lib32/libz.so.1.2.8
libx32z1: /usr/libx32/libz.so.1
libx32z1: /usr/libx32/libz.so.1.2.8
zlib1g: /lib/x86_64-linux-gnu/libz.so.1
zlib1g: /lib/x86_64-linux-gnu/libz.so.1.2.8
這裡我們發現已經找到了libz.so.1所以安裝對應的包,執行命令
apt-get install lib32z1
2.“mkimage” command not found - U-Boot images will not be built
從網上說使用apt-get install uboot-mkimage 但是筆者沒有得到解決,可能是使用的環境不一樣,提示是:
[email protected]:/home/zhenghui# apt-get install uboot-mkimage
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package uboot-mkimage is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
u-boot-tools:i386 u-boot-tools
E: Package ‘uboot-mkimage‘ has no installation candidate
這裡說下載兩個u-boot-tools:i386 和u-boot-tools兩個工具,這裡就安裝兩個工具。
3.fatal error: zlib.h: No such file or directory
沒有zlib.h這個檔案,使用命令安裝
apt-get install zlib1g-dev
4.gperf not found
解決方案:安裝gperf
apt-get install gperf
5./usr/bin/ld: cannot find -lncurses
解決方案:安裝libncurses5-dev:i386則可以搞定
apt-get install libncurses5-dev:i386
6.fatal error: uuid/uuid.h: No such file or directory
這個是因為沒有安裝uuid軟體開發包的原因,使用一下命令解決:
sudo apt-get install uuid-dev
在安裝完了之後,可能需要做一個軟連結 命令:
ln -sf /lib/i386-linux-gnu/libuuid.so.1 /usr/lib/libuuid.so
7.Can‘t locate Switch.pm in @INC
解決方案是安裝perl的switch庫,安裝命令:
apt-get install libswitch-perl
8./bin/bash: xmllint: command not found
解決方案安裝 xmllint 命令如下:
apt-get install libxml2-utils
9.make: *** [out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/noproguard.classes-with-local.dex] Killed
網上說記憶體不足,採用一下方法得到解決,增大交換分區的大小,這裡就分了1G給交換分區:
在根目錄建立swap檔案夾:
mkdir swap
cd swap
sudo dd if=/dev/zero of=swapfile bs=1024 count=1048576
sudo mkswap swapfile //把產生的檔案轉換成 Swap 檔案
sudo swapon swapfile //啟用 Swap 檔案
如果需要卸載。執行命令:swapoff swapfile
Andorid編譯成功後,會在/out/target/product/sabresd_6dq下產生三個img:recovery.img 、system.img、 boot.img和u-boot.bin
Android源碼編譯出錯解決辦法