操作系统:Ubuntu 16.04 LTS 64位
嵌入式CPU:Exynos4412
嵌入式目标系统:Android5.0.2
arm-linux-gcc 安装跳过;
1.安装openjdk7
先手动添加仓库
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-7-jdk
大概108MB大小
安装完毕,用java -version 查询版本信息,如有则安装成功。
编译:
. setenv
make
注意: 点后面有一个空格。
发现如下错误:
prebuilts/misc/linux-x86/bison/bison -d -o out/host/linux-x86/obj32/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp frameworks/base/tools/aidl/aidl_language_y.y
prebuilts/misc/linux-x86/bison/bison: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
build/core/binary.mk:537: recipe for target 'out/host/linux-x86/obj32/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp' failed
make: *** [out/host/linux-x86/obj32/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp] Error 127
make: *** 正在等待未完成的任务....
注: 某些输入文件使用了未经检查或不安全的操作。
注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
注: 某些输入文件使用了未经检查或不安全的操作。
注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
注: 某些输入文件使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
注: 某些输入文件使用了未经检查或不安全的操作。
注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
#### make failed to build some targets (04:01 (mm:ss)) ####
原因:
ubuntu 64位系统运行32位程序的问题,需要安装运行32位程序的兼容库
sudo apt-get install lib32ncurses5
sudo apt-get install lib32stdc++6
安装之后继续make编译。
出现如下错误:
Install: out/host/linux-x86/bin/apicheck
Checking API: checkapi-last
Checking API: checkapi-current
out/target/common/obj/PACKAGING/public_api.txt:20: error 5: Added public field android.Manifest.permission.BACKUP
out/target/common/obj/PACKAGING/public_api.txt:81: error 5: Added public field android.Manifest.permission.INVOKE_CARRIER_SETUP
out/target/common/obj/PACKAGING/public_api.txt:105: error 5: Added public field android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE
out/target/common/obj/PACKAGING/public_api.txt:115: error 5: Added public field android.Manifest.permission.RECEIVE_EMERGENCY_BROADCAST
******************************
You have tried to change the API from what has been previously approved.
To make these errors go away, you have two choices:
1) You can add "@hide" javadoc comments to the methods, etc. listed in the
errors above.
2) You can update current.txt by executing the following command:
make update-api
To submit the revised current.txt to the main Android repository,
you will need approval.
******************************
build/core/tasks/apicheck.mk:57: recipe for target 'out/target/common/obj/PACKAGING/checkapi-current-timestamp' failed
make: *** [out/target/common/obj/PACKAGING/checkapi-current-timestamp] Error 38
#### make failed to build some targets (11:21 (mm:ss)) ####
按照错误提示,执行
make update-api
出现如下语句,并不能说明整个工程编译成功。仅是make update-api成功。
#### make completed successfully (10:45 (mm:ss)) ####
如果此时用gen-img.sh打包将发现如下错误:
root@lgc-pc:/opt/FriendlyARM/tiny4412/android/android-5.0.2# ./gen-img.sh
cp: 目标'out/target/product/tiny4412/system/' 不是目录
./gen-img.sh: 行 16: out/host/linux-x86/bin/make_ext4fs: 没有那个文件或目录
./gen-img.sh: 行 24: out/host/linux-x86/bin/make_ext4fs: 没有那个文件或目录
./gen-img.sh: 行 25: out/host/linux-x86/bin/make_ext4fs: 没有那个文件或目录
./gen-img.sh: 行 26: out/host/linux-x86/bin/make_ext4fs: 没有那个文件或目录
cp: 无法获取'userdata-4g.img' 的文件状态(stat): 没有那个文件或目录
./gen-img.sh: 行 30: out/host/linux-x86/bin/mkbootfs: 没有那个文件或目录
./gen-img.sh: 行 30: out/host/linux-x86/bin/minigzip: 没有那个文件或目录
./gen-img.sh: 行 31: mkimage: 未找到命令
继续编译make
发现如下错误:
clang: error: linker command failed with exit code 1 (use -v to see invocation)
build/core/host_shared_library_internal.mk:44: recipe for target 'out/host/linux-x86/obj32/lib/libc++.so' failed
make: *** [out/host/linux-x86/obj32/lib/libc++.so] Error 1
#### make failed to build some targets (09:25 (mm:ss)) ####
执行如下命令,然后继续编译:
cp /usr/bin/ld.gold prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/x86_64-linux/bin/ld
报如下错误:
/bin/bash: gperf: 未找到命令
external/chromium_org/third_party/WebKit/Source/platform/make_platform_generated.target.linux-arm.mk:48: recipe for target 'out/target/product/tiny4412/obj/GYP/shared_intermediates/blink/platform/ColorData.cpp' failed
make: *** [out/target/product/tiny4412/obj/GYP/shared_intermediates/blink/platform/ColorData.cpp] Error 127
#### make failed to build some targets (03:29:10 (hh:mm:ss)) ####
安装gperf
sudo apt-get install gperf
继续编译发现如下错误:
/bin/bash: xmllint: 未找到命令
build/core/Makefile:34: recipe for target 'out/target/product/tiny4412/system/etc/apns-conf.xml' failed
make: *** [out/target/product/tiny4412/system/etc/apns-conf.xml] Error 127
make: *** 正在等待未完成的任务....
warning: no entries written for drawable/ab_solid_shadow_mtrl (0x010800bb)
warning: no entries written for drawable/ab_transparent_mtrl_alpha (0x010800c4)
warning: no entries written for drawable/btn_check_off_mtrl_alpha (0x010800f8)
warning: no entries written for drawable/btn_check_on_mtrl_alpha (0x0108010e)
warning: no entries written for drawable/btn_radio_off_mtrl_alpha (0x010801b0)
warning: no entries written for drawable/btn_radio_off_pressed_mtrl_alpha (0x010801b4)
warning: no entries written for drawable/switch_off_mtrl_alpha (0x010806b1)
warning: no entries written for drawable/switch_on_mtrl_alpha (0x010806b2)
warning: no entries written for drawable/sym_keyboard_delete_holo (0x010806c5)
#### make failed to build some targets (11:25 (mm:ss)) ####
安装如下软件:
sudo apt-get install libxml2-utils
继续编译发现如下错误:
File "../build/scripts/rule_bison.py", line 82, in
returnCode = subprocess.call([bisonExe, '-d', '-p', prefix, inputFile, '-o', outputCpp])
File "/usr/lib/python2.7/subprocess.py", line 523, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
external/chromium_org/third_party/WebKit/Source/core/make_core_generated.target.linux-arm.mk:414: recipe for target 'out/target/product/tiny4412/obj/GYP/shared_intermediates/blink/core/CSSGrammar.cpp' failed
make: *** [out/target/product/tiny4412/obj/GYP/shared_intermediates/blink/core/CSSGrammar.cpp] Error 1
安装如下软件:
sudo apt-get install bison
编译成功!
打包的时候发现如下错误:
./gen-img.sh: 行 31: mkimage: 未找到命令
安装如下软件:
sudo apt-get install u-boot-tools
成功打包。