kali下编译AOSP报错(libncurses.so.5: cannot open shared object file)

发布于:2024-10-09 ⋅ 阅读:(83) ⋅ 点赞:(0)

编译报错信息:libncurses.so.5: cannot open shared object file: No such file or directory

image-20241004133444251

/bin/bash -c "PWD=/proc/self/cwd prebuilts/clang/host/linux-x86/clang-3289846/bin/clang -Ifr
ameworks/rs/script_api/include -Iexternal/clang/lib/Headers -MD -DRS_VERSION=24 -std=c99 -c 
-O3 -fno-builtin -emit-llvm -target renderscript64-linux-android -fsigned-char -D__x86_64__ 
-Wno-deprecated -Werror  -Werror -Wall -Wextra -Iframeworks/rs/cpu_ref -DRS_DECLARE_EXPIRED_
APIS  -x renderscript frameworks/rs/driver/runtime/rs_convert.c -o out/target/product/generi
c_x86_64/obj/RENDERSCRIPT_BITCODE/libclcore.bc_intermediates/rs_convert.bc"                 
prebuilts/clang/host/linux-x86/clang-3289846/bin/clang.real: error while loading shared libr
aries: libncurses.so.5: cannot open shared object file: No such file or directory           
01:23:25 ninja failed with: exit status 1                                                   
                                                                                            
#### failed to build some targets (4 seconds) ####

发现有问题就从网上找答案,找了一圈,网上的解决方案基本上都是用apt安装对应的库,但我把32位的和64位的对应库全部安装下来,问题也根本没解决

这时,换个角度想,其实这个共享库是有的,只是程序没找到?

于是搜索对应的库:

sudo find / -name 'libncurses.so.5'

image-20241004133911037

确实这两个文件已经存在在源码中,这时只需要创建软链接即可:

# 32bits
sudo ln -s /home/kali/aosp/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/sysroot/usr/lib32/libncurses.so.5 /usr/lib32/libncurses.so.5
# 64bits
sudo ln -s /home/kali/aosp/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/sysroot/usr/lib/libncurses.so.5 /usr/lib/libncurses.so.5 

然后再次编译,告诉我又缺失libtinfo.so.5这个库,如法炮制:

# 32bits
sudo ln -s /home/kali/aosp/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/sysroot/usr/lib32/libtinfo.so.5 /usr/lib32/libtinfo.so.5
# 64bits
sudo ln -s /home/kali/aosp/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/sysroot/usr/lib/libtinfo.so.5 /usr/lib/libtinfo.so.5

然后就能正常编译了!不得不说Linux配置问题确实很多

image-20241004134303835