ubuntu 18.04 LTS 上编译 RK3399 Android 7.1 遇到的错误及解决方法
$ sudo fallocate -l 4G /swapfile
$ sudo chmod 600 /swapfile
$ sudo mkswap /swapfile
$ sudo swapon /swapfile
$ sudo vim /etc/fstab
#在/etc/fstab 文件最后添加如下内容:/swapfile none swap sw 0 0
$ sudo add-apt-repository ppa:openjdk-r/ppa
$ sudo apt-get update
$ sudo apt-get install uuid \
uuid-dev \
zlib1g-dev \
liblz-dev \
liblzo2-2 \
liblzo2-dev \
lzop \
git-core curl \
u-boot-tools \
mtd-utils \
android-tools-fsutils \
openjdk-8-jdk \
device-tree-compiler \
gdisk \
m4 \
libz-dev
$ sudo apt install gcc
$ sudo apt install gcc-multilib
$ sudo apt instal libxml2 libxml2-utils
// 查看openjdk安装版本:
$ update-java-alternatives -l
// 修改openjdk版本java-1.8.0-openjdk-amd64
$ sudo update-alternatives --config java
FAILED: /bin/bash -c "prebuilts/misc/linux-x86/flex/flex-2.5.39 -oout/host/linux-x86/obj/STATIC_LIBRARIES/libaidl-common_intermediates/aidl_language_l.cpp system/tools/aidl/aidl_language_l.ll"
flex-2.5.39: loadlocale.c:130:_nl_intern_locale_data: ?? 'cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' ???
Aborted (core dumped)
export LC_ALL=C.UTF-8
arch/arm64/Makefile:167: recipe for target 'kernel.img' failed
make: *** [kernel.img] Error 127
解决方法:
sudo apt install gcc-multilib
build/core/ninja.mk:148: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1
解决方法:
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386
sudo apt-get install m4
Out of memory error (version 1.2-rc4 'Carnac' (298900 f95d7bdecfceb327f9d201a1348397ed8a843843 by android-jack-team@google.com)).
GC overhead limit exceeded.
Try increasing heap size with java option '-Xmx<size>'.
Warning: This may have produced partial or corrupted output.
JACK_SERVER_COMMAND="java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=$TMPDIR $JACK_SERVER_VM_ARGUMENTS -cp $LAUNCHER_JAR $LAUNCHER_NAME"
更改为
JACK_SERVER_COMMAND="java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=$TMPDIR $JACK_SERVER_VM_ARGUMENTS -Xmx4096m -cp $LAUNCHER_JAR $LAUNCHER_NAME"
由于此时Jack服务器仍然在后台执行,需要重启启动Jack服务器,使得修改后的参数生效。(make会自动启动Jack服务器)
#停止服务
./prebuilts/sdk/tools/jack-admin stop-server
#重新开始服务
./prebuilts/sdk/tools/jack-admin start-server
第二种解决方法:
export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4096m"