How to solve “error while loading shared libraries” when trying to run an arm binary with qemu-arm?

后端 未结 6 731
-上瘾入骨i
-上瘾入骨i 2021-02-04 08:40

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.

When I tr

6条回答
  •  猫巷女王i
    2021-02-04 09:06

    I also met this problem when running a C program with assembly code. My solution is to build the executable with the option "-static", for instance

    arm-linux-gnueabi-gcc -static -g main.c square.s
    

    Then

    qemu-arm a.out
    

    will not report the error saying "can not find the /lib/ld-linux.so.3".

    The only drawback is that the executable could be with a large size. But it's helpful when you just want to test your code.

    Of course, you can go with the method from Balau(see artless noise's answer). But if you don't want to feel frustrated by something like "UART serial ports" in this step, which is only to run a simple "test" function, go for a try of my fix.

提交回复
热议问题