如何解决“加载共享库时出错"?尝试使用qemu-arm运行arm二进制文件时? [英] How to solve "error while loading shared libraries" when trying to run an arm binary with qemu-arm?
问题描述
我正在运行Linux Mint 14,安装了qemu,qemu-user和gnueabi工具链.我用arm-linux-gnueabi-gcc test.c -o test
编译了test.c.
I'm running Linux Mint 14 with qemu, qemu-user, and the gnueabi toolchain installed. I compiled test.c with arm-linux-gnueabi-gcc test.c -o test
.
当我尝试运行qemu-arm /usr/arm-linux-gnueabi/lib/ld-linux.so.3 test
我收到一条错误消息:test: error while loading shared libraries: test: cannot open shared object file: No such file or directory
.正如我之前尝试过的那样,运行qemu-arm test
会给出/lib/ld-linux.so.3: No such file or directory
I get an error saying: test: error while loading shared libraries: test: cannot open shared object file: No such file or directory
. Running qemu-arm test
, as I've previously tried, gives /lib/ld-linux.so.3: No such file or directory
但是,该文件确实存在并且可以访问.
However, the file does exist and is reachable.
$ stat /usr/arm-linux-gnueabi/lib/ld-linux.so.3
File: `/usr/arm-linux-gnueabi/lib/ld-linux.so.3' -> `ld-2.15.so'
Size: 10 Blocks: 0 IO Block: 4096 symbolic link
Device: 801h/2049d Inode: 4083308 Links: 1
Access: (0777/lrwxrwxrwx) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2013-04-22 16:19:48.090613901 -0700
Modify: 2012-09-21 08:31:29.000000000 -0700
Change: 2013-04-22 15:58:41.042542851 -0700
Birth: -
有人知道我如何让qemu运行arm程序而不必模拟整个arm Linux内核吗?
Does anyone know how I can make qemu run an arm program without having to emulate an entire arm Linux kernel?
test.c是
#include <stdio.h>
int main() {
printf("this had better work\n");
}
和file test
是
test: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.31, BuildID[sha1]=0xf2e49db65394b77c77ee5b65b83c0cc9220cbfc0, not stripped
推荐答案
如果要在没有Linux的情况下运行 ARM ,则至少需要一个不同的编译器. arm-linux-gnueabi-gcc
是 Linux 的编译器.编译器和libc
是紧密链接的.您将需要一个带有 qemu 的可移植层的newlib
编译器. 移植newlib
If you want to run ARM without Linux, then you need a different compiler (at least). arm-linux-gnueabi-gcc
is a compiler for Linux. The compiler and libc
are intimately linked. You will need a newlib
compiler with a portability layer for qemu.porting newlib
请参阅:巴劳和 Google newlib + qemu . newlib
端口托管在 Github 上,与 Balau 博客相同.
See: Balau and Google newlib+qemu. A newlib
port is hosted at Github and seems to the same as the Balau blog.
通常,非Linux gcc称为arm-none-eabi-gcc
.某些配置脚本可以识别前缀 arm-none-eabi-.
Typically a non-Linux gcc is called arm-none-eabi-gcc
. The prefix arm-none-eabi- is recognized by some configure scripts.
这篇关于如何解决“加载共享库时出错"?尝试使用qemu-arm运行arm二进制文件时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!