0

I am using Parallels with their stock VM: "Ubuntu 24.04 (with Rosetta support)". I'm running this on an M1 Mac. This Ubuntu 24.04 is aarch64.

My problem is trying to get an emulated amd64 binary with dynamically-linked binaries to work. I think maybe I don't have something configured properly to allow amd64 binaries to find amd64 shared libraries.

Statically-linked binaries that are amd64 already work on this VM.

For the binary that uses shared libraries, I've eliminated all warnings about missing libraries by installing the amd64 versions. However, now I'm left with the following error:

> bin/my_binary                   
ld: unrecognised emulation mode: elf_x86_64
Supported emulations: aarch64linux aarch64elf aarch64elf32 aarch64elf32b aarch64elfb armelf armelfb aarch64linuxb aarch64linux32 aarch64linux32b armelfb_linux_eabi armelf_linux_eabi

Is ld something I need to configure to work with amd64? Why aren't there amd64 emulation modes available?

thanks!

1 Answers1

1

I don't know what they mean by "with rosetta support" but here are the main step to make rosetta works on virtualized ubuntu (using Apple virtualization framework):

sudo mkdir /media/rosetta
sudo mount -t virtiofs rosetta /media/rosetta
sudo apt install binfmt-support
sudo /usr/sbin/update-binfmts --install rosetta /media/rosetta/rosetta      --magic "\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x3e\x00"      --mask "\xff
\xff\xff\xff\xff\xfe\xfe\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff"      --credentials yes --preserve yes --fix-binary yes
sudo vim fstab 
sudo dpkg --add-architecture amd64

(Add the rosetta mount persistent by adding rosetta /media/rosetta virtiofs ro,nofail 0 0 to your /etc/fstab)

If you check that all these steps were done correctly you are near to be good to go:

  • If you are on kernel < 6.11, everything should work and you should be able to run x64 binaries.
  • If you are on kernel >=6.11, we have an issue and you should get this error: "assertion failed [hash_table != nullptr]: Failed to find vdso DT_HASH (Vdso.cpp:78 get_vdso_dynamic_data)" It is caused by Apple's implementation of Rosetta and some clean-up done by Linus in 6.11 kernel here. They explicitly explain that they removed --hash-style=sysv on arm64 systems as glibc added support for .gnu.hash in 2006 and .hash has been obsoleted for more than one decade in many Linux distributions…

For this issue, until Apple fix the implementation, the only bypass I found is to run your Ubuntu VM under the latest 6.10 mainline kernel (6.10.14).

It is still not fixed in the latest macOS Sequoia 15.4. I found a thread in Apple developer forum already open, please feel free to upvote it here

If you need to stay with the built-in kernel, I think that currently 24.4.2 have 6.11. you also have (slower) alternative, like using box64, or qemu-user-static (see Is there any translation layer for x86 software on Ubuntu ARM?)

Rishon_JR
  • 1,028