Here are a list of build errors and their solutions that I've encountered since I started building custom ROMs. Execute these commands at the root of ROM folder.
I hope this will help others in fixing their build mistakes.
Use compatible trees. For example, do not use Android 11 trees for building Android 12.
Use proton-clang instead of pre-included clang.
git clone https://github.com/kdrag0n/proton-clang prebuilts/clang/host/linux-x86/clang-proton --depth=1
Change TARGET_KERNEL_CLANG_VERSION := XXXXXX
in BoardConfigCommon.mk
to TARGET_KERNEL_CLANG_VERSION := proton
or include it if it's not there yet.
To fix, clone related files from another repo.
First, remove the directory with:
rm -rf prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9
Then, clone the new repo with
git clone https://github.com/LineageOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9 -b lineage-19.0 prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9
Change the branch according to Android version.
Error occured during OTA: Sum of sizes in qti_dynamic_partitions_partition_list is X, which is greater than qti_dynamic_partitions_size (Y)
This might occur when building with GApps, including MiuiCam/ANXCamera or other extra stuff. To resolve, change BOARD_QTI_DYNAMIC_PARTITIONS_SIZE := Y
to BOARD_QTI_DYNAMIC_PARTITIONS_SIZE := X
in BoardConfigCommon.mk
.
This error happens when including something (most likely XiaomiParts) that depends on the module. Simply include the module with:
git clone https://github.com/lineageos/android\_packages\_resources\_devicesettings packages/resources/devicesettings