Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am fond of using gcc to compile small little C and C++ programs on my main computer. However, I also have a Raspberry Pi, and, being a 700-MHz single-core computer, I would prefer to not have to do my development work on it every time I want to create a binary for it. How (for I know that there's a way) do I cross-compile my program for the Raspberry Pi using my x86 laptop? And is there a way that I may compile C(++) programs on the Pi but produce an x86 binary? If it's any help, "The SoC is a Broadcom BCM2835. This contains an ARM1176JZFS, with floating point..." (according to the official Raspberry Pi FAQ).

share|improve this question
There is also Raspberry PI SE, here is a question that can get you on the right track:… – Lekensteyn Dec 4 '12 at 20:28
Good answer here: Cross-Compile for ARM? – nobar Feb 23 '14 at 23:22
up vote 2 down vote accepted

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:


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:


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-unknown-linux-gnueabi-gcc).

share|improve this answer

I am not sure at 100%, but, using, you could try: 1) Required libraries:

sudo apt-get install g++ git nasm flex bison gawk gperf autoconf automake m4 cvs libtool \
byacc texinfo gettext zlib1g-dev libncurses5-dev git-core build-essential xsltproc libexpat1-dev zip \
autopoint xfonts-utils libxml-parser-perl libproc-processtable-perl default-jre

2) Compile the project with the following options, where N is the number of cores of your x86 CPU:

$ PROJECT=RPi ARCH=arm PVR=yes make release -j N

I hope it helps. `

share|improve this answer
I appreciate the effort, I really do. Unfortunately, this tutorial (and the corresponding line of code) are for using make to compile a project that was set up to use make ("PROJECT=RPi ARCH=arm PVR=yes make release -j N", the stuff before is just a bunch of shell variables). Now, in reality make uses gcc, but to use the line of code provided I would have to get the source of make and then look through most of it searching for the different parts of code that would add on the necessary arguments to gcc. Thank you for trying, though! – InkBlend Nov 19 '12 at 23:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.