raspberry pi – How to run a binary file on RaspberryPi that was created in Ubuntu?

I created a binary file for my C++ code on OS: Ubuntu 20.04.6 LTS x86_64. Since the run time is long, I decided to put this binary file on my RaspberryPi (OS: Debian GNU/Linux 12 (bookworm) aarch64).

However, when I executed the file, I got the following error:

d@raspberrypi:~/Documents/Glbr_mdl $ ./Glbr 
-bash: ./Glbr: cannot execute binary file: Exec format error

A quick Google search told me that this could be due to different architecture. In my case, Ubuntu has x86_64 architecture, while RaspberryPi has aarch64. So, my question is, is it possible to solve this issue?

One solution that I can think of is to install all the dependencies on RaspberryPi and build the project. But this solution is too time consuming

Read more here: Source link