Anbox编译求助

游戏讨论
回复
sakitsuki_asahi
帖子: 1
注册时间: 2024-08-12 15:42
系统: Ubuntu22.04LTS(x64)

Anbox编译求助

#1

帖子 sakitsuki_asahi » 2024-08-12 15:43

在Ubuntu22.04LTS(X86_64)上安装Anbox会出现各种问题,不是安装文件丢失就是编译器版本过新,代码不能用。我现在解决了大部分问题,就差最后那个ashmem安装不上,我看百度贴吧Anbox吧已经凉了,希望这里会有人帮我吧。
懒得再去snap上下载了,我选择搬仓库源码编译。
首先是把仓库搬下来。
国内搬github仓库很慢,安装一下fastgithub加速clone速度。

代码: 全选

cd ~
wget https://gitee.com/chcrazy/FastGithub/releases/download/2.1.4/fastgithub_linux-x64.zip
7z x fastgithub_linux-x64.zip
cd fastgithub_linux-x64
./fastgithub
然后手动配置一下代理到http://127.0.0.1:38457
完成
然后需要安装一下前置

代码: 全选

sudo apt install build-essential cmake cmake-data debhelper dbus google-mock \
    libboost-dev libboost-filesystem-dev libboost-log-dev libboost-iostreams-dev \
    libboost-program-options-dev libboost-system-dev libboost-test-dev \
    libboost-thread-dev libcap-dev libexpat1-dev libsystemd-dev libegl1-mesa-dev \
    libgles2-mesa-dev libglm-dev libgtest-dev liblxc1 \
    libproperties-cpp-dev libprotobuf-dev libsdl2-dev libsdl2-image-dev lxc-dev \
    pkg-config protobuf-compiler python3-minimal
下面是clone仓库和编译过程

代码: 全选

cd ~
git clone https://github.com/anbox/anbox.git --recurse-submodules
cd anbox
之后你可以选择手动一点或者自动一点
自动:

代码: 全选

./build.sh
手动:

代码: 全选

mkdir build
cmake ..
make
make install
到这里就基本完成了
出现的问题可能有:
1.cmake阶段有文件缺失:
检查git clone最后有没有加--recurse-submodules
检查网络环境,fastgithb是否正确启动,网络全局代理是否启用
2.make出现:

代码: 全选

[src/CMakeFiles/anbox-core.dir/build.make:1268:src/CMakeFiles/ax-core.dir/anbox/platform/sdl/window.cpp.o] 错误 1
重新安装SDL
最后,install完无法启动?
检查环境:

代码: 全选

anbox check-features
检查两个设备:

代码: 全选

ls /dev/{binder,ashmem}
有输出才是正确的
没有这两个设备请看:

代码: 全选

cd ~
git clone https://github.com/anbox/anbox-modules.git
cd anbox-modules
sudo cp anbox.conf /etc/modules-load.d/
sudo cp 99-anbox.rules /lib/udev/rules.d/
sudo cp -rT ashmem /usr/src/anbox-ashmem-1
sudo cp -rT binder /usr/src/anbox-binder-1
sudo dkms install anbox-ashmem/1 //我在这步出问题
sudo dkms install anbox-binder/1
sudo modprobe ashmem_linux
sudo modprobe binder_linux
lsmod | grep -e ashmem_linux -e binder_linux
ls -alh /dev/binder /dev/ashmem
ashmem怎么安装?
正常来说到~/anbox-modules/ashmem下make & make install就好了
我在make时遇到两个编译错误:

代码: 全选

/home/sakitsuki_asahi/anbox-modules/ashmem/ashmem.c: In function ‘ashmem_mmap’:
/home/sakitsuki_asahi/anbox-modules/ashmem/ashmem.c:393:23: error: assignment of read-only member ‘vm_flags’
  393 |         vma->vm_flags &= ~calc_vm_may_flags(~asma->prot_mask);
         |                                   ^~
/home/sakitsuki_asahi/anbox-modules/ashmem/ashmem.c: In function ‘ashmem_init’:
/home/sakitsuki_asahi/anbox-modules/ashmem/ashmem.c:877:9: error: too few arguments to function ‘register_shrinker’
  877 |         register_shrinker(&ashmem_shrinker);
         |         ^~~~~~~~~~~~~~~~~
很是棘手啊,源代码有问题!
/home/sakitsuki_asahi/anbox-modules/ashmem/ashmem.c:877:9这个问题我通过修改源代码成功解决,原因在于gcc从不知道哪个版本开始,register_shrinker函数变成两个输入了。所以把

代码: 全选

register_shrinker(&ashmem_shrinker);
修改为

代码: 全选

register_shrinker(&ashmem_shrinker, "ashmem");
即可,可是。。。
上面那个/home/sakitsuki_asahi/anbox-modules/ashmem/ashmem.c:393:23问题还没法解决。
上网查了一圈,没人和我有一样的问题。。。
官方github项目早在今年2月份就已经被archive了,我也提交不上issue。
现来求助!
求求了!
头像
astolia
论坛版主
帖子: 6703
注册时间: 2008-09-18 13:11

Re: Anbox编译求助

#2

帖子 astolia » 2024-08-12 16:08

anbox已经完成了它的历史使命,就让它安息吧。直接waydroid走起 https://docs.waydro.id/usage/install-on ... erivatives ,享受anbox没有的硬件加速,玩一些简单的3D游戏也不再是奢望了
sakitsuki_asahi 写了: 2024-08-12 15:43 原因在于gcc从不知道哪个版本开始,register_shrinker函数变成两个输入了。
register_shrinker是内核的函数,改接口也是内核在改,和gcc有什么关系
sakitsuki_asahi 写了: 2024-08-12 15:43 上面那个/home/sakitsuki_asahi/anbox-modules/ashmem/ashmem.c:393:23问题还没法解决。
用waydroid就不需要考虑这个曾被纳入内核又被踢出的东西了
回复