You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在gem5系统调用仿真(SE)模式下运行动态链接可执行文件?

Fixing "fatal: Unable to open dynamic executable's interpreter" in gem5 SE Mode for ARM Dynamic Binaries

I've run into this exact issue before, and while the gem5 FAQ might claim dynamic executables aren't supported in SE mode, your specific commit (49f96e7b77925837aa5bc84d4c3453ab5f07408e) does support them—you just need to point gem5 to your cross-toolchain's libraries and interpreter without copying anything to your host's root directory. Here are the best ways to do this, similar to QEMU's -L flag:

1. Use --root to specify your cross-toolchain's sysroot

This is the closest equivalent to QEMU's -L option. Pass your cross-toolchain's sysroot directory as gem5's root filesystem, so it looks for the interpreter and libraries there instead of your host's root:

./out/common/gem5/build/ARM/gem5.opt ./gem5/gem5/configs/example/se.py \
  -c ./a.out \
  --root=/path/to/your/arm-cross-toolchain/sysroot

Replace /path/to/your/arm-cross-toolchain/sysroot with the actual sysroot path of your ARM toolchain (usually something like ~/arm-linux-gnueabihf/sysroot or the libc directory inside your toolchain folder). Gem5 will resolve paths like /lib/ld-linux-armhf.so.3 relative to this specified root.

2. Directly specify the interpreter path

If you know the exact path to your ARM interpreter, use the --interpreter flag to tell gem5 where to find it:

./out/common/gem5/build/ARM/gem5.opt ./gem5/gem5/configs/example/se.py \
  -c ./a.out \
  --interpreter=/path/to/your/arm-cross-toolchain/sysroot/lib/ld-linux-armhf.so.3

Make sure all dependent libraries are also in a path gem5 can access—you can pass LD_LIBRARY_PATH to the emulated environment using the --env flag if needed:

--env="LD_LIBRARY_PATH=/path/to/your/arm-cross-toolchain/sysroot/lib"

3. Set rpath at compile time

When cross-compiling your program, embed the toolchain's library path directly into the binary using -rpath:

arm-linux-gnueabihf-gcc your-source.c -o a.out -Wl,-rpath=/path/to/your/arm-cross-toolchain/sysroot/lib

This way, gem5 will automatically look in the specified rpath for the interpreter and libraries when running the binary, no extra flags needed at runtime.

Quick note on why x86_64 works natively

Your x86_64 binaries run fine because gem5 defaults to using your host's root filesystem and native interpreter for same-architecture binaries. Cross-compiled ARM binaries need explicit configuration to use the ARM-specific toolchain assets instead.

内容的提问来源于stack exchange,提问作者Ciro Santilli

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 06:59:56