【报错的LOG】
[ 2% 2150/107478] Yacc: checkpolicy <= external/selinux/checkpolicy/policy_parse.y
Failed: out/host/linux-x86/obj/EXECUTABLES/checkpolicy_intermediates/policy_parse.c
/bin/bash -c “prebuilts/misc/linux-x86/bison/bison -d -v –defines=out/host/linux-x86/obj/EXECUTABLES/checkpolicy_intermediates/policy_parse.h -o out/host/linux-x86/obj/EXECUTABLES/checkpolicy_intermediates/policy_parse.c external/selinux/checkpolicy/policy_parse.y”
prebuilts/misc/linux-x86/bison/bison: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
[ 2% 2151/107478] target C++: memory_replay_tests <= system/extras/memory_replay/tests/ThreadsTest.cpp
[ 2% 2152/107478] Lex: checkpolicy <= external/selinux/checkpolicy/policy_scan.l
[ 2% 2153/107478] build out/target/product/v12bnlite/obj/FAKE/selinux_policy_intermediates/plat_pub_policy.conf
[ 2% 2154/107478] build out/target/product/v12bnlite/obj/ETC/plat_sepolicy.cil_intermediates/plat_policy.conf
m4: device/qcom/sepolicy/private/wfdservice.te: 72: deprecated: unix_socket_connect(wfdservice,property,init) Please use set_prop(wfdservice,) instead.
[ 2% 2155/107478] target C++: nvram_hal_test <= system/nvram/hal/tests/nvram_hal_test.cc
ninja: build stopped: subcommand Failed.
13:44:48 ninja Failed with: exit status 1
make: * [run_soong_ui] Error 1
从编译错误中可看出,编译android源码时,bison中所使用的libstdc++.so.6缺失了,这个库文件不是指源码环境中缺失,而是pc中可能发生的各种情况导致在/usr/lib或/usr/lib32下缺失了libstdc++.so.6
【解决方法】
运行如下命令
sudo aptitude -f install lib32stdc++6
注意:*
1,有提供sudo apt-get install lib32stdc++6
的方法,但尝试后报错,虽然以上aptitude方法可以解决此android编译报错,但因为apt-get 的差异,可能存在其他风险
参考:
https://askubuntu.com/questions/223237/unable-to-correct-problems-you-have-held-broken-packages
2,有提供以下方法,但未亲验,留待后来者尝试
sudo apt-get install g++-multilib