4

I have searched around for a way to run a program meant for ARM processors on an Intel computer, but I can only find ways to do the reverse, to compile Intel programs for ARM. Are there any open-source cross-compilers that will allow me to do so? Thanks for your help.

1 Answers1

5

Gcc can cross-compile programs for Intel targets from ARM hosts, but I'm not entirely sure that's what you meant to ask, because your terminology is off. Let me lay out some general principles, which should hopefully either answer your question or give you enough information to clarify your question.

There are several different things to consider about cross compiling:

  1. The host system. This is the system that the compiler itself is installed on.
  2. The target system. This is the system that the executable will run on. To fully specify it requires knowledge of a few different things:
    1. The architecture. ARM, x86, amd64, ppc, etc.
    2. The operating system. Android, iOS, Linux, OS X, Windows, etc.
    3. The libraries. Standard language libraries, GUI toolkits, etc. which also must be cross-compiled.

However, you also mention running a program designed for ARM on Intel, which isn't so much cross-compiling as porting. Those are two very different things. If you want to use your Intel machine to compile a program that will run on an Intel machine, that's porting, not cross-compiling.

Depending on how tightly the program is integrated with the operating system, architecture, and libraries, and how portable those were designed to be, this can be relatively easy or a complete nightmare. A C program that only uses standard in and out is relatively easy to port to another platform. Something tightly integrated with the platform, like Internet Explorer for example, is difficult enough to port that it's easier just to start from scratch.

If you clarify whether you actually meant cross-compiling or porting, and give more information on the operating systems and libraries involved, we might be able to help you in more depth.

Karl Bielefeldt
  • 148,830