abhiTronix / raspberry-pi-cross-compilers

Latest GCC Cross Compiler & Native (ARM & ARM64) CI generated precompiled standalone toolchains for all Raspberry Pis. 🍇
https://sourceforge.net/projects/raspberry-pi-cross-compilers
GNU General Public License v3.0
583 stars 102 forks source link

Why cross-compilers are needed? #95

Closed maxpavlov closed 2 years ago

maxpavlov commented 2 years ago

Hello.

Thanks for the excellent work on the cross-compilers. I was trying to compile node-webrtc bindings for armv6 RPi0, it failed but it was a heck of a ride :)

Could you please clarify, why sometimes a cross-compiler is required, even if there is access to a target system. Why can't one compile on Raspberry Pi Zero for it and needs to use a cross-compiler?

The second question is - some of the documents in this repo imply that there is a need for both, a compiler machine and a target machine (like a pi). What is happening on the raspberry pi that is a part of the compilation process that is essentially happening on the host machine?

Thanks in advance.

abhiTronix commented 2 years ago

Basically, In embedded Linux based system(like Raspberry Pi, Nvidia Xavier) development , cross-compilation toolchains are used to compile source code of four main components on the Host machine. These four main components are bootloader, root file system, Linux Kernel and main application. The main reason to use a host machine is that usually target devices do not have enough resources to compile applications.

However, explaining everything here in depth will be difficult, so you can go some great online articles/blogs: http://baruch.siach.name/blog/posts/introduction_to_cross_compilation_part_1/ https://landley.net/writing/docs/cross-compiling.html