How to Target Arch & OS When Cross-Compiling
When a software developer writes a program he needs to use a compiler application to make it executable. If the intention of the developer is to make the new software run on different computer architectures and platforms, like Linux, Windows32 Bit, or Windows64 Bit, he needs to use a cross compiler application, to ensure the created software functions properly on the other Operating System (OS) and architecture system. Note, that cross compiling doesn’t always work because of Operating system or architecture differences, and the application may need tweaking or compiling on each Operating System.
Instructions
-
-
1
Download and install a free cross compiler that works with the programming language you are using on the host computer (the computer you are coding the program on.) Use a free C# compiler if the language is C# or use a Linux cross compiler if the program is Linux based. If the code is in Pascal then choose a free Pascal cross compiler. Code your own cross compiler if none of the free versions work for your needs.
-
2
Add the following code at the top of the cross compiler to make the application cross compile from a Linux linux(x86_64) to linux(i386):
"bash $ which i386-linux-ld"
"bash $ which i386-linux-as"Make the program executable by adding the following code:
"bash $ chmod +x /usr/bin/i386-linux-as"
"bash $ chmod +x /usr/bin/i386-linux-ld"
"bash $ make all CPU_TARGET=i386"
Compile for the target machine with the following code:bash $ su -c "make install CPU_TARGET=i386"
-
-
3
Type in the following code to the top of the cross compiler to make the application compile from a Linux host machine to a Windows 32 target:
"bash $ make all OS_TARGET=win32 CPU_TARGET=i386"
"bash $ su -c "make crossinstall OS_TARGET=win32 CPU_TARGET=i386" -
4
Change the “make all OS_TARGET=win32” to “make all OS_TARGET= win64 CPU_TARGET=x86_64” if your target Operating System is Windows64.
-
1