问题描述
我尝试使用以下命令构建 AOSP:
repo init -u https://android.googlesource.com/platform/manifest -b android-11.0.0_r27
repo sync
. build/envsetup.sh
lunch aosp_x86_64-eng
make -j8
在出错前运行了大约 1.5 小时。这是我在日志中看到的:
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=11
TARGET_PRODUCT=aosp_x86_64
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_ARCH=x86_64
TARGET_ARCH_VARIANT=x86_64
TARGET_2ND_ARCH=x86
TARGET_2ND_ARCH_VARIANT=x86_64
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-5.4.0-67-generic-x86_64-ubuntu-18.04.5-LTS
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=RQ1A.210105.003
OUT_DIR=out
PRODUCT_SOONG_NAMESPACES=device/generic/goldfish device/generic/goldfish-opengl hardware/google/camera hardware/google/camera/devices/EmulatedCamera device/generic/goldfish device/generic/goldfish-opengl
============================================
ninja: no work to do.
ninja: no work to do.
No need to regenerate ninja file
No need to regenerate ninja file
No need to regenerate ninja file
Starting ninja...
[ 0% 1/4863] //external/apache-xml:apache-xml javac [common com.android.art.debug]
Failed: out/soong/.intermediates/external/apache-xml/apache-xml/android_common_com.android.art.debug/javac/apache-xml.jar
rm -rf "out/soong/.intermediates/external/apache-xml/apache-xml/android_common_com.android.art.debug/javac/classes" "out/soong/.intermediates/external/apache-xml/apache-xml/android_common_com.android.art.debug/javac/anno" "out/soong/.intermediates/external/apache-xml/apache-xml/android_common_com.android.art.debug/javac/srcjars" && mkdir -p "out/soong/.intermediates/external/apache-xml/apache-xml/android_common_com.android.art.debug/javac/classes" "out/soong/.intermediates/external/apache-xml/apache-xml/android_common_com.android.art.debug/javac/anno" "out/soong/.intermediates/external/apache-xml/apache-xml/android_common_com.android.art.debug/javac/srcjars" && out/soong/host/linux-x86/bin/zipsync -d out/soong/.intermediates/external/apache-xml/apache-xml/android_common_com.android.art.debug/javac/srcjars -l out/soong/.intermediates/external/apache-xml/apache-xml/android_common_com.android.art.debug/javac/srcjars/list -f "*.java" && (if [ -s out/soong/.intermediates/external/apache-xml/apache-xml/android_common_com.android.art.debug/javac/srcjars/list ] || [ -s out/soong/.intermediates/external/apache-xml/apache-xml/android_common_com.android.art.debug/javac/apache-xml.jar.rsp ] ; then out/soong/host/linux-x86/bin/soong_javac_wrapper prebuilts/jdk/jdk11/linux-x86/bin/javac -J-Xmx2048M -J-XX:OnError="cat hs_err_pid%p.log" -J-XX:CICompilerCount=6 -J-XX:+UseDynamicNumberOfGCThreads -Xmaxerrs 9999999 -encoding UTF-8 -sourcepath "" -g -XDskipDuplicateBridges=true -XDstringConcat=inline -proc:none -Xlint:-dep-ann --system=out/soong/.intermediates/libcore/core-all-system-modules/android_common/system -source 1.9 -target 1.9 -d out/soong/.intermediates/external/apache-xml/apache-xml/android_common_com.android.art.debug/javac/classes -s out/soong/.intermediates/external/apache-xml/apache-xml/android_common_com.android.art.debug/javac/anno @out/soong/.intermediates/external/apache-xml/apache-xml/android_common_com.android.art.debug/javac/apache-xml.jar.rsp @out/soong/.intermediates/external/apache-xml/apache-xml/android_common_com.android.art.debug/javac/srcjars/list ; fi ) && out/soong/host/linux-x86/bin/soong_zip -jar -o out/soong/.intermediates/external/apache-xml/apache-xml/android_common_com.android.art.debug/javac/apache-xml.jar -C out/soong/.intermediates/external/apache-xml/apache-xml/android_common_com.android.art.debug/javac/classes -D out/soong/.intermediates/external/apache-xml/apache-xml/android_common_com.android.art.debug/javac/classes && rm -rf "out/soong/.intermediates/external/apache-xml/apache-xml/android_common_com.android.art.debug/javac/srcjars"
external/apache-xml/src/main/java/org/apache/xalan/extensions/ExpressionContext.java:23: error: package javax.xml.transform is not visible
import javax.xml.transform.ErrorListener;
^
(package javax.xml.transform is declared in module java.base,which does not export it)
external/apache-xml/src/main/java/org/apache/xalan/extensions/ExpressionContext.java:26: error: package org.w3c.dom is not visible
import org.w3c.dom.Node;
^
...
...
和
build/soong/scripts/jars-to-module-info-java.sh: line 29: 33922 Segmentation fault (core dumped) zipinfo -1 $j
这是shell脚本:
if [ -z "$1" ]; then
echo "usage: $0 <module name> <jar1> [<jar2> ...]" >&2
exit 1
fi
module_name=$1
shift
echo "module ${module_name} {"
for j in "$@"; do zipinfo -1 $j ; done \ # this is the line that segfaults
| grep -E '/[^/]*\.class$' \
| sed 's|\(.*\)/[^/]*\.class$| exports \1;|g' \
| sed 's|/|.|g' \
| sort -u
echo "}"
我的系统有 64 GB 的 RAM,我尝试降低 j 值但得到相同的结果。回购同步成功。
解决方法
我不是 S/O 的惯常贡献者,但我花了很多时间为某人解决这个特定问题,所以我认为如果我为您提供我的解决方案会很好。
zipinfo 可能会崩溃,因为有一个名为 libAppProtection 的预加载库,安装在 /usr/local 中,该库在施加的条件下崩溃由 AOSP 构建。我已经找到了解决此特定问题的方法,但如果问题的原因与我遇到的相同,那么您将遇到更多问题,而您找不到解决方法。
GDB stacktrace of 'fec' another program crashing the same way
在 Firefox shows only blank pages - even about:config is just white 中,它描述了该库与 Citrix Workspace App SDK 相关。
如果您观察到我在使用 GDB 运行 zipinfo 或 fec(在我的情况下)时所做的相同事情,我只能建议您在处理时删除此程序与构建 AOSP 源。我知道这已经奏效,并且没有给客户带来任何弊端。也许只是禁用 /etc/ld.so.preload 中的预加载库会起作用,但我还没有尝试过,因为我对 Citrix 一无所知,我建议不要这样做。 >