[Sony Xperia XZ Premium Questions & Answers] LSS4181:
What could be causing issues with hiddenapi?

On Manjaro (Arch based), it seems I need to replace the prebuilt flex binary or it'll complain about an assertion failed (locale-related). After replacing the flex binary the build could continue, but near the end of the build process another error occurred. For some reasons, the hiddenapi is saying about "No DEX files specified".

By the way, I'm trying to build this on a PC with a AMD Ryzen CPU (in case the error might be CPU-related as far as google results could tell).

[ 96% 74769/77225] build out/target/common/obj/JAVA_LIBRARIES/apache-xml_intermediates/dex-hiddenapi/classes.dex
FAILED: out/target/common/obj/JAVA_LIBRARIES/apache-xml_intermediates/dex-hiddenapi/classes.dex
/bin/bash -c "(rm -rf out/target/common/obj/JAVA_LIBRARIES/apache-xml_intermediates/dex-hiddenapi/ ) && (mkdir -p out/target/common/obj/JAVA_LIBRARIES/apache-xml_intermediates/dex-hiddenapi/ ) && (find out/target/common/obj/JAVA_LIBRARIES/apache-xml_intermediates/dex/ -maxdepth 1 -name \"classes*.dex\" | sort | xargs -I{} cp -f {} out/target/common/obj/JAVA_LIBRARIES/apache-xml_intermediates/dex-hiddenapi/ ) && (find out/target/common/obj/JAVA_LIBRARIES/apache-xml_intermediates/dex-hiddenapi/ -name \"classes*.dex\" | sort | sed 's/^/--dex=/' | xargs out/host/linux-x86/bin/hiddenapi --light-greylist=out/target/common/obj/PACKAGING/hiddenapi-light-greylist.txt --dark-greylist=out/target/common/obj/PACKAGING/hiddenapi-dark-greylist.txt --blacklist=out/target/common/obj/PACKAGING/hiddenapi-blacklist.txt )"
hiddenapi E 11-29 01:27:58 51753 51753 hiddenapi.cc:47] No DEX files specified
hiddenapi E 11-29 01:27:58 51753 51753 hiddenapi.cc:47] Command: out/host/linux-x86/bin/hiddenapi --light-greylist=out/target/common/obj/PACKAGING/hiddenapi-light-greylist.txt --dark-greylist=out/target/common/obj/PACKAGING/hiddenapi-dark-greylist.txt --blacklist=out/target/common/obj/PACKAGING/hiddenapi-blacklist.txt
hiddenapi E 11-29 01:27:58 51753 51753 hiddenapi.cc:47] Usage: hiddenapi [options]...
hiddenapi E 11-29 01:27:58 51753 51753 hiddenapi.cc:47]
hiddenapi E 11-29 01:27:58 51753 51753 hiddenapi.cc:47] --dex=<filename>: specify dex file whose members' access flags are to be set.
hiddenapi E 11-29 01:27:58 51753 51753 hiddenapi.cc:47] At least one --dex parameter must be specified.
hiddenapi E 11-29 01:27:58 51753 51753 hiddenapi.cc:47]
hiddenapi E 11-29 01:27:58 51753 51753 hiddenapi.cc:47] --light-greylist=<filename>:
hiddenapi E 11-29 01:27:58 51753 51753 hiddenapi.cc:47] --dark-greylist=<filename>:
hiddenapi E 11-29 01:27:58 51753 51753 hiddenapi.cc:47] --blacklist=<filename>: text files with signatures of methods/fields to be marked
hiddenapi E 11-29 01:27:58 51753 51753 hiddenapi.cc:47] greylisted/blacklisted respectively. At least one list must be provided.
hiddenapi E 11-29 01:27:58 51753 51753 hiddenapi.cc:47]
hiddenapi E 11-29 01:27:58 51753 51753 hiddenapi.cc:47] --print-hidden-api: dump a list of marked methods/fields to the standard output.
hiddenapi E 11-29 01:27:58 51753 51753 hiddenapi.cc:47] There is no indication which API category they belong to.
hiddenapi E 11-29 01:27:58 51753 51753 hiddenapi.cc:47]
[ 96% 74809/77225] //frameworks/native/services/surfaceflinger:libsurfaceflinger link libsurfaceflinger.so
Warning: request a ThreadPool with 1 threads, but LLVM_ENABLE_THREADS has been turned off
[ 96% 74810/77225] //frameworks/native/services/surfaceflinger:libsurfaceflinger link libsurfaceflinger.so [arm]
Warning: request a ThreadPool with 1 threads, but LLVM_ENABLE_THREADS has been turned off
[ 96% 74811/77225] //art/runtime:libart link libart.so [arm]
Warning: request a ThreadPool with 1 threads, but LLVM_ENABLE_THREADS has been turned off
[ 96% 74812/77225] //art/runtime:libart link libart.so
Warning: request a ThreadPool with 1 threads, but LLVM_ENABLE_THREADS has been turned off
[ 96% 74813/77225] //frameworks/base/libs/hwui:libhwui link libhwui.so
Warning: request a ThreadPool with 1 threads, but LLVM_ENABLE_THREADS has been turned off
[ 96% 74814/77225] //frameworks/base/libs/hwui:libhwui link libhwui.so [arm]
Warning: request a ThreadPool with 1 threads, but LLVM_ENABLE_THREADS has been turned off
ninja: build stopped: subcommand failed.
01:32:14 ninja failed with: exit status 1

