MSIPO技术圈 首页 IT技术 查看内容

FEX-Emu在Debian/Ubuntu系统使用

2024-03-25

1. Debootstrap子系统安装(可选)

sudo apt-get install debootstrap
sudo debootstrap --arch arm64 bullseye ~/arch/debian https://mirrors.tuna.tsinghua.edu.cn/debian/
sudo debootstrap --variant=buildd --arch arm64 bullseye ~/arch/debian https://mirrors.tuna.tsinghua.edu.cn/debian/

安装成功后,进入目录切换环境

cd ~/arche/debian
sudo chroot .

2. Debian/Ubuntu依赖包安装

按照官网要求安装全部依赖库:

apt install git cmake ninja-build pkgconf ccache clang llvm lld binfmt-support libsdl2-dev libepoxy-dev libssl-dev python-setuptools g++-x86-64-linux-gnu libgcc-10-dev-i386-cross g++-x86-64-linux-gnu libgcc-10-dev-amd64-cross nasm python3-clang libstdc++-10-dev-i386-cross libstdc++-10-dev-amd64-cross libstdc++-10-dev-arm64-cross squashfs-tools squashfuse libc-bin  libc6-dev-i386-amd64-cross lib32stdc++-10-dev-amd64-cross 

如果提示找不到包可以配置一下源 /etc/apt/sources.list: (安装成功请略过此步骤)

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
deb https://security.debian.org/debian-security bullseye-security main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian bullseye main

更新源后再次安装:(安装成功请略过此步骤)

apt update

3. 获取FEX-Emu源码并编译

在子系统获取代码和子模块:

git clone --recurse-submodules https://github.com/FEX-Emu/FEX.git

在这里插入图片描述编译源码:

cd FEX
 mkdir Build
 cd Build
 CC=clang CXX=clang++ cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DUSE_LINKER=lld -DENABLE_LTO=True -DBUILD_TESTS=False -DENABLE_ASSERTIONS=False -G Ninja ..

在这里插入图片描述
configure完成后,执行ninja

ninja

我这里会报如下错,可能我安装的libstdc++的版本问题 (没有出错可以略过):

../Source/Tools/pidof/pidof.cpp:56:24: error: no matching constructor for initialization of 'std::istringstream' (aka 'basic_istringstream<char>')

暂时强制改一下代码:

std::istringstream ss{static_cast<std::string>(Omit)};

重新执行,没有错了

CC=clang CXX=clang++ cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DUSE_LINKER=lld -DENABLE_LTO=True -DBUILD_TESTS=False -DENABLE_ASSERTIONS=False -G Ninja ..

执行安装命令:

root@nfs-PC:/FEX/Build# ninja install
[0/2] Re-checking globbed directories...
[0/1] Install the project...
-- Install configuration: "RELEASE"
-- Installing: /usr/share/man/man1/FEX.1.gz
-- Installing: /usr/lib/libFEXCore.a
..........................................
-- Installing: /usr/bin/FEXServer
-- Installing: /usr/bin/FEXBash
-- Installing: /usr/bin/FEXLoader
-- Installing: /usr/bin/FEXInterpreter
-- Installing: /usr/bin/FEXUpdateAOTIRCache
-- Installing: /usr/bin/FEXpidof
-- Installing: /usr/share/fex-emu/AppConfig/client.json
-- Installing: /usr/share/fex-emu/ThunksDB.json

4. 根文件系统RootFS安装

当前的debian系统,默认没有curl,fex工具会用到,因此需要先安装一下:
在这里插入图片描述

上述编译并安装完成后可以执行FEXRootFSFetcher来安装RootFS,终端会提示你rootfs没有找到,是否下载, 输入y:
在这里插入图片描述
当前验证的机器用的是debian11版本,没有对应的版本,我们就用Ubuntu 20.04
在这里插入图片描述

下载完成后、解压配置为默认RootFS:
在这里插入图片描述

5. 基于 FEX-Emu 运行应用

直接运行安装目录下的FEXBash命令来启动:
在这里插入图片描述
接下来启动一下wine看一下效果,这里我用的是自己编译的wine9.4, 关于如何编译wine可以参照 Wine编译环境搭建及使用完整流程详细笔记
, 会发现有如下错误:
在这里插入图片描述
回到宿主机执行一下: xhost + 让其允许子系统使用其显示窗口

xhost + 
access control disabled, clients can connect from any host

回到FEXBash-root中再次启动

FEXBash-root@nfs-PC:/home> ./install/opt/winux/wine9.4/usr/local/bin/winecfg     

可以看到如下效果:
在这里插入图片描述

/home/install/opt/winux/wine9.4/usr/local/bin/wine notepad

在这里插入图片描述

相关阅读

热门文章

    手机版|MSIPO技术圈 皖ICP备19022944号-2

    Copyright © 2024, msipo.com

    返回顶部