Hey all,
Would someone help me understand the difference between “porting” and “cross-compiling”? I did some googling and YouTubing but it seems some people don’t make a distinction, some do, and some talk about crossing to a different OS and some to a different chip architecture.
PS: I have also read that porting/cross-compiling takes a very long time and can be a hard task – apparently Google Chrome and Firefox both have assembly in them but why was it so important to put assembly in them? It has to be super important given that they knew it would take a long time to port/cross compile to a different chip than the original one right?!
Thanks so much!
Thanks!!
In: Technology
Cross-compiling is when you write code for one platform on a different platform than the intended target.
For example: if i write a program on my linux machine for windows, ill have to use cross compilation to actually get the win32 api calls to work.
-or-
If i write a program for my ARM rasberry pi on my x86_64 laptop, ill have to use cross compilation because ARM bytecode is different from x86_64 bytecode.
Porting is when the underlying code has to be changed in order to get it to work on another platform.
For example: if i write a native windows app, it will use the win32 api’s system calls to do different things. If i want to use that app on linux natively, ill have to go in and rewrite the underlying code so that it uses linux kernel syscalls instead of windows’.
Overall:
With a simple enough program that only uses standard libraries, cross compilation can be pretty simple and is mostly a matter of using a different compiler or issuing unusual directives to the compiler.
Porting on the other hand is a manual process where you may have to significantly rewrite the underlying code.
Latest Answers