AOSP Build Error - error: found ELF prebuilt in PRODUCT_COPY_FILES, use cc_prebuilt_binary / cc_prebuilt_library_shared instead

Viewed 2086

I am trying to flash Android Q User-debug build into my Pixel2 XL device from my mac pc but its getting failed with the below error message.

[ 27% 31880/114806] Copy non-ELF: out/target/product/taimen/system/lib/lib-imsv
FAILED: out/target/product/taimen/system/lib/lib-imsvideocodec.so
/bin/bash -c "(if prebuilts/clang/host/darwin-x86/clang-r383902/bin/llvm-readobj -h vendor/qcom/taimen/proprietary/lib-imsvideocodec.so >/dev/null 2>&1; then echo -e \"\\033[1mout/target/product/taimen/system/lib/lib-imsvideocodec.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/taimen/system/lib/lib-imsvideocodec.so: \\033[31merror:\\033[0m\\033[1m\" 'found ELF file: vendor/qcom/taimen/proprietary/lib-imsvideocodec.so' \"\\033[0m\" >&2; false; fi ) && (mkdir -p out/target/product/taimen/system/lib/ ) && (rm -f out/target/product/taimen/system/lib/lib-imsvideocodec.so ) && (cp \"vendor/qcom/taimen/proprietary/lib-imsvideocodec.so\" \"out/target/product/taimen/system/lib/lib-imsvideocodec.so\" )"
out/target/product/taimen/system/lib/lib-imsvideocodec.so: error: found ELF prebuilt in PRODUCT_COPY_FILES, use cc_prebuilt_binary / cc_prebuilt_library_shared instead. 
out/target/product/taimen/system/lib/lib-imsvideocodec.so: error: found ELF file: vendor/qcom/taimen/proprietary/lib-imsvideocodec.so 
[ 27% 31881/114806] Copy non-ELF: out/target/product/taimen/system/lib/lib-imsv
FAILED: out/target/product/taimen/system/lib/lib-imsvtextutils.so
/bin/bash -c "(if prebuilts/clang/host/darwin-x86/clang-r383902/bin/llvm-readobj -h vendor/qcom/taimen/proprietary/lib-imsvtextutils.so >/dev/null 2>&1; then echo -e \"\\033[1mout/target/product/taimen/system/lib/lib-imsvtextutils.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/taimen/system/lib/lib-imsvtextutils.so: \\033[31merror:\\033[0m\\033[1m\" 'found ELF file: vendor/qcom/taimen/proprietary/lib-imsvtextutils.so' \"\\033[0m\" >&2; false; fi ) && (mkdir -p out/target/product/taimen/system/lib/ ) && (rm -f out/target/product/taimen/system/lib/lib-imsvtextutils.so ) && (cp \"vendor/qcom/taimen/proprietary/lib-imsvtextutils.so\" \"out/target/product/taimen/system/lib/lib-imsvtextutils.so\" )"
out/target/product/taimen/system/lib/lib-imsvtextutils.so: error: found ELF prebuilt in PRODUCT_COPY_FILES, use cc_prebuilt_binary / cc_prebuilt_library_shared instead. 
out/target/product/taimen/system/lib/lib-imsvtextutils.so: error: found ELF file: vendor/qcom/taimen/proprietary/lib-imsvtextutils.so 
22:34:16 ninja failed with: exit status 1

Below is my build steps :

mkdir ~/bin
export PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
repo init -u https://android.googlesource.com/platform/manifest -b master
repo sync -c -j4
wget https://dl.google.com/dl/android/aosp/google_devices-taimen-qq1a.191205.008-f4537f93.tgz
tar xvf google_devices-taimen-qq1a.191205.008-f4537f93.tgz
./extract-google_devices-taimen.sh
wget https://dl.google.com/dl/android/aosp/qcom-taimen-qq1a.191205.008-760afa6e.tgz
tar xvf qcom-taimen-qq1a.191205.008-760afa6e.tgz
./extract-qcom-taimen.sh
. build/envsetup.sh
lunch aosp_taimen-userdebug
m

Since for the first time I am building the AOSP I couldn't understand the error found ELF prebuilt in PRODUCT_COPY_FILES, use cc_prebuilt_binary / cc_prebuilt_library_shared instead.

Please advise me what to do. Thank you.

2 Answers

This Issue Link might be helpful for you to read.

For your issue, I believe it's related to the device binary you download.

Try to download the newest, which is listed at the bottom, for you pixel 2 XL.

Redo the extract*.sh part and make again!

I got the same error. yes, we can add this flag to BoardConfig.mk, but it is not a clean solution since Google encourages the use of Android.bp files instead of Makefiles. Thant's what the soong suggested the use of these modules (cc_prebuilt_binary / cc_prebuilt_library_shared).

In my case, solved this problem by creating Android.bp file in the repo where I put my prebuilt libraries, then I added them as product packages in the product mk file. this is an example :

Android.bp :

cc_prebuilt_library {
name: "product_package_name_in_MK_file",
relative_install_path: "sub_lib/sub_sub_lib",
stem: "output_file_name", // .so will be added automatically to out file name.
compile_multilib: "both",
multilib: {
lib32: {
srcs: ["path for src 32bit lib"],
},
lib64: {
srcs: ["path for src 64bit lib"],
},
},
strip: {
none:true,
},
allow_undefined_symbols: true,
check_elf_files: false,
vendor: true,
enabled: true,
}

product_mk file :

...
PRODUCT_PACKAGES += product_package_name_in_MK_file
...
Related