The goal

I want to run an ARM64 Go binary on x86_64 Kali Linux using QEMU user mode.

The problem

I got aarch64-linux-musl-cross.

~$ wget https://musl.cc/aarch64-linux-musl-cross.tgz
~$ tar -xvf aarch64-linux-musl-cross.tgz

I then used ~/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc to compile a simple hello world Go program. It compiled exactly as I wanted it to.

~/go_projects/bin$ file hello
hello: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-aarch64.so.1, Go BuildID=-37pQ_4dEsp4pnAgj4QV/0unDR_0nE-A-DsF1SfKd/-8CRGAArG5J0XNspP2M-/u6ChmkaiRo9qoxEE15eo, not stripped

But, for some reason, the interpreter ~/aarch64-linux-musl-cross/aarch64-linux-musl/lib/ld-musl-aarch64.so.1 is a broken link to /lib/libc.so.

I have a file /usr/aarch64-linux-gnu/lib/libc.so but it's just a text file.

~$ file /usr/aarch64-linux-gnu/lib/libc.so
/usr/aarch64-linux-gnu/lib/libc.so: ASCII text
~$ cat /usr/aarch64-linux-gnu/lib/libc.so
/* GNU ld script
   Use the shared library, but some functions are only in
   the static library, so try that secondarily.  */
GROUP ( /usr/aarch64-linux-gnu/lib/libc.so.6 /usr/aarch64-linux-gnu/lib/libc_nonshared.a  AS_NEEDED ( /usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1 ) )

What is the link ld-musl-aarch64.so.1 supposed to point to?


Wow, I found my answer right after posting this...

sudo dpkg --add-architecture arm64
sudo apt update
sudo apt install -y --no-install-recommends musl:arm64
ln -f -s /lib/aarch64-linux-musl/libc.so ~/aarch64-linux-musl-cross/aarch64-linux-musl/lib/ld-musl-aarch64.so.1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.