debian 11 arm64 aarch64 D2000 平台编译 box86 box64 笔记

参考资料

https://github.com/ptitSeb/box86/blob/master/docs/COMPILE.md

源码地址

GitHub - ptitSeb/box86: Box86 - Linux Userspace x86 Emulator with a twist, targeted at ARM Linux devices

deb在线源地址(打不开):

Itai's box86 apt repo

源码编译

apt install gcc-arm-linux-gnueabihf

mkdir build; cd build; cmake .. -DPHYTIUM=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo; make -j8

sudo make install

安装wine64

sudo apt install wine64

安装微信(失败)

编译出来的目标文件是32位的,我们需要64位aarch64。box64?

找到box64项目

GitHub - ptitSeb/box64: Box64 - Linux Userspace x86_64 Emulator with a twist, targeted at ARM64 Linux devices

mkdir build; cd build; cmake ..; make -j8

sudo make install

启动exe失败

file分析发现这两个exe都是32位的

但是32位的box86在这个平台不能启动,需要安装额外的32位库?

sudo dpkg --add-architecture i386
sudo apt update
sudo apt install libc6:i386 libncurses5:i386 libstdc++6:i386 zlib1g:i386 gcc-10-base:i386 libstdc++6:i386

sudo apt install libc6-armhf-cross

手动创建软连接

su root
cd /lib
ln -sv /usr/arm-linux-gnueabihf/lib/libBrokenLocale-2.31.so .
ln -sv /usr/arm-linux-gnueabihf/lib/libSegFault.so .
ln -sv /usr/arm-linux-gnueabihf/lib/libanl-2.31.so .
ln -sv /usr/arm-linux-gnueabihf/lib/libc-2.31.so .
ln -sv /usr/arm-linux-gnueabihf/lib/libdl-2.31.so .
ln -sv /usr/arm-linux-gnueabihf/lib/libm-2.31.so .
ln -sv /usr/arm-linux-gnueabihf/lib/libmemusage.so .
ln -sv /usr/arm-linux-gnueabihf/lib/libnsl-2.31.so .
ln -sv /usr/arm-linux-gnueabihf/lib/libnss_compat-2.31.so .
ln -sv /usr/arm-linux-gnueabihf/lib/libnss_dns-2.31.so .
ln -sv /usr/arm-linux-gnueabihf/lib/libnss_files-2.31.so .
ln -sv /usr/arm-linux-gnueabihf/lib/libnss_hesiod-2.31.so .
ln -sv /usr/arm-linux-gnueabihf/lib/libpcprofile.so .
ln -sv /usr/arm-linux-gnueabihf/lib/libpthread-2.31.so .
ln -sv /usr/arm-linux-gnueabihf/lib/libresolv-2.31.so .
ln -sv /usr/arm-linux-gnueabihf/lib/librt-2.31.so .
ln -sv /usr/arm-linux-gnueabihf/lib/libthread_db-1.0.so .
ln -sv /usr/arm-linux-gnueabihf/lib/libutil-2.31.so .
ln -sv /usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.3 .
ln -sv /usr/arm-linux-gnueabihf/lib/ld-linux.so.3 .
ln -sv /usr/arm-linux-gnueabihf/lib/libBrokenLocale.so.1 .
ln -sv /usr/arm-linux-gnueabihf/lib/libanl.so.1 .
ln -sv /usr/arm-linux-gnueabihf/lib/libc.so.6 .
ln -sv /usr/arm-linux-gnueabihf/lib/libdl.so.2 .
ln -sv /usr/arm-linux-gnueabihf/lib/libm.so.6 .
ln -sv /usr/arm-linux-gnueabihf/lib/libnsl.so.1 .
ln -sv /usr/arm-linux-gnueabihf/lib/libnss_compat.so.2 .
ln -sv /usr/arm-linux-gnueabihf/lib/libnss_dns.so.2 .
ln -sv /usr/arm-linux-gnueabihf/lib/libnss_files.so.2 .
ln -sv /usr/arm-linux-gnueabihf/lib/libnss_hesiod.so.2 .
ln -sv /usr/arm-linux-gnueabihf/lib/libpthread.so.0 .
ln -sv /usr/arm-linux-gnueabihf/lib/libresolv.so.2 .
ln -sv /usr/arm-linux-gnueabihf/lib/librt.so.1 .
ln -sv /usr/arm-linux-gnueabihf/lib/libthread_db.so.1 .
ln -sv /usr/arm-linux-gnueabihf/lib/libutil.so.1 .

