每当lunch或者make的时候这玩意就会跳出来,虽然不会影响构建,但看着心烦。
使用 cat out/dumpvars-soong.log
看一下输出,发现错误之处:
2024/08/29 02:42:24.853454 build/soong/ui/logger/logger.go:297: [prebuilts/build-tools/linux-x86/bin/nsjail -H android-build -e -u nobody -g nobody -R / -B /tmp -B /home/kmiit/los -B /home/kmiit/los/out -B /home/kmiit/los/out/dist --disable_clone_newcgroup -- /bin/bash -c if [ $(hostname) == "android-build" ]; then echo "Android" "Success"; else echo Failure; fi]
2024/08/29 02:42:24.871828 build/soong/ui/build/sandbox_linux.go:130: Build sandboxing disabled due to nsjail error.
再往下看,发现报错:
/bin/bash: line 1: hostname: command not found
根据上面的报错的命令,发现是Arch Linux使用 hostnamectl
代替了 hostname
,简单把 hostnamectl
链接过去发现没解决报错,手动写一个 hostname
:
#!/bin/bash
echo android-build
再lunch一下,发现没报错了。于是根据报错的那行命令优化一下脚本:
/bin/hostname:
#!/bin/bash
if [[ `id -u` == 65534 && `id -g` == 65534 ]]; then
echo android-build;
else
hostnamectl hostname $1;
fi
解决。