How to cross-compile programs for the Raspberry Pi with gcc?
Using a combination of poking around in the apt
repositories and the extremely excellent Building Embedded Linux Systems (2nd edition, 2008, O'Reilly), I found this:
arm-linux-gnueabi-gcc
That is both the name of command and the package that you install to acquire it. Once invoked, it acts exactly as "vanilla" gcc
, with the only exception that it builds packages for the ARM architecture (or a subset including the BCM2835, at least). Building Embedded Linux Systems (pg 93-94) explains that the names used for invoking the GNU tools in a cross-compilation manner follows this format:
cpu-kernel-manufactuer-os
The -gcc
at the end of the topmost example is the component, used for specifing which part of binutils
you want to use. It can be swapped out for another GNU toolchain component, such as ld
(linker) or as
(assembler). For arm-linux-gnueabi-gcc
, arm
is the architecture, linux
is the kernel, gnueabi
is the os, and gcc
is the component. Where is the manufacturer? Apparently, the manufacturer can be specified as "unknown", as it rarely makes a difference, or left out alltogether (including it would make arm-linux-unknown-gnueabi-gcc
).