Cross compiling
Cross compiling refers to building a program from source on some architecture/OS, such as the built program is run on another combination (another OS, another archicture, or both). In my case, having a fast workstation under Linux on x86, I would like to build some basic tools for some of our lab's server which run on solaris on SPARC (64 bits). The tools I am interested in using on the workstation are :
- GNU coreutils (ls and co)
- rsync
- python so that I can use bzr, a source control system.
python needs to run some python code on the machine it will run on during the build process, so having a cross compiler from linux to solaris on sparc is not enough: I also need to build a native compiler from linux (eg build on linux a compiler which will run on solaris, and will build code to be run on solaris).
This memo explicits all the necessary info to build a cross compiler from linux x86 targetted at solaris on sparc64, and also a native compiler.
Building the cross compiler
When building a cross compiler, there are up to 3 machines involved:
- the build machine: the machine which builds the cross compiler
- the host machine: the machine which will run the built cross compiler
- the target machine: the machine which will run the programs built by the cross compiler
- TODO:
- Most open source programs use the autotools for building: explain cross compiling in this case
- Explain necessary env variables
- Explain sysroot
- build binutils + cross compilers
- build native compiler
- built python