Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#1001156: qemu-arm needs some help with finding libs

2,743 views
Skip to first unread message

Richard B. Kreckel

unread,
Dec 5, 2021, 7:40:03 AM12/5/21
to
Package: qemu-user

Version: 1:6.1+dfsg-8+b1



It seems like one has to help qemu-arm a little in order to run ARM
executables. (This procedure does not seem to be necessary for other
targets - at least not for qemu-ppc64le where I tried.)




$ cat hello.c

#include <stdio.h>

int main()

{

printf("hello world!\n");

}

$ arm-linux-gnueabihf-gcc-11 hello.c

$ qemu-arm a.out

qemu-arm: Could not open '/lib/ld-linux-armhf.so.3': No such file or
directory

$ ln -s /usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.3 /lib/

$ qemu-arm a.out

a.out: error while loading shared libraries: libc.so.6: cannot open
shared object file: No such file or directory

$ export LD_LIBRARY_PATH=/usr/arm-linux-gnueabihf/lib

$ qemu-arm a.out

hello world!



Both seem to be necessary to run a binary: setting LD_LIBRARY_PATH and
providing ld-linux-armhf.so.3 in /lib/
. It should work without these steps.

-rbk.
--

.''`. Richard B. Kreckel

: :' : <kre...@debian.org>

`. `' <kre...@in.terlu.de>

`- <http://in.terlu.de/~kreckel/>

Richard B. Kreckel

unread,
Dec 5, 2021, 11:40:03 AM12/5/21
to
On 05.12.21 14:34, Michael Tokarev wrote:
> If you want your foreign binary to run, enable this foreign architecture
> in dpkg (--add-architecture), run apt update, and install the corresponding
> libc - this one will install things into the right place.

All this has already been done. (Otherwise, there wouldn't have been
/usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.3, which is provided by
package libc6-armhf-cross_2.32-1cross4.)

> I don't know details and reasons about the /usr/arb-linux/gnueabihf/ stuff
> and why it is not in /lib. But it is definitely not qemu's way to change
> the way regular linux system works.

Well, this is the way files are set up by Debian multiarch.

As things are, qemu-arm cannot be used by non-root users because they
need to do something only root can do. => It is broken. Why it is
broken, is the question now.

We should reopen this bug. If qemu-user is the wrong package, it should
be reassigned to another more appropriate package. (Maybe
libc6-armhf-cross?)

-rbk.

Michael Tokarev

unread,
Dec 5, 2021, 11:40:03 AM12/5/21
to
05.12.2021 19:21, Richard B. Kreckel wrote:
> On 05.12.21 14:34, Michael Tokarev wrote:
>> If you want your foreign binary to run, enable this foreign architecture
>> in dpkg (--add-architecture), run apt update, and install the corresponding
>> libc - this one will install things into the right place.
>
> All this has already been done. (Otherwise, there wouldn't have been

No.

> /usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.3, which is provided by
> package libc6-armhf-cross_2.32-1cross4.)

libc6-armhf-cross_2.32-1cross4:amd64 != libc64:armhf

/mjt

Michael Tokarev

unread,
Dec 5, 2021, 11:50:03 AM12/5/21
to
05.12.2021 19:33, Michael Tokarev wrote:
> ... libc64:armhf

libc6:armhf ofcourse. Something's wrong with my typing today :)

Thanks,

/mjt

Richard B. Kreckel

unread,
Dec 5, 2021, 12:10:03 PM12/5/21
to
On 05.12.21 17:33, Michael Tokarev wrote:
> 05.12.2021 19:21, Richard B. Kreckel wrote:
>> On 05.12.21 14:34, Michael Tokarev wrote:
>>> If you want your foreign binary to run, enable this foreign architecture
>>> in dpkg (--add-architecture), run apt update, and install the
>>> corresponding
>>> libc - this one will install things into the right place.
>>
>> All this has already been done. (Otherwise, there wouldn't have been
>
> No.

Oh, yes!

The armhf architecture *is* added (according to dpkg
--print-foreign-architectures) and the package libc6:armhf *is*
installed (according to dpkg -s libc6:armhf).

-rbk.

Aurelien Jarno

unread,
Dec 5, 2021, 2:30:03 PM12/5/21
to
libc6:armhf does provide the /lib/ld-linux-armhf.so.3. Do you have it
installed?

libc6-armhf-cross is only for gcc usage, not to execute binaries.

Regards,
Aurelien

--
Aurelien Jarno GPG: 4096R/1DDD8C9B
aure...@aurel32.net http://www.aurel32.net

Richard B. Kreckel

unread,
Dec 5, 2021, 5:10:03 PM12/5/21
to
On 05.12.21 20:22, Aurelien Jarno wrote:
> libc6:armhf does provide the /lib/ld-linux-armhf.so.3. Do you have it installed?

I see. Maybe I messed up that symlink while trying to find an error.

Say, do users have to export LD_LIBRARY_PATH=/usr/arm-linux-gnueabihf/lib?

I am asking because without it I am getting
a.out: error while loading shared libraries: libstdc++.so.6: cannot open
shared object file: No such file or directory

when running qemu-arm a.out. (libstdc++6-armhf-cross is installed.)

-rbk.

Aurelien Jarno

unread,
Dec 5, 2021, 5:30:04 PM12/5/21
to
On 2021-12-05 23:01, Richard B. Kreckel wrote:
> On 05.12.21 20:22, Aurelien Jarno wrote:
> > libc6:armhf does provide the /lib/ld-linux-armhf.so.3. Do you have it installed?
>
> I see. Maybe I messed up that symlink while trying to find an error.
>
> Say, do users have to export LD_LIBRARY_PATH=/usr/arm-linux-gnueabihf/lib?

No. The libraries in /usr/arm-linux-gnueabihf/lib are for
cross-compiling. You don't even need to install them for just running
binaries.

> I am asking because without it I am getting
> a.out: error while loading shared libraries: libstdc++.so.6: cannot open
> shared object file: No such file or directory
>
> when running qemu-arm a.out. (libstdc++6-armhf-cross is installed.)

You need to install libstdc++6:armhf instead.

Richard B. Kreckel

unread,
Dec 5, 2021, 5:40:03 PM12/5/21
to
On 05.12.21 23:16, Aurelien Jarno wrote:
>> I am asking because without it I am getting
>> a.out: error while loading shared libraries: libstdc++.so.6: cannot open
>> shared object file: No such file or directory
>>
>> when running qemu-arm a.out. (libstdc++6-armhf-cross is installed.)
>
> You need to install libstdc++6:armhf instead.

Aurelien, you are right. That fixes it.

This bug can indeed be closed.

All this about libfoo:arch vs. libfoo-arch-cross doesn't seem to be
documented in https://wiki.debian.org/CrossToolchains or the Debian
Multiarch HOWTO or elsewhere, does it?

-richy.
0 new messages