继续报错,有进步

root@debian:/usr/lib# ldd /usr/local/bin/box86

不是动态可执行文件

root@debian:/usr/lib# /usr/local/bin/box86

/usr/local/bin/box86: error while loading shared libraries: libgcc_s.so.1: cannot open shared object file: No such file or directory

root@debian:/usr/lib#

sudo apt-get install libgcc-s1:armhf

成功解决 aarch64 系统下 box86 "没有那个文件或目录"

继续报错

yeqiang@debian:~/Downloads$ BOX86_PATH=/usr/lib/i386-linux-gnu/:/usr/lib/wine/:{WINEPREFIX:-\~/.wine}/lib/:{WINEARCH}/lib WINEDEBUG=-all box86 wine WeChatSetup.exe

Box86 with Dynarec v0.3.5 f2496984 built on Jan 12 2024 14:27:10

Error: reading elf header of /usr/bin/wine-stable, trying to launch natively instead

wine: created the configuration directory '/home/yeqiang/.wine'

wine: configuration in L"/home/yeqiang/.wine" has been updated.

yeqiang@debian:~/Downloads$ echo $?

123

yeqiang@debian:~/Downloads$ BOX86_PATH=/usr/lib/i386-linux-gnu/:/usr/lib/wine/:{WINEPREFIX:-\~/.wine}/lib/:{WINEARCH}/lib WINEDEBUG=-all box86 wine64 WeChatSetup.exe

Box86 with Dynarec v0.3.5 f2496984 built on Jan 12 2024 14:27:10

Error: reading elf header of /usr/lib/wine/wine64, trying to launch natively instead

yeqiang@debian:~/Downloads$ echo $?

123

dpkg --add-architecture i386 && apt-get update && apt-get install wine32

yeqiang@debian:~/Downloads$ BOX86_PATH=/usr/lib/i386-linux-gnu/:/usr/lib/iaarch64-linux-gnu:/usr/lib/wine/:{WINEPREFIX:-\~/.wine}/lib/:{WINEARCH}/lib WINEDEBUG=-all box86 /usr/lib/wine/wine WeChatSetup.exe

Box86 with Dynarec v0.3.5 f2496984 built on Jan 12 2024 14:27:10

Box86 with Dynarec v0.3.5 f2496984 built on Jan 12 2024 14:27:10

wine: wineserver doesn't support the x86 architecture

yeqiang@debian:~/Downloads$ /usr/lib/wine/wine WeChatSetup.exe

bash: /usr/lib/wine/wine:无法执行二进制文件: 可执行文件格式错误

今天就这样吧....

AI资料:

box86 是独立应用还是需要配合wine一起使用?

Box86 是一个独立的应用,但它主要用于配合 Wine 使用,以在非 x86 架构(如 ARM)上运行 x86 架构的 Windows 应用程序。Box86 是一个 x86 指令集模拟器,通过翻译 x86 指令到运行平台的原生指令来实现这一目标。

在实践中,用户需要先在他们的 ARM 设备上安装 Wine,然后通过 Box86 来调用 Wine,以便能够在 ARM 设备上运行那些原本为 x86 架构编译的 Windows 应用程序。简而言之,Box86 和 Wine 结合起来形成了一种解决方案,使得可以在非 x86 硬件平台上运行一部分 x86 Windows 应用。

加入我要启动qq.exe,请提供完整的启动指令

要在基于 Debian 11 aarch64 架构系统上使用 Wine 和 Box86 启动 QQ.exe,你需要首先确保 Wine 和 Box86 已经正确安装并配置。以下是一个基本的示例流程:

  1. 安装 Wine 和 Box86(如果尚未安装):
复制代码

Sh

sudo apt update
sudo apt install wine64 box86

注意:由于 Debian 11 aarch64 并非原生支持 x86 应用,你可能需要从非官方源或者其他方式安装 Box86。

  1. 获取并解压QQ的Windows安装包,假设你已经将其解压到 /home/yeqiang/downloads/qq,并且 QQ.exe 位于 /home/yeqiang/downloads/qq/qq.exe

  2. 使用 Box86 运行 QQ.exe:

复制代码

Sh

BOX86_PATH=/usr/lib(box86)/lib/:/usr/lib/wine/:${WINEPREFIX:-~/.wine}/lib/:${WINEARCH}/lib WINEDEBUG=-all box86 wine /home/yeqiang/downloads/qq/qq.exe

