[Android Q&A, Help & Troubleshooting] Borgir:
Hello, so I'm trying build a custom rom but when it comes to compiling the kernel I am getting this error. Can anyone please help.

FAILED: Building Kernel Image (Image)

Outputs: /home/ptg/superior/out/target/product/redwood/obj/KERNEL_OBJ/arch/arm64/boot/Image

Error: exited with code: 1

Command: /bin/bash -c "(PATH=/home/ptg/superior/out/host/linux-x86/bin:\$PATH PATH=/home/ptg/superior/prebuilts/clang/host/linux-x86/clang-r487747c/bin:\$PATH PERL5LIB=/home/ptg/superior/prebuilts/tools-lineage/common/perl-base PATH=/home/ptg/superior/prebuilts/tools-lineage/linux-x86/bin:/home/ptg/superior/prebuilts/clang/host/linux-x86/clang-r487747c/bin:\$PATH BISON_PKGDATADIR=/home/ptg/superior/prebuilts/build-tools/common/bison /home/ptg/superior/prebuilts/build-tools/linux-x86/bin/make -j4 HOSTCFLAGS=\"--sysroot=/home/ptg/superior/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/sysroot -I/home/ptg/superior/prebuilts/kernel-build-tools/linux-x86/include\" HOSTLDFLAGS=\"--sysroot=/home/ptg/superior/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/sysroot -Wl,-rpath,/home/ptg/superior/prebuilts/kernel-build-tools/linux-x86/lib64 -L /home/ptg/superior/prebuilts/kernel-build-tools/linux-x86/lib64 -fuse-ld=lld --rtlib=compiler-rt\" LLVM=1 LLVM_IAS=1 LZ4=/home/ptg/superior/prebuilts/kernel-build-tools/linux-x86/bin/lz4 LEX=/home/ptg/superior/prebuilts/build-tools/linux-x86/bin/flex YACC=/home/ptg/superior/prebuilts/build-tools/linux-x86/bin/bison M4=/home/ptg/superior/prebuilts/build-tools/linux-x86/bin/m4 PAHOLE=/home/ptg/superior/prebuilts/kernel-build-tools/linux-x86/bin/pahole DTC_EXT=/home/ptg/superior/out/host/linux-x86/bin/dtc TARGET_PRODUCT=redwood -C kernel/xiaomi/sm8350 O=/home/ptg/superior/out/target/product/redwood/obj/KERNEL_OBJ ARCH=arm64 CC=\"/usr/bin/ccache clang --cuda-path=/dev/null --hip-path=/dev/null\" Image ) && (if grep -q '^CONFIG_OF=y' /home/ptg/superior/out/target/product/redwood/obj/KERNEL_OBJ/.config; then echo \"Building DTBs\"; PATH=/home/ptg/superior/out/host/linux-x86/bin:\$PATH PATH=/home/ptg/superior/prebuilts/clang/host/linux-x86/clang-r487747c/bin:\$PATH PERL5LIB=/home/ptg/superior/prebuilts/tools-lineage/common/perl-base PATH=/home/ptg/superior/prebuilts/tools-lineage/linux-x86/bin:/home/ptg/superior/prebuilts/clang/host/linux-x86/clang-r487747c/bin:\$PATH BISON_PKGDATADIR=/home/ptg/superior/prebuilts/build-tools/common/bison /home/ptg/superior/prebuilts/build-tools/linux-x86/bin/make -j4 HOSTCFLAGS=\"--sysroot=/home/ptg/superior/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/sysroot -I/home/ptg/superior/prebuilts/kernel-build-tools/linux-x86/include\" HOSTLDFLAGS=\"--sysroot=/home/ptg/superior/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/sysroot -Wl,-rpath,/home/ptg/superior/prebuilts/kernel-build-tools/linux-x86/lib64 -L /home/ptg/superior/prebuilts/kernel-build-tools/linux-x86/lib64 -fuse-ld=lld --rtlib=compiler-rt\" LLVM=1 LLVM_IAS=1 LZ4=/home/ptg/superior/prebuilts/kernel-build-tools/linux-x86/bin/lz4 LEX=/home/ptg/superior/prebuilts/build-tools/linux-x86/bin/flex YACC=/home/ptg/superior/prebuilts/build-tools/linux-x86/bin/bison M4=/home/ptg/superior/prebuilts/build-tools/linux-x86/bin/m4 PAHOLE=/home/ptg/superior/prebuilts/kernel-build-tools/linux-x86/bin/pahole DTC_EXT=/home/ptg/superior/out/host/linux-x86/bin/dtc TARGET_PRODUCT=redwood -C kernel/xiaomi/sm8350 O=/home/ptg/superior/out/target/product/redwood/obj/KERNEL_OBJ ARCH=arm64 CC=\"/usr/bin/ccache clang --cuda-path=/dev/null --hip-path=/dev/null\" dtbs; fi ) && (if grep -q '=m' /home/ptg/superior/out/target/product/redwood/obj/KERNEL_OBJ/.config; then echo \"Building Kernel Modules\"; PATH=/home/ptg/superior/out/host/linux-x86/bin:\$PATH PATH=/home/ptg/superior/prebuilts/clang/host/linux-x86/clang-r487747c/bin:\$PATH PERL5LIB=/home/ptg/superior/prebuilts/tools-lineage/common/perl-base PATH=/home/ptg/superior/prebuilts/tools-lineage/linux-x86/bin:/home/ptg/superior/prebuilts/clang/host/linux-x86/clang-r487747c/bin:\$PATH BISON_PKGDATADIR=/home/ptg/superior/prebuilts/build-tools/common/bison /home/ptg/superior/prebuilts/build-tools/linux-x86/bin/make -j4 HOSTCFLAGS=\"--sysroot=/home/ptg/superior/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/sysroot -I/home/ptg/superior/prebuilts/kernel-build-tools/linux-x86/include\" HOSTLDFLAGS=\"--sysroot=/home/ptg/superior/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/sysroot -Wl,-rpath,/home/ptg/superior/prebuilts/kernel-build-tools/linux-x86/lib64 -L /home/ptg/superior/prebuilts/kernel-build-tools/linux-x86/lib64 -fuse-ld=lld --rtlib=compiler-rt\" LLVM=1 LLVM_IAS=1 LZ4=/home/ptg/superior/prebuilts/kernel-build-tools/linux-x86/bin/lz4 LEX=/home/ptg/superior/prebuilts/build-tools/linux-x86/bin/flex YACC=/home/ptg/superior/prebuilts/build-tools/linux-x86/bin/bison M4=/home/ptg/superior/prebuilts/build-tools/linux-x86/bin/m4 PAHOLE=/home/ptg/superior/prebuilts/kernel-build-tools/linux-x86/bin/pahole DTC_EXT=/home/ptg/superior/out/host/linux-x86/bin/dtc TARGET_PRODUCT=redwood -C kernel/xiaomi/sm8350 O=/home/ptg/superior/out/target/product/redwood/obj/KERNEL_OBJ ARCH=arm64 CC=\"/usr/bin/ccache clang --cuda-path=/dev/null --hip-path=/dev/null\" modules || exit \"\$?\"; echo \"Installing Kernel Modules\"; PATH=/home/ptg/superior/out/host/linux-x86/bin:\$PATH PATH=/home/ptg/superior/prebuilts/clang/host/linux-x86/clang-r487747c/bin:\$PATH PERL5LIB=/home/ptg/superior/prebuilts/tools-lineage/common/perl-base PATH=/home/ptg/superior/prebuilts/tools-lineage/linux-x86/bin:/home/ptg/superior/prebuilts/clang/host/linux-x86/clang-r487747c/bin:\$PATH BISON_PKGDATADIR=/home/ptg/superior/prebuilts/build-tools/common/bison /home/ptg/superior/prebuilts/build-tools/linux-x86/bin/make -j4 HOSTCFLAGS=\"--sysroot=/home/ptg/superior/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/sysroot -I/home/ptg/superior/prebuilts/kernel-build-tools/linux-x86/include\" HOSTLDFLAGS=\"--sysroot=/home/ptg/superior/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/sysroot -Wl,-rpath,/home/ptg/superior/prebuilts/kernel-build-tools/linux-x86/lib64 -L /home/ptg/superior/prebuilts/kernel-build-tools/linux-x86/lib64 -fuse-ld=lld --rtlib=compiler-rt\" LLVM=1 LLVM_IAS=1 LZ4=/home/ptg/superior/prebuilts/kernel-build-tools/linux-x86/bin/lz4 LEX=/home/ptg/superior/prebuilts/build-tools/linux-x86/bin/flex YACC=/home/ptg/superior/prebuilts/build-tools/linux-x86/bin/bison M4=/home/ptg/superior/prebuilts/build-tools/linux-x86/bin/m4 PAHOLE=/home/ptg/superior/prebuilts/kernel-build-tools/linux-x86/bin/pahole DTC_EXT=/home/ptg/superior/out/host/linux-x86/bin/dtc TARGET_PRODUCT=redwood -C kernel/xiaomi/sm8350 O=/home/ptg/superior/out/target/product/redwood/obj/KERNEL_OBJ ARCH=arm64 CC=\"/usr/bin/ccache clang --cuda-path=/dev/null --hip-path=/dev/null\" INSTALL_MOD_PATH=/home/ptg/superior/out/target/product/redwood/obj/PACKAGING/kernel_modules_intermediates INSTALL_MOD_STRIP=1 modules_install; kernel_release=\$(cat /home/ptg/superior/out/target/product/redwood/obj/KERNEL_OBJ/include/config/kernel.release) kernel_modules_dir=/home/ptg/superior/out/target/product/redwood/obj/PACKAGING/kernel_modules_intermediates/lib/modules/\$kernel_release ; all_modules=\$(find \$kernel_modules_dir -type f -name '*.ko'); filtered_modules=\"\"; ( mkdir -p /home/ptg/superior/out/target/product/redwood/vendor/lib/modules/ ) && (cp \$all_modules /home/ptg/superior/out/target/product/redwood/vendor/lib/modules/ ) && (rm -rf /home/ptg/superior/out/target/product/redwood/obj/PACKAGING/depmod_vendor_intermediates ) && (mkdir -p /home/ptg/superior/out/target/product/redwood/obj/PACKAGING/depmod_vendor_intermediates/lib/modules/0.0/vendor/lib/modules/ ) && (cp \$all_modules /home/ptg/superior/out/target/product/redwood/obj/PACKAGING/depmod_vendor_intermediates/lib/modules/0.0/vendor/lib/modules/ ) && (/home/ptg/superior/out/host/linux-x86/bin/depmod -b /home/ptg/superior/out/target/product/redwood/obj/PACKAGING/depmod_vendor_intermediates 0.0 ) && (sed -e 's/\\(.*modules.*\\):/\\/\\1:/g' -e 's/ \\([^ ]*modules[^ ]*\\)/ \\/\\1/g' /home/ptg/superior/out/target/product/redwood/obj/PACKAGING/depmod_vendor_intermediates/lib/modules/0.0/modules.dep > /home/ptg/superior/out/target/product/redwood/vendor/lib/modules//modules.dep ) && (cp /home/ptg/superior/out/target/product/redwood/obj/PACKAGING/depmod_vendor_intermediates/lib/modules/0.0/modules.softdep /home/ptg/superior/out/target/product/redwood/vendor/lib/modules/ ) && (cp /home/ptg/superior/out/target/product/redwood/obj/PACKAGING/depmod_vendor_intermediates/lib/modules/0.0/modules.alias /home/ptg/superior/out/target/product/redwood/vendor/lib/modules/ ) && (rm -f /home/ptg/superior/out/target/product/redwood/vendor/lib/modules//modules.load ) && (for MODULE in ; do basename \$MODULE >> /home/ptg/superior/out/target/product/redwood/vendor/lib/modules//modules.load; done); vendor_boot_modules=\$(for m in goodix_core.ko xiaomi_touch.ko; do p=\$(find \$kernel_modules_dir -type f -name \$m); if [ -n \"\$p\" ]; then echo \$p; else echo \"ERROR: \$m from BOOT_KERNEL_MODULES was not found\" 1>&2 && exit 1; fi; done); [ \$? -ne 0 ] && exit 1; ( mkdir -p /home/ptg/superior/out/target/product/redwood/vendor_ramdisk/lib/modules/ ) && (cp \$vendor_boot_modules /home/ptg/superior/out/target/product/redwood/vendor_ramdisk/lib/modules/ ) && (rm -rf /home/ptg/superior/out/target/product/redwood/obj/PACKAGING/depmod_vendor_ramdisk_intermediates ) && (mkdir -p /home/ptg/superior/out/target/product/redwood/obj/PACKAGING/depmod_vendor_ramdisk_intermediates/lib/modules/0.0//lib/modules/ ) && (cp \$vendor_boot_modules /home/ptg/superior/out/target/product/redwood/obj/PACKAGING/depmod_vendor_ramdisk_intermediates/lib/modules/0.0//lib/modules/ ) && (/home/ptg/superior/out/host/linux-x86/bin/depmod -b /home/ptg/superior/out/target/product/redwood/obj/PACKAGING/depmod_vendor_ramdisk_intermediates 0.0 ) && (sed -e 's/\\(.*modules.*\\):/\\/\\1:/g' -e 's/ \\([^ ]*modules[^ ]*\\)/ \\/\\1/g' /home/ptg/superior/out/target/product/redwood/obj/PACKAGING/depmod_vendor_ramdisk_intermediates/lib/modules/0.0/modules.dep > /home/ptg/superior/out/target/product/redwood/vendor_ramdisk/lib/modules//modules.dep ) && (cp /home/ptg/superior/out/target/product/redwood/obj/PACKAGING/depmod_vendor_ramdisk_intermediates/lib/modules/0.0/modules.softdep /home/ptg/superior/out/target/product/redwood/vendor_ramdisk/lib/modules/ ) && (cp /home/ptg/superior/out/target/product/redwood/obj/PACKAGING/depmod_vendor_ramdisk_intermediates/lib/modules/0.0/modules.alias /home/ptg/superior/out/target/product/redwood/vendor_ramdisk/lib/modules/ ) && (rm -f /home/ptg/superior/out/target/product/redwood/vendor_ramdisk/lib/modules//modules.load ) && (for MODULE in ; do basename \$MODULE >> /home/ptg/superior/out/target/product/redwood/vendor_ramdisk/lib/modules//modules.load; done); fi )"

Output:

make: Entering directory '/home/ptg/superior/kernel/xiaomi/sm8350'

make[1]: Entering directory '/home/ptg/superior/out/target/product/redwood/obj/KERNEL_OBJ'

GEN Makefile

scripts/kconfig/conf --syncconfig Kconfig

GEN Makefile

HOSTCC scripts/extract-cert

/home/ptg/superior/kernel/xiaomi/sm8350/scripts/extract-cert.c:21:10: fatal error: 'openssl/bio.h' file not found

#include <openssl/bio.h>

^~~~~~~~~~~~~~~

1 error generated.

make[2]: *** [scripts/Makefile.host:107: scripts/extract-cert] Error 1

make[1]: *** [/home/ptg/superior/kernel/xiaomi/sm8350/Makefile:1231: scripts] Error 2

make[1]: *** Waiting for unfinished jobs....

make[1]: Leaving directory '/home/ptg/superior/out/target/product/redwood/obj/KERNEL_OBJ'

make: *** [Makefile:190: sub-make] Error 2

make: Leaving directory '/home/ptg/superior/kernel/xiaomi/sm8350'