My current setup is quite exotic, and I could use some clarification.
I am running on a Pinebook Pro, powered by a Quad Cortex-A53, 64-bit CPU. The OS is a 64-bit version of Debian:
$ uname -a
Linux pinebook 4.4.196 #1 SMP Tue Oct 15 16:54:21 EDT 2019 aarch64 GNU/Linux
By default however only armhf architecture was enabled:
$ dpkg --print-architecture
armhf
Since I wanted to run aarch64 binaries I added the corresponding architecture:
$ dpkg --add-architecture arm64
$ apt update && apt upgrade
$ apt install gcc-6-base:arm64 libc6:arm64 libgcc1:arm64
This worked without problems. However, after this I found myself not being able to run another 32-bit binary anymore because suddenly /lib/ld-linux.so.3 had disappeared. Inspecting it gave me the following output.
$ file openocd
openocd: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=363651b03c33118c80584e99b6f876c7a8663325, stripped
Indeed, ld-linux.so.3 was missing. In its place I found architecture-specific symbolic links:
$ ls /lib
aarch64-linux-gnu firmware ld-linux-armhf.so.3 systemd
arm-linux-gnueabihf ifupdown lsb terminfo
cpp init modprobe.d udev
dhcpcd ld-linux-aarch64.so.1 modules
Since I needed ld-linux.so.3 from armhf architecture I looked for it under /lib/arm-linux-gnueabihf/ and sure enough there it was. To solve my problem I then linked it in /lib, and the binary worked again.
$ ln -s /lib/arm-linux-gnueabihf/ld-linux.so.3 /lib/ld-linux.so.3
Now, the question: to fix this problem I had to mess directly with /lib, which is not ideal. What would be the preferred solution?