Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在龙架构上用 qemu-user 模式运行特定的其他架构的动态链接程序会报错 #75

Open
felixonmars opened this issue Dec 18, 2024 · 5 comments
Labels
AREA: Emulation Related to emulation (NOT virtualization -- host and guest must have different arches)

Comments

@felixonmars
Copy link
Member

felixonmars commented Dec 18, 2024

复现方式 & 典型报错信息,以 Loong Arch Linux 环境为例:

  • 安装 qemu-user-static:
    pacman -S qemu-user-static

  • 下载和准备 Arch Linux x86_64 和/或 riscv64 rootfs:

wget https://mirrors.pku.edu.cn/archlinux/iso/2024.12.01/archlinux-bootstrap-x86_64.tar.zst
tar xf archlinux-bootstrap-x86_64.tar.zst
wget https://mirrors.pku.edu.cn/archriscv/images/archriscv-2024-09-22.tar.zst
(mkdir archriscv && cd archriscv && tar xf ../archriscv-2024-09-22.tar.zst)
  • 尝试运行一些特定程序:
$ qemu-x86_64-static -L root.x86_64 root.x86_64/usr/bin/bash
root.x86_64/usr/bin/bash: error while loading shared libraries: libreadline.so.8: failed to map segment from shared object
$ qemu-riscv64-static -L archriscv archriscv/usr/bin/msgfmt
archriscv/usr/bin/msgfmt: error while loading shared libraries: libgettextlib-0.22.5.so: failed to map segment from shared object

随着 Arch 镜像版本更新,每次能复现出这个问题的二进制/动态链接库不完全相同。截至当前的 Arch x86_64 和 riscv64 能复现这个问题的具体程序/动态链接库在彼此架构的 qemu-user 环境中能正常运行。

两个月前向武老师请教时,有建议过尝试 4k 页的内核,目前还没有试过。LCPU 仓库内核目前保持上游默认的 16k 页。

@yzewei
Copy link

yzewei commented Jan 6, 2025

配置16K页的内核下确实没有出现问题:

$ ./../qemu-static/qemu-riscv64 -L ./ usr/bin/ls  -a
.  ..  bin  boot  dev  etc  home  lib  mnt  opt  proc  root  run  sbin	srv  sys  tmp  usr  var

@felixonmars
Copy link
Member Author

可能需要多尝试一些程序,不是每个库都能触发问题。

@yzewei
Copy link

yzewei commented Jan 6, 2025

可能需要多尝试一些程序,不是每个库都能触发问题。

确实在user模式下有部分工具会出现库无法找到的问题

@xry111
Copy link
Member

xry111 commented Jan 11, 2025

两个月前向武老师请教时,有建议过尝试 4k 页的内核,目前还没有试过。LCPU 仓库内核目前保持上游默认的 16k 页。

用 16/64k 页的 aarch64 能复现吗?

@jiegec
Copy link

jiegec commented Jan 12, 2025

两个月前向武老师请教时,有建议过尝试 4k 页的内核,目前还没有试过。LCPU 仓库内核目前保持上游默认的 16k 页。

用 16/64k 页的 aarch64 能复现吗?

16k/64k 的 aarch64 有一样的问题。

@xen0n xen0n added the AREA: Emulation Related to emulation (NOT virtualization -- host and guest must have different arches) label Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AREA: Emulation Related to emulation (NOT virtualization -- host and guest must have different arches)
Projects
None yet
Development

No branches or pull requests

5 participants