Wednesday, May 15, 2024
 Popular · Latest · Hot · Upcoming
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 13338  / 3 Years ago, sun, june 13, 2021, 3:57:02

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).


More From » gcc

 Answers
4

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).


[#34242] Monday, June 14, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
saucdisr

Total Points: 4
Total Questions: 102
Total Answers: 117

Location: Ecuador
Member since Thu, Jun 4, 2020
4 Years ago
saucdisr questions
Tue, May 10, 22, 00:19, 2 Years ago
Fri, Mar 4, 22, 17:31, 2 Years ago
Mon, Jul 4, 22, 13:04, 2 Years ago
Sat, May 28, 22, 08:41, 2 Years ago
;