Web lists-archives.com

Re: [Multiarch] armhf on arm64 is not working


On Mon, 28 Aug 2017 22:50:17 +0200
Adam Cécile <adam.cecile@xxxxxxxx> wrote:

> Hello,
> I'm trying to set up armhf on arm64 stretch but it does not work:
> file /tmp/bash/bin/bash
> /tmp/bash/bin/bash: ELF 32-bit LSB executable, ARM, EABI5 version 1 
> (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for 
> GNU/Linux 3.2.0, BuildID[sha1]=e3aedef3dd05738b73e7756ddb9be88dd0f9a8ce, 
> stripped
>   ldd /tmp/bash/bin/bash
>      not a dynamic executable

That's supposed to happen. Try 'objdump -p' instead.

> /tmp/bash/bin/bash
> -bash: /tmp/bash/bin/bash: cannot execute binary file: Exec format error

And that is supposed to happen too.

> Any idea about what's wrong ? Everything looks ok to me. Is it possible 
> to be kernel related ?

In a way that's kernel related.

What multiarch is - it's an ability to co-install libraries from
different architectures (for cross-compilation usually).
What multiarch is not - it's not an ability to use foreign architecture
libraries to run foreign architecture binaries.

The reason being - an executable binary contains CPU instructions that
are suited to CPU of designated architecture only. In your example it's
armv5. Your CPU is amd64 and its unable to interpret those - it can only
understand i386 and amd64 instruction sets.

Due to this Linux kernel (any reasonable OS kernel that I dealt with, in
fact) refuses to acknowledge that foreign architecture binaries could be
executed at all. Hence 'Exec format error' from the direct execution
and 'not a dynamic executable' from ldd (which is special form of
binary execution anyway).

There's a way around this limitation, and it involves CPU instruction
translation via qemu-user. Assuming that you have 'qemu-user-static'
installed, this should work:

qemu-arm-static /tmp/bash/bin/bash