6

Since I got my RPi, I have been playing with it and I am really happy that I bought it!

I use various programs on it but it takes a long time to build them. So I had an idea. What if I could build my programs on my quad-core PC, it will be a lot faster!? ^^

Is there a way to build my programs on Windows or Debian on my PC for my RPi ?

Piotr Kula
  • 17,307
  • 6
  • 65
  • 104
Tiwenty
  • 213
  • 1
  • 2
  • 5
  • 2
    -You could try http://xecdesign.com/qemu-emulating-raspberry-pi-the-easy-way/ I guess. Maybe you can overclok this virtual achine, should give a good boost. – Uwe Ziegenhagen Jan 22 '13 at 18:41
  • 3
    This might help: http://raspberrypi.stackexchange.com/q/1/40 – Jivings Jan 22 '13 at 18:43
  • QEMU looks easier to use than crosstools-ng, but I will keep it if I fail to use QEMU. Thank you Uwe Ziegenhagen and Jivings :-) – Tiwenty Jan 22 '13 at 19:00
  • There's a ready-to-roll cross-compiler for the RPi available here: http://raspberrypi.stackexchange.com/a/1144/4402 – Steven Devijver Jan 22 '13 at 23:35
  • This is called cross-compilation, and, as @Jivings points out, has already been answered in the post that he linked. – fouric Jan 23 '13 at 00:03
  • Using qemu user emulation works, however... it takes a little setting up (compiling your own qemu to get a more recent version works best). I've found running on an i7, the speed was similar to running on a real pi. Also, in the qemu emulator proper, I didn't manage to get SNP working, so was limited to 1 core. – Stuart Axon Dec 03 '16 at 14:33

3 Answers3

2

I just gave an answer to a similar question here:

Can I use my Ubuntu desktop to cross-compile the GO language environment for my Pi?

NB. I'm not Frepa ;)

To summarize, yes it is, but building a cross-compiler is not a trivial task for most people; I recently used crosstool-NG to do it which A) made the procedure pretty painless, B) produced a c/c++ compiler that works to compile executables for the pi.

If you just want this to build your own stuff then I do recommend it if the caveats I mentioned there about use of autotools and pkg-config do not apply or you are willing to deal with the hassles to make that happen (dealing with those hassles may take you longer than just compiling on the pi, so...).

Crosstool-ng can produce a basic environment in which you can compile programs that rely on the standard libraries + POSIX threading (that's what I tested successfully). Beyond that, you have to build any support libraries you use (sqlite, curl, ncurses, etc.) in that environment first too.

goldilocks
  • 58,859
  • 17
  • 112
  • 227
2

This may help you, he explained it very nicely:
Development environment raspberry cross compiler

Edit: Link is currently broken: PDF Mirror

duslabo
  • 191
  • 1
  • 2
  • 8
  • Yes, that's what I did. I downloaded the toolchains from the repo indicated in your article. Thanks! – Tiwenty Jan 29 '13 at 05:23
2

You can build Raspberry Pi cross-compiler running on Windows by using MinGW, Cygwin and some patches from Raspbian repository, here is an instruction how to do it: http://www.gurucoding.com/en/rpi_cross_compiler/index.php