What is cross compiler and cross platform?

I am a little confused in terms of cross-platform and cross-compiler. Let me clear out the cross platform first. When people talk about cross-platform, it means processor architecture, i.e. X86 and X64? or OS ie Windows 32 bit or Windows 64 (server or desktop)? UNIX does not have different flavors, such as 64-bit or 32-bit. Why is that?

.NET and java are cross-compiler languages, what does this mean? When the program compiles in .NET, we must choose an option such as X86, X64, or Any CPU. What does it mean? Also in the configuration project, we must choose an option between x86 and x64. So, if the program is compiled in x86 and the msi file was created on x64, will it work on both X64 and x86 or any of them?

+6
cross-platform jvm cross-compiling
source share
5 answers

When people talk about cross-platform, it means CPU architecture, i.e. X86 and X64? or OS

I. Typically, this means that sotfware runs on a virtual machine or software that is compiled separately for each platform.

UNIX does not have different flavors, such as 64-bit or 32-bit.

This is true.

So, if the program is compiled in x86, and the msi file was created on x64, will it work on both X64 and x86 or any of them?

If you target x86, amd64 also runs the code (in 32-bit mode). It doesn't matter where you create the msi installer file.

Cross-compilation means that the host and target platform do not match. For example, creating window software on a Linux computer.

+13
source share

Cross-platform refers to the ability of a program to work on several different platforms. Cross-platform code often uses various tools / languages ​​to achieve this (Qt, Flash, etc.).

A cross-compiler is a compiler that generates code for a platform other than the platform on which the compiler itself runs. Compilers for built-in purposes are almost always cross-compilers, since several built-in targets can host the compiler itself.

Cross compilers require an assembly system that does not imply compatibility between the host system and the target system, i.e. you cannot run the target executable file during build, for example, to determine aspects of the execution of the generated code (for example, word size).

(Cross-compilation can also be applied to the compiler itself. This is called the Canadian Cross compilation , which is a method of building (cross-compiler) on the host, different from the one on which the compiler should work. In this case, we have three platforms:

  • The platform on which the compiler is built (built).
  • The platform on which the compiler (host) is hosted.
  • The platform for which the compiler generates code (target).

I suspect most programmers will never run into this.)

+6
source share

The cross platform, I suppose, could indicate that it works either on Windows / Mac / * nix, or that it works either on x86 / x86_64 / ARM / PPC, but unless otherwise indicated, I believe that this usually means that it runs various operating systems. For example, "Java applications are cross-platform," this usually refers to the fact that Java applications can run on Win / Mac / * nix.

+1
source share

"cross-platform" refers to everything that runs on different platforms, so it can be an OS or CPU (type (x86 / MIPS) or bit size (32/64)). This does not mean that you need to rebuild to run on other platforms only that which, for example, QT can target many platforms, but you may need to rebuild for each application, or you can build once, for example, java or .Net

'cross compiler' means a compiler on this platform that makes a program that can run on another platform. Thus, create WinCE executables on Win32. Or you can create a Linux application in a window window by building a version of GCC that works on Windows, but the goal of the output is Linux / Elf. If you have a built-in device, you almost always cross-compile to create the target executable.

X86, X64 or any CPU. What does it mean? It controls how the .Net application focuses on one architecture or not, if you aim, it will not work on both, but many compilers do some optimizations. If it is not targeted (any processor), it will work on both. This is mostly useful if you are directly accessing an external .dll, and you are tightly linking the 64-bit or 32-bit version and therefore want your application to run in the same environment.

In Windows installers, 64bit can run 32-bit applications and 32-bit installers, where 64-bit applications cannot run on 32-bit systems. On other platforms, you usually rebuild the code for your architecture (Linux), or on the Mac you download generic executables (which, I think, have several whole builds inside)

+1
source share

Native compilers: native compilers are those that generate executable files from source code, which, in turn, will run on the same system on which the compiler is available.

Cross-compiler: cross-compilers are those that generate executable files from the source code, which, in turn, will be executed on some other system, and then on which compiler is available.

Find examples on native and cross-compilers on BoundsCheck

+1
source share

All Articles