EDIT: Finally managed to complete the build. Maybe some repos weren't synced properly or for some other reasons.

By the way, for some reasons, during the build process, clang managed to segfault at a particular point (it seems Ryzen 7 isn't a good CPU of choice when compiling), although it's not a real problem as the build eventually succeeded after resuming the build process.

[ 72% 64457/88626] //external/libvpx:libvpx clang libvpx/vp9/encoder/vp9_encoder.c [arm]
FAILED: out/soong/.intermediates/external/libvpx/libvpx/android_arm_armv8-a_cortex-a73_core_static/obj/external/libvpx/libvpx/vp9/encoder/vp9_encoder.o
PWD=/proc/self/cwd prebuilts/clang/host/linux-x86/clang-4691093/bin/clang -c -Iexternal/libvpx/libvpx -Iexternal/libvpx/config/arm-neon -Iexternal/libvpx/config/arm -Iexternal/libvpx -fstrict-aliasing -fomit-frame-pointer -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -no-canonical-prefixes -DNDEBUG -UDEBUG -fno-exceptions -Wno-multichar -O2 -g -fno-strict-aliasing -fdebug-prefix-map=/proc/self/cwd= -D__compiler_offsetof=__builtin_offsetof -Werror=int-conversion -Wno-reserved-id-macro -Wno-format-pedantic -Wno-unused-command-line-argument -fcolor-diagnostics -Wno-expansion-to-defined -Wno-zero-as-null-pointer-constant -fdebug-prefix-map=$PWD/= -ffunction-sections -fdata-sections -fno-short-enums -funwind-tables -fstack-protector-strong -Wa,--noexecstack -D_FORTIFY_SOURCE=2 -Wstrict-aliasing=2 -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Werror=date-time -Werror=format-security -nostdlibinc -msoft-float -march=armv8-a -mfloat-abi=softfp -mfpu=neon-fp-armv8 -mcpu=cortex-a53 -mfpu=neon-fp-armv8 -D__ARM_FEATURE_LPAE=1 -Iexternal/libcxx/include -Iexternal/libcxxabi/include -Iout/soong/.intermediates/external/libvpx/libvpx_arm_neon_asm_srcs_converted/gen/external/libvpx/libvpx -Isystem/core/include -Isystem/media/audio/include -Ihardware/libhardware/include -Ihardware/libhardware_legacy/include -Ihardware/ril/include -Ilibnativehelper/include -Iframeworks/native/include -Iframeworks/native/opengl/include -Iframeworks/av/include -isystem bionic/libc/include -isystem bionic/libc/kernel/uapi -isystem bionic/libc/kernel/uapi/asm-arm -isystem bionic/libc/kernel/android/scsi -isystem bionic/libc/kernel/android/uapi -Ilibnativehelper/include_jni -Wall -Werror -O3 -Wno-unused-parameter -target arm-linux-androideabi -Bprebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/arm-linux-androideabi/bin -fPIC -D_USING_LIBCXX -std=gnu99 -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast -Werror=address-of-temporary -Werror=return-type -Wno-tautological-constant-compare -Wno-null-pointer-arithmetic -Wno-enum-compare -Wno-enum-compare-switch -MD -MF out/soong/.intermediates/external/libvpx/libvpx/android_arm_armv8-a_cortex-a73_core_static/obj/external/libvpx/libvpx/vp9/encoder/vp9_encoder.o.d -o out/soong/.intermediates/external/libvpx/libvpx/android_arm_armv8-a_cortex-a73_core_static/obj/external/libvpx/libvpx/vp9/encoder/vp9_encoder.o external/libvpx/libvpx/vp9/encoder/vp9_encoder.c
#0 0x00000000014b9f84 (prebuilts/clang/host/linux-x86/clang-4691093/bin/clang.real+0x14b9f84)
#1 0x00000000014ba1b6 (prebuilts/clang/host/linux-x86/clang-4691093/bin/clang.real+0x14ba1b6)
#2 0x00007f408fe9b3c0 __restore_rt (/usr/lib/libpthread.so.0+0x123c0)
#3 0x0000000005dc1918
Stack dump:
0.	Program arguments: prebuilts/clang/host/linux-x86/clang-4691093/bin/clang.real -cc1 -triple armv8--linux-android -emit-obj -mnoexecstack -disable-free -disable-llvm-verifier -discard-value-names -main-file-name vp9_encoder.c -mrelocation-model pic -pic-level 2 -mthread-model posix -relaxed-aliasing -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu cortex-a53 -target-feature +soft-float-abi -target-feature +crc -target-feature +dsp -target-feature -ras -target-feature -dotprod -target-feature +hwdiv-arm -target-feature +hwdiv -target-feature -fp-only-sp -target-feature -d16 -target-feature +fp-armv8 -target-feature +neon -target-feature -crypto -target-abi aapcs-linux -mfloat-abi soft -fallow-half-arguments-and-returns -dwarf-column-info -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -ffunction-sections -fdata-sections -coverage-notes-file /proc/self/cwd/out/soong/.intermediates/external/libvpx/libvpx/android_arm_armv8-a_cortex-a73_core_static/obj/external/libvpx/libvpx/vp9/encoder/vp9_encoder.gcno -nostdsysteminc -resource-dir prebuilts/clang/host/linux-x86/clang-4691093/lib64/clang/6.0.2 -dependency-file out/soong/.intermediates/external/libvpx/libvpx/android_arm_armv8-a_cortex-a73_core_static/obj/external/libvpx/libvpx/vp9/encoder/vp9_encoder.o.d -MT out/soong/.intermediates/external/libvpx/libvpx/android_arm_armv8-a_cortex-a73_core_static/obj/external/libvpx/libvpx/vp9/encoder/vp9_encoder.o -sys-header-deps -isystem bionic/libc/include -isystem bionic/libc/kernel/uapi -isystem bionic/libc/kernel/uapi/asm-arm -isystem bionic/libc/kernel/android/scsi -isystem bionic/libc/kernel/android/uapi -I external/libvpx/libvpx -I external/libvpx/config/arm-neon -I external/libvpx/config/arm -I external/libvpx -D ANDROID -D NDEBUG -U DEBUG -D __compiler_offsetof=__builtin_offsetof -D _FORTIFY_SOURCE=2 -D __ARM_FEATURE_LPAE=1 -I external/libcxx/include -I external/libcxxabi/include -I out/soong/.intermediates/external/libvpx/libvpx_arm_neon_asm_srcs_converted/gen/external/libvpx/libvpx -I system/core/include -I system/media/audio/include -I hardware/libhardware/include -I hardware/libhardware_legacy/include -I hardware/ril/include -I libnativehelper/include -I frameworks/native/include -I frameworks/native/opengl/include -I frameworks/av/include -I libnativehelper/include_jni -D _USING_LIBCXX -internal-isystem prebuilts/clang/host/linux-x86/clang-4691093/lib64/clang/6.0.2/include -O3 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -Wno-multichar -Werror=int-conversion -Wno-reserved-id-macro -Wno-format-pedantic -Wno-unused-command-line-argument -Wno-expansion-to-defined -Wno-zero-as-null-pointer-constant -Wstrict-aliasing=2 -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Werror=date-time -Werror=format-security -Wall -Werror -Wno-unused-parameter -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast -Werror=address-of-temporary -Werror=return-type -Wno-tautological-constant-compare -Wno-null-pointer-arithmetic -Wno-enum-compare -Wno-enum-compare-switch -std=gnu99 -fdebug-compilation-dir /proc/self/cwd -fdebug-prefix-map=/proc/self/cwd= -fdebug-prefix-map=/extdata/AOSP/= -ferror-limit 19 -fmessage-length 0 -femulated-tls -stack-protector 2 -fno-signed-char -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o out/soong/.intermediates/external/libvpx/libvpx/android_arm_armv8-a_cortex-a73_core_static/obj/external/libvpx/libvpx/vp9/encoder/vp9_encoder.o -x c external/libvpx/libvpx/vp9/encoder/vp9_encoder.c
1.	<eof> parser at end of file
2.	Per-module optimization passes
3.	Running pass 'CallGraph Pass Manager' on module 'external/libvpx/libvpx/vp9/encoder/vp9_encoder.c'.
4.	Running pass 'Conditionally eliminate dead library calls' on function '@encode_with_recode_loop'
clang.real: error: unable to execute command: Segmentation fault (core dumped)
clang.real: error: clang frontend command failed due to signal (use -v to see invocation)
Android (4691093 based on r316199) clang version 6.0.2 (https://android.googlesource.com/toolchain/clang 183abd29fc496f55536e7d904e0abae47888fc7f) (https://android.googlesource.com/toolchain/llvm 34361f192e41ed6e4e8f9aca80a4ea7e9856f327) (based on LLVM 6.0.2svn)
Target: arm--linux-android
Thread model: posix
InstalledDir: prebuilts/clang/host/linux-x86/clang-4691093/bin
clang.real: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script.
clang.real: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang.real: note: diagnostic msg: /tmp/vp9_encoder-aaef8f.c
clang.real: note: diagnostic msg: /tmp/vp9_encoder-aaef8f.sh
clang.real: note: diagnostic msg:

********************
[ 72% 64468/88626] //external/libvpx:libvpx clang libvpx/vpx_dsp/variance.c [arm]
ninja: build stopped: subcommand failed.
12:29:18 ninja failed with: exit status 1

#### failed to build some targets (53:04 (mm:ss)) ####

EDIT 2: Is there a way to flash the image without wiping "internal storage" (/data/media)? Although I could go to the recovery right away to perform such a wipe post-flash, it's just that I recall there wasn't a way to go to recovery via fastboot...