本地编译MTK8.1代码

  1. 第一:安装正确的JDK
  2. 第二:去除所有本地化的设置
  3. 第三:jack-server 未启动
  4. 第四:Jack server failed to start
  5. 第五:Java heap 空间不足
  6. 第六:库冲突
    1. reference

第一:安装正确的JDK

1
2
You asked for an OpenJDK based build but your version is
java version "1.8.0_111" Java(TM) SE Runtime Environment (build 1.8.0_111-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode).

注意:AOSP 编译需要使用 openjdk,不能使用oracle 的JDK 版本
解决办法:

第二:去除所有本地化的设置

1
error:flex-2.5.39: loadlocale.c:130: _nl_intern_locale_data: Assertion `cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' failed. Aborted (core dumped)

或者

1
2
3
4
FAILED: out/host/linux-x86/obj/EXECUTABLES/checkpolicy_intermediates/policy_scan.c
/bin/bash -c "prebuilts/misc/linux-x86/flex/flex-2.5.39 -oout/host/linux-x86/obj/EXECUTABLES/checkpolicy_intermediates/policy_scan.c external/selinux/checkpolicy/policy_scan.l"
flex-2.5.39: loadlocale.c:130: _nl_intern_locale_data: Assertion `cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' failed.
Aborted (core dumped)

解决方法 : 在编译脚本中执行

export LC_ALL=C

LC_ALL=C 是为了去除所有本地化的设置,让命令能正确执行, 但是不可以修改~/.bashrc,会导致终端内中文显示为数字(应该是对应的编码)

第三:jack-server 未启动

1
2
No Jack server running. Try 'jack-admin start-server'
No Jack server running. Try 'jack-admin start-server'

解决办法:

out/host/linux-x86/bin/jack-admin start-server

第四:Jack server failed to start

1
2
3
4
5
6
7
8
9
[6% 1127/18030] Ensure Jack server is installed and started
FAILED: /bin/bash -c "(prebuilts/sdk/tools/jack-admin install-server prebuilts/sdk/tools/jack-launcher.jar prebuilts/sdk/tools/jack-server-4.8.ALPHA.jar 2>&1 || (exit 0) ) && (JACK_SERVER_VM_ARGUMENTS=/"-Dfile.encoding=UTF-8

No Jack server running. Try 'jack-admin start-server'
No Jack server running. Try 'jack-admin start-server'

bule@sky:~/**/jianwen.fu/V65_An7/prebuilts/sdk/tools$ jack-admin start-server
Launching Jack server java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=/tmp -Dfile.encoding=UTF-8 -XX:+TieredCompilation -cp /home/prayasm/.jack-server/launcher.jar com.android.jack.launcher.ServerLauncher
Jack server failed to (re)start, try 'jack-diagnose' or see Jack server log

解决办法:http://www.th7.cn/system/lin/201702/202334.shtml

1
2
3
4
5
6
7
8
9
cd /prebuilts/sdk/tools/
jack-admin start-server
jack-admin kill-server
jack-admin list-server
jack-admin uninstall-server
mm -j32 showcommands &> mm.out
jack-admin install-server jack-launcher.jar jack-server-4.8.ALPHA.jar
jack-admin dump-report
jack-admin dump-re

第五:Java heap 空间不足

1
2
3
4
[ 0% 2/21542] Building with Jack: out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/with-local/classes.dex
FAILED: /bin/bash out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/with-local/classes.dex.rsp
Java heap space
Try increasing heap size with java option '-Xmx<size>'

解决办法:

1
2
3
export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4096m"
out/host/linux-x86/bin/jack-admin kill-server
out/host/linux-x86/bin/jack-admin start-server

第六:库冲突

1
2
3
4
5
6
7
8
libGL error: unable to load driver: i965_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: i965
libGL error: unable to load driver: i965_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: i965
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast

//依次输入以下命令(如果是在编译成功源码之后直接想运行模拟器,则直接输入emulator命令就行,因为前面编译源码已经输入过以上两条命令)

1
2
3
source build/envsetup.sh
lunch(选择刚才你编译源码设置的目标版本)
emulator -use-system-libs

或者

1
2
3
4
source build/envsetup.sh
lunch(选择刚才你编译源码设置的目标版本)
export ANDROID_EMULATOR_USE_SYSTEM_LIBS=1
emulator

reference

https://www.jianshu.com/p/c3bb9d86fd22


转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 wilber_bai@hotmail.com

文章标题:本地编译MTK8.1代码

文章字数:804

本文作者:风沉殇史

发布时间:2017-12-12, 12:12:12

最后更新:2020-01-03, 15:55:55

原始链接:http://wilber.win/posts/4d1b717c/

版权声明: "署名-非商用-相同方式共享 4.0" 转载请保留原文链接及作者。

目录
×

喜欢就点赞,疼爱就打赏