1
$\begingroup$

I am using a library precompiled on x86 on my pc (x86_64). Does there exist any toolchain to compile the x86 library and in the end generate an executable for armv7l ubuntu?

$\endgroup$
1
  • $\begingroup$ Check the ubuntu package manager, if the lib exists for arm, too. $\endgroup$
    – ott--
    Jun 2 '16 at 17:54
3
$\begingroup$

Short answer: No. Suggested alternatives below.

The purpose of a compiler is to turn source code into something a machine with a particular computer architecture, like x86, can run. ARM7 is a different architecture. A tool that could statically convert a program from one machine architecture to the other and guarantee the 'correct' program results would be awesome... but it would also pretty much be crazy AI. You DO however, have practical options to move forward. These options are sorted from simplest to most complicated:

  1. See if your library comes precompiled for ARM7 already, as this asker wanted to know.

  2. If you have enough memory and processor resources on your ARM7 machine, you can use WINE for ARM. Your ARM7 machine runs a Windows emulator, and you can run your x86 program inside the emulator.

  3. Willing to run the program remotely over a network and get the results to your ARM7 machine? It's SSH time! Open a connection, run your program somewhere else, and get the results.

  4. Do you have the source code and can you compile programs from your ARM7 machine? Put the source code on the ARM7 ubuntu machine, then compile it there.

  5. Do you have the source code, but your ARM7 device is too small or bare bones to run a compiler? Then you can "cross compile", where you use a compiler meant to create programs for Machine Architecture A (ARM7), but you run that compiler on Machine Architecture B (x86).

  6. (WARNING, HERE BE DRAGONS, LEGALLY MURKY AREAS, AND ENTIRE DOCTORAL THESES. DON'T DO THIS UNLESS YOU HAVE THAT KIND OF TIME OR INTELLECTUAL INTEREST.) Don't have the source code, and can't use your ARM7 to emulate x86 or talk to a different x86 computer? Your remaining option is hacking. You will need to decompile the binary you have and recompile it for the ARM7. This is technologically possible, so I've included it, but it's not for the faint of heart.

$\endgroup$

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