#!/usr/bin/bash
# Ugly workaround for building on systems with older GLIBC versions (<2.18) on Centos7/RHEL7.x etc
## ld-loader updates to prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.19-4.8
# Before you patch, put GLIBC2.19 into prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.19-4.8
# for all, patchelf all so/elf in prebuilts/clang/host/linux-x86/clang-xxxx
# if you build arm only, patchelf also prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin
# if you build x86_64 only, patchelf also prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/bin
# if you build arm64, patchelf also prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin
DIRS_TO_PATCH="prebuilts/clang/host/linux-x86/clang-4691093 prebuilts/clang/host/linux-x86/clang-4579689 prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/bin"
for path_dir in $DIRS_TO_PATCH; do \
for elf_file in $(find $path_dir -type f -print0 | xargs -0 -n 10 file -i | egrep "application\/x-sharedlib|application\/x-executable" | cut -d ":" -f 1); do
if [[ $elf_file != *.so* ]]; then
./patchelf --set-interpreter $PWD/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.19-4.8/sysroot/usr/lib/ld-linux-x86-64.so.2 $elf_file
# echo $elf_file
fi
#echo $elf_file
./patchelf --set-rpath "\$ORIGIN/../../../../../gcc/linux-x86/host/x86_64-linux-glibc2.19-4.8/sysroot/usr/lib/:\$ORIGIN/../lib64:\$ORIGIN/../../../../../gcc/linux-x86/host/x86_64-linux-glibc2.19-4.8/x86_64-linux/lib64/" $elf_file
done
done
patchelf for aosp9/10 build on Centos7/Glibc<2.18
猜你喜欢
转载自blog.csdn.net/hushui/article/details/112966751
今日推荐
周排行