这里需要注意,Box86 需要正确的路径来找到 Wine 的库文件。WINEPREFIX 是 Wine 的数据目录,默认在用户的家目录下 .wine 文件夹。WINEARCH 指定 Wine 的架构,对于 Box86 应该是 win32win64

由于 Wine on ARM 和 Box86 的支持程度不同,QQ 的运行效果可能受限于 Wine 和 Box86 的兼容性和功能实现。此外,QQ 在国内需要网络环境和特定的登录认证服务,可能还需要额外的配置才能正常使用。实际操作时请根据具体情况和最新版软件的文档进行相应调整。

yeqiang@debian:~/Downloads����/���/�����/���/���86���ℎ:����/���/�����/���/���86:没有那个文件或目录�������@������: /���������file/usr/local/bin/box86bash:file/usr/local/bin/box86:没有那个文件或目录yeqiang@debian: /Downloads file /usr/local/bin/box86 /usr/local/bin/box86: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, BuildID[sha1]=34a096196140c154572fbf1e25f42fb1448132a5, for GNU/Linux 3.2.0, with debug_info, not stripped

根据你提供的 file 命令输出结果,/usr/local/bin/box86 是一个 ARM 架构的 ELF 可执行文件,特别是一个 32 位小端序(LSB)的 ARM EABI5 版本 1 的可执行文件。它动态链接到了 /lib/ld-linux-armhf.so.3,并且包含调试信息但未剥离符号表。

这意味着 box86 是一个用于在 ARM 架构上运行 x86 32位应用程序的模拟器。在这个实例中,box86 自身是在 ARM 架构上运行的,它可以尝试将 x86 指令转换为 ARM 指令,从而在基于 ARM 的 Debian 系统上运行部分 x86 应用。

请注意,如果你想运行 x86_64(64位)的 Windows 应用,你需要 box64 而不是 box86box64 是对应于 x86_64 模拟的版本。而且,正如之前的回答所述,即便有了 box64,也需要 Wine 来提供 Windows API 的兼容层,并且并非所有的 Windows 应用都能够在这样的情景下顺利运行。

从错误信息上看,box86不能执行是不是因为debian系统缺少了32位库文件支持?

从你提供的信息来看,box86 是一个运行在 ARM 架构上的 32 位 ELF 可执行文件,它被设计用来在 ARM 硬件上模拟运行 x86 架构的 32 位应用程序。在 Debian 系统上,如果 box86 不能执行,可能的原因有很多,其中包括但不限于:

  1. 缺少 32 位库文件支持:在 64 位(aarch64)Debian 系统上运行 32 位程序(如 box86)确实需要 32 位库文件支持。如果没有安装 ia32-libs(对于旧版 Debian)或 multiarch 支持及相应的 32 位库,box86 可能无法运行。在 Debian 11 上,可以使用以下命令安装 32 位库支持:
复制代码

Sh

sudo dpkg --add-architecture i386
sudo apt update
sudo apt install libc6:i386 libncurses5:i386 libstdc++6:i386 zlib1g:i386 lib32gcc-s1 lib32stdc++6
  1. 缺少必要的依赖库:box86 本身也可能需要特定的依赖库才能正常工作。如果 box86 缺少运行时依赖的某个库,那么它将无法执行。

  2. 模块兼容性问题:box86 依赖的动态链接器 /lib/ld-linux-armhf.so.3 在你的系统上可能没有正确安装或不兼容当前系统版本。

  3. box86 本身的错误:如果 box86 本身存在编译或安装错误,或者与当前系统的内核或其他组件不兼容,也可能会导致无法执行。

综上所述,如果 box86 无法执行,首先应该检查是否已经安装了所有必要的 32 位库和依赖项,并且确认动态链接器的存在和兼容性。如果还有问题,建议查阅 box86 的官方文档或社区论坛,以获得更加针对性的解决方案。

yeqiang@debian:~/Downloads$ sudo dpkg --add-architecture i386 sudo apt update sudo apt install libc6:i386 libncurses5:i386 libstdc++6:i386 zlib1g:i386 lib32gcc-s1 lib32stdc++6 [sudo] yeqiang 的密码: 命中:1 http://mirrors.huaweicloud.com/debian bullseye InRelease 获取:2 http://mirrors.huaweicloud.com/debian bullseye-updates InRelease [44.1 kB] 获取:3 https://mirrors.huaweicloud.com/debian-security bullseye-security InRelease [48.4 kB] 获取:4 http://mirrors.huaweicloud.com/debian bullseye-backports InRelease [49.0 kB] 获取:5 http://mirrors.huaweicloud.com/debian bullseye/main i386 Packages [8,003 kB] 获取:6 https://mirrors.huaweicloud.com/debian-security bullseye-security/main i386 Packages [264 kB] 获取:7 https://mirrors.huaweicloud.com/debian-security bullseye-security/non-free i386 Packages [688 B] 获取:8 http://mirrors.huaweicloud.com/debian bullseye/main i386 Contents (deb) [10.2 MB] 获取:9 http://mirrors.huaweicloud.com/debian bullseye/contrib i386 Packages [45.2 kB]

获取:10 http://mirrors.huaweicloud.com/debian bullseye/contrib i386 Contents (deb) [33.6 kB]

获取:11 http://mirrors.huaweicloud.com/debian bullseye/non-free i386 Packages [78.4 kB]

获取:12 http://mirrors.huaweicloud.com/debian bullseye/non-free i386 Contents (deb) [29.2 kB]

获取:13 http://mirrors.huaweicloud.com/debian bullseye-updates/main i386 Packages [19.3 kB]

获取:14 http://mirrors.huaweicloud.com/debian bullseye-updates/main i386 Contents (deb) [90.0 kB]

获取:15 http://mirrors.huaweicloud.com/debian bullseye-backports/main i386 Packages [398 kB]

获取:16 http://mirrors.huaweicloud.com/debian bullseye-backports/main i386 Contents (deb) [1,216 kB]

获取:17 http://mirrors.huaweicloud.com/debian bullseye-backports/contrib i386 Packages [5,564 B]

获取:18 http://mirrors.huaweicloud.com/debian bullseye-backports/contrib i386 Contents (deb) [17.0 kB]

获取:19 http://mirrors.huaweicloud.com/debian bullseye-backports/non-free i386 Packages [12.5 kB]

获取:20 http://mirrors.huaweicloud.com/debian bullseye-backports/non-free i386 Contents (deb) [6,185 B]

已下载 20.6 MB,耗时 10秒 (2,155 kB/s)

正在读取软件包列表... 完成 正在分析软件包的依赖关系树... 完成 正在读取状态信息... 完成

所有软件包均为最新。 正在读取软件包列表... 完成 正在分析软件包的依赖关系树... 完成 正在读取状态信息... 完成

E: 无法定位软件包 lib32gcc-s1 E: 无法定位软件包 lib32stdc++6

看起来你的 Debian 系统在默认仓库中没有找到 lib32gcc-s1lib32stdc++6 这两个 32 位版本的库。在 Debian Bullseye 中,通常会使用类似 gcc-10-base:i386libstdc++6:i386 这样的包名代替。

尝试安装以下 32 位兼容库:

复制代码

Sh

sudo apt install libc6:i386 libncurses5:i386 libstdc++6:i386 zlib1g:i386 gcc-10-base:i386 libstdc++6:i386

请注意,gcc-10-base:i386 和第二个 libstdc++6:i386 可能只需安装一次即可,但如果系统提示你需要哪个版本的 gcc-10-baselibstdc++6 的 32 位版本,请按照提示安装相应的版本。

另外,对于较新的 Debian 版本,如果 gcc-10-base:i386 仍然找不到,你可能需要查找对应于你系统上安装的 GCC 版本的 32 位兼容包。你也可以查阅 Debian 官方文档或社区论坛来获取关于在 aarch64 上安装 32 位库的最新指引。

相关推荐
Flying_Fish_roe2 小时前
linux-软件包管理-包管理工具(Debian 系)
linux·运维·debian
送南阳马生序4 天前
Cubieboard2(一) 官方镜像使用与配置
linux·debian·arm
读书,代码与猫4 天前
【裸机装机系列】3.kali(ubuntu)-更新sources.list并重启
linux·经验分享·后端·ubuntu·debian
白总Server5 天前
rust解说
linux·开发语言·后端·golang·rust·debian·php
telllong5 天前
Debian 包管理工具apt使用
运维·debian
不想秃头的烟花7 天前
Linux安装软件的方法
linux·debian·redhat·软件仓库
地球空间-技术小鱼7 天前
在 Debian 12 上安装中文五笔输入法
运维·debian
fareast_mzh12 天前
Setting up fail2ban on Debian
运维·debian
我的世界没光14 天前
PVE开启核显直通
linux·debian·pve·核显直通
入秋的大橘16 天前
VirtualBox Debian 自动安装脚本
运维·chrome·debian