Hikey 970 Build Error - libGLES_mali.so: error: found ELF

I’m able to generate kernel build successfully by generating Image.gz and ramdisk.

But the AOSP build is failing with the following error. Could you please help in resolving this? Thanking you

[  0% 1/79724] Copy non-ELF: out/target/product/hikey970/system/vendor/lib/egl/l
FAILED: out/target/product/hikey970/system/vendor/lib/egl/libGLES_mali.so
/bin/bash -c "(if prebuilts/clang/host/linux-x86/clang-r383902b/bin/llvm-readobj -h device/linaro/hikey/hikey970/hisilicon_libs/lib/libGLES_mali.so >/dev/null 2>&1; then echo -e \"\\033[1mout/target/product/hikey970/system/vendor/lib/egl/libGLES_mali.so: \\033[31merror:\\033[0m\\033[1m\" 'found ELF prebuilt in PRODUCT_COPY_FILES, use cc_prebuilt_binary / cc_prebuilt_library_shared instead.'  \"\\033[0m\" >&2; echo -e \"\\033[1mout/target/product/hikey970/system/vendor/lib/egl/libGLES_mali.so: \\033[31merror:\\033[0m\\033[1m\" 'found ELF file: device/linaro/hikey/hikey970/hisilicon_libs/lib/libGLES_mali.so'  \"\\033[0m\" >&2; false; fi ) && (mkdir -p out/target/product/hikey970/system/vendor/lib/egl/ ) && (rm -f out/target/product/hikey970/system/vendor/lib/egl/libGLES_mali.so ) && (cp \"device/linaro/hikey/hikey970/hisilicon_libs/lib/libGLES_mali.so\" \"out/target/product/hikey970/system/vendor/lib/egl/libGLES_mali.so\" )"
out/target/product/hikey970/system/vendor/lib/egl/libGLES_mali.so: error: found ELF prebuilt in PRODUCT_COPY_FILES, use cc_prebuilt_binary / cc_prebuilt_library_shared instead. 
out/target/product/hikey970/system/vendor/lib/egl/libGLES_mali.so: error: found ELF file: device/linaro/hikey/hikey970/hisilicon_libs/lib/libGLES_mali.so 
09:14:21 ninja failed with: exit status 1

#### failed to build some targets (8 seconds) ####

The error message you posted tells you what you need to change to fix it.

But I think you probably have a bigger job ahead of you than you think and really should do some more radical changes. Like switching it to drm_hwcomposer and mesa instead of using that blob.

My suggestion would be to take the upstream supported repository for hikey960, and adapt it to the 970.