I tried to build AOSP using the following commands:
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
It runs for about 1.5 hours before erroring out. Here is what I see in the log:
============================================
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;
^
...
...
and it shows a long list of import errors just like the above two...
and
build/soong/scripts/jars-to-module-info-java.sh: line 29: 33922 Segmentation fault (core dumped) zipinfo -1 $j
Here is the shell script:
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 "}"
My system has 64 gb of RAM and I tried lowering the j value but get the same results. Repo sync is successful.
I'm not an usual contributor to S/O but I spent a lot of time fixing this particular problem for someone so I thought it'd be nice if I gave you my solution for this.
zipinfo is likely crashing because there is a preloaded library called libAppProtection, installed in /usr/local, that crashes under the conditions imposed by the AOSP build. I had found a workaround for this particular problem but if the cause of the problem is the same as what I faced, you will have further problems down the line for which you won't find a workaround.
GDB stacktrace of 'fec' another program crashing the same way
In Firefox shows only blank pages - even about:config is just white it describes that the library is related to Citrix Workspace App SDK.
If you observe the same thing I did when running zipinfo or fec (in my case) with GDB, I can only recommend that you remove this program while you deal with building the AOSP sources. I know this has worked and did not cause any drawbacks for the client. Maybe just disabling the preloaded library in /etc/ld.so.preload would work but I have not tried that and since I don't know anything about Citrix, I would advise against doing that.