Android 源码编译问题记录

编译环境:Ubuntu 16.0.4 open jdk7

问题一:

/home/pngcui/MSD6A828/l-828-0513/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/bin/../lib/gcc/x86_64-linux/4.6/../../../../x86_64-linux/bin/ld: error:out/host/linux-x86/obj32/STATIC_LIBRARIES/libcompiler_rt_intermediates/libcompiler_rt.a(eprintf.o): unsupported reloc43againstglobalsymbol stderr2external/compiler-rt/lib/builtins/eprintf.c:32: error: unsupported reloc433collect2: ld returned1exit status4build/core/host_shared_library_internal.mk:44: recipefortarget'out/host/linux-x86/obj32/lib/libcompiler_rt.so'failed5make: *** [out/host/linux-x86/obj32/lib/libcompiler_rt.so] Error16make: ***正在等待未完成的任务....7host C++: dalvikvm_32 <= art/dalvikvm/dalvikvm.cc89#### make failed to build some targets (01:27:58(hh:mm:ss)) ####

解决办法:

步骤1:找到下载源码里的art/build/Android.common_build.mk

# Host.

ART_HOST_CLANG := false

ifneq ($(WITHOUT_HOST_CLANG),false)  (修改处:将true改为false)ture--->false

# By default, host builds use clang for better warnings.

ART_HOST_CLANG := ture

endif

步骤2:直接输入命令:ln -sf /usr/bin/ld.gold prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/x86_64-linux/bin/ld

原因:http://forum.xda-developers.com/chef-central/android/guide-how-to-setup-ubuntu-16-04-lts-t3363669/page2

问题二:

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.

******************************

解决办法:

2.1 错误分析:错误信息表明是由于API错误导致,进一步研究发现:谷歌对于所有的类和API,分为开方和非开放两种,而开放的类和API,可以通过“Javadoc标签”与源码同步生成“程序的开发文档”;当我们修改或者添加一个新的API时,我们有两种方案可以避免出现上述错误,其一是将该接口加上 非公开的标签:/**{@hide}*/;再者可以在修改后执行:make update-api(公开),将修改内容与API的doc文件更新到一致。

2.2 解决办法:

步骤1:执行: make update -api ;

步骤2:修改后相应API文件后,在base库下面会产生“.current.txt”文件的差异,提交时将该差异一并提交审核即可。

你可能感兴趣的:(Android 源码编译问题记录)