12

I'm trying to install Navicat which is an x86-64 binary onto my aarch64 machine, which results in "cannot execute binary file: Exec format error"

Here's the result of running file on the executable:

navicatess15-sqlserver-en.AppImage: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.18, BuildID[sha1]=d629f6099d2344ad82818172add1d38c5e11bc6d, stripped

And here is my uname -a:

Linux penguin 4.19.98-08076-g24ab33fb8e14 #1 SMP PREEMPT Wed Apr 1 17:17:36 PDT 2020 aarch64 GNU/Linux

Is there any way to run this executable on my machine?

(Idk if this makes any difference but I'm running Linux on my Samsung Chromebook Plus w/ an OP1 processor)

Svavinsky
  • 121
  • 1
  • 1
  • 3
  • 2
    Yes and no. Yes you can run x86-64 binaries on arm64. The speed that this would run at might not be useful for you. Ask yourself if something running 10x slower is worth it to you or if you can live with an alternative program designed specifically for arm or at least native. – kemotep Apr 04 '20 at 19:33
  • Also check Box86, which let's you seamlessly run x86 binaries on arm. It wouldn't be useful for complex apps but is definitely useful in some use cases. – istepaniuk Mar 30 '21 at 20:37

3 Answers3

6

Each architecture speaks its own hardware language so of course ARM CPUs can only run ARM binaries natively. If you want to run binaries for another architecture you need to use an emulator. The most famous x86-64 emulators are qemu and bochs

But emulation is extremely slow so it won't be suitable for time-sensitive applications, and should be the last resort. You'll better off recompile from source if available, or find an ARM alternative software

phuclv
  • 2,001
  • 1
  • 16
  • 41
  • 1
    No, you don't have to run a full emulator. Have you ever heard of [`qemu-user`](https://www.qemu.org/docs/master/user/main.html)? And unless the program really is some number crunching thing, it won't be _that_ slow. –  Apr 05 '20 at 02:37
  • 2
    @mosvy of course I know that qemu has user mode emulation, but it's still a last resort as I said. A native solution is always better – phuclv Apr 05 '20 at 02:38
  • 1
    Then why are mixing it up together with bochs, which emulates a complete computer, just like `qemu-system-*`? And as I said, usual applications (which spend most of their time waiting for system calls to complete) are not that slow with a user-mode only emulation. –  Apr 05 '20 at 02:43
  • 3
    I'm just giving up emulators and I didn't say anything about their emulation mode. It's not sluggishly slow but still worse than a native app. I never said that never use them, just **find a native solution first** – phuclv Apr 05 '20 at 02:47
  • +1 to this. I can't even get a x86 Linux guest VM to boot up on my armv7 Chromebook, because the VM performance is so awful. – Time4Tea Jun 30 '20 at 15:22
  • Is Bochs still maintained? The website says that x86_64 "may even not reached the market yet", which reads straight out of 2005. For Qemu, can it be used to run software from a different architecture on the host OS, like Wine, or how 32-bit x86 apps can run on x86_64? I thought that Qemu was a virtual machine software. – Aaron Franke Dec 18 '21 at 03:42
  • @AaronFranke yes, you can see in the homepage "Bochs 2.7 released on August 1, 2021". Qemu is not a virtual machine, it's an emulator that uses binary translation so obviously it can run binaries for any architectures. The feature to run guests with the same platform as host with hardware acceleration has only been added much later – phuclv Dec 18 '21 at 05:21
  • On the other hand, people are using `qemu` to debug their ARM binaries as a normal workflow. Did anyone notice ARM and x86 happen to play in the same performance league, so emulating x86 on ARM is the same game as the other way around? – Philippos Jun 16 '23 at 06:52
6

Debian has multiarch support which means that you can install and run programs built for one architecture on other architectures.

However, you need to take the following into consideration:

  1. As the x86 architecture is very different from ARM, then this will be done through emulation (usually via qemu-user) so there could be some loss of speed and functionality.

  2. This needs binfmt support. If you are using "Linux containers" (crostinit) on a Chromebook then, as explained in this post, this support is not enabled.

  3. On a Chromebook, binfmt support requires crouton at this point. It works as well as can be expected in that context.

If you want to test this run the following:

a. Install the binaries required to support the architecture.

sudo apt-get install binfmt-support qemu-user-static
sudo update-binfmts --display

b. Setup Debian to support multiarch.

sudo dpkg --add-architecture amd64
sudo apt-get update
sudo apt-get upgrade

c. Test it out. (Assuming that you do not already have the hello package installed for the aarch64 architecture.)

sudo apt-get install hello:amd64
hello

This will print the familiar "Hello, World!" message using the amd64 binary.

Kapil
  • 291
  • 3
  • 5
  • 1
    This works, however you may need to adjust your apt sources.list to actually pull the amd64 binaries from the right place. See https://askubuntu.com/a/1443977/977044 – tmm1 Dec 04 '22 at 20:59
3

For aarch64, emerging projects like FEX or Box64 have better performance than QEMU user emulation. They use dynamic recompilation, also usually provide WINE support for Win32 x86/x86_64 software.

user490985
  • 31
  • 1