public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Cross compile helloworld.c
@ 2013-06-26 16:10 Burning Thumb
  2013-06-26 16:19 ` Jonathan Wakely
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Burning Thumb @ 2013-06-26 16:10 UTC (permalink / raw)
  To: gcc-help

You know I thought this would be so easy, and maybe it is...

I'm running Ubuntu 13.04 on an intel machine and I want to cross compile helloworld.c so that the resulting binary will execute on Ubuntu on a powerpc machine.

So something simple like:
 gcc helloworld.c --target powerpc-linux -o helloworldppc

But the answer seems to always come back how to cross compile gcc itself...

Anyone have a one liners on how to simply cross compile helloworld.c for ubuntu ppc?


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Cross compile helloworld.c
  2013-06-26 16:10 Cross compile helloworld.c Burning Thumb
@ 2013-06-26 16:19 ` Jonathan Wakely
  2013-06-26 17:10   ` burningthumb
  2013-06-26 16:25 ` Andrew Haley
  2013-06-26 16:33 ` Marc Glisse
  2 siblings, 1 reply; 7+ messages in thread
From: Jonathan Wakely @ 2013-06-26 16:19 UTC (permalink / raw)
  To: Burning Thumb; +Cc: gcc-help

On 26 June 2013 16:57, Burning Thumb wrote:
> You know I thought this would be so easy, and maybe it is...
>
> I'm running Ubuntu 13.04 on an intel machine and I want to cross compile helloworld.c so that the resulting binary will execute on Ubuntu on a powerpc machine.
>
> So something simple like:
>  gcc helloworld.c --target powerpc-linux -o helloworldppc
>
> But the answer seems to always come back how to cross compile gcc itself...
>
> Anyone have a one liners on how to simply cross compile helloworld.c for ubuntu ppc?

You need a cross compiler.  The target is fixed when GCC is built, so
you cannot use a GCC built for the intel target to build binaries for
the powerpc target.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Cross compile helloworld.c
  2013-06-26 16:10 Cross compile helloworld.c Burning Thumb
  2013-06-26 16:19 ` Jonathan Wakely
@ 2013-06-26 16:25 ` Andrew Haley
  2013-06-26 16:33 ` Marc Glisse
  2 siblings, 0 replies; 7+ messages in thread
From: Andrew Haley @ 2013-06-26 16:25 UTC (permalink / raw)
  To: Burning Thumb; +Cc: gcc-help

On 06/26/2013 04:57 PM, Burning Thumb wrote:
> You know I thought this would be so easy, and maybe it is...
> 
> I'm running Ubuntu 13.04 on an intel machine and I want to cross compile helloworld.c so that the resulting binary will execute on Ubuntu on a powerpc machine.
> 
> So something simple like:
>  gcc helloworld.c --target powerpc-linux -o helloworldppc
> 
> But the answer seems to always come back how to cross compile gcc itself...
> 
> Anyone have a one liners on how to simply cross compile helloworld.c for ubuntu ppc?

Sure.  Of course, you're going to need an Ubuntu x86 -> powerpc cross
compiler.  Before we go through the steps of building one, please make
sure that you can't get a packaged cross-compiler from someone else.

Once you have done that, we can show you how to build a
cross-compiler.  But be warned: it takes a fair bit of C and operating
system experience, and you'll need to allocate a fair bit of time.

Andrew.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Cross compile helloworld.c
  2013-06-26 16:10 Cross compile helloworld.c Burning Thumb
  2013-06-26 16:19 ` Jonathan Wakely
  2013-06-26 16:25 ` Andrew Haley
@ 2013-06-26 16:33 ` Marc Glisse
  2013-06-27 23:19   ` Ángel González
  2 siblings, 1 reply; 7+ messages in thread
From: Marc Glisse @ 2013-06-26 16:33 UTC (permalink / raw)
  To: Burning Thumb; +Cc: gcc-help

On Wed, 26 Jun 2013, Burning Thumb wrote:

> You know I thought this would be so easy, and maybe it is...
>
> I'm running Ubuntu 13.04 on an intel machine and I want to cross compile helloworld.c so that the resulting binary will execute on Ubuntu on a powerpc machine.

Doesn't Ubuntu have a crossbuild-essential-powerpc package?

-- 
Marc Glisse

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Cross compile helloworld.c
  2013-06-26 16:19 ` Jonathan Wakely
@ 2013-06-26 17:10   ` burningthumb
  2013-06-26 17:35     ` Jonathan Wakely
  0 siblings, 1 reply; 7+ messages in thread
From: burningthumb @ 2013-06-26 17:10 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: gcc-help

I though Ubuntu 13 came with the cross compiler already and I did not need to go through the "joy" of building it.  Perhaps I was mistaken.

On Jun 26, 2013, at 9:03 AM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:

> On 26 June 2013 16:57, Burning Thumb wrote:
>> You know I thought this would be so easy, and maybe it is...
>> 
>> I'm running Ubuntu 13.04 on an intel machine and I want to cross compile helloworld.c so that the resulting binary will execute on Ubuntu on a powerpc machine.
>> 
>> So something simple like:
>> gcc helloworld.c --target powerpc-linux -o helloworldppc
>> 
>> But the answer seems to always come back how to cross compile gcc itself...
>> 
>> Anyone have a one liners on how to simply cross compile helloworld.c for ubuntu ppc?
> 
> You need a cross compiler.  The target is fixed when GCC is built, so
> you cannot use a GCC built for the intel target to build binaries for
> the powerpc target.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Cross compile helloworld.c
  2013-06-26 17:10   ` burningthumb
@ 2013-06-26 17:35     ` Jonathan Wakely
  0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Wakely @ 2013-06-26 17:35 UTC (permalink / raw)
  To: burningthumb; +Cc: gcc-help

On 26 June 2013 17:25, burningthumb wrote:
> I though Ubuntu 13 came with the cross compiler already and I did not need to go through the "joy" of building it.  Perhaps I was mistaken.

It might do, but I think it would be a separate program, so (after
installing it) you'd need to run something like gcc-ppc instead of
gcc.  You'd probably get better answers about Ubuntu's packages if you
ask on an Ubuntu forum.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Cross compile helloworld.c
  2013-06-26 16:33 ` Marc Glisse
@ 2013-06-27 23:19   ` Ángel González
  0 siblings, 0 replies; 7+ messages in thread
From: Ángel González @ 2013-06-27 23:19 UTC (permalink / raw)
  To: gcc-help; +Cc: Marc Glisse, Burning Thumb

On 26/06/13 18:19, Marc Glisse wrote:
> On Wed, 26 Jun 2013, Burning Thumb wrote:
>
>> You know I thought this would be so easy, and maybe it is...
>>
>> I'm running Ubuntu 13.04 on an intel machine and I want to cross 
>> compile helloworld.c so that the resulting binary will execute on 
>> Ubuntu on a powerpc machine.
>
> Doesn't Ubuntu have a crossbuild-essential-powerpc package?

It has:  http://packages.ubuntu.com/raring/crossbuild-essential-powerpc

Burning Thumb, install that package. Then you will be able to compile your
hello world with:
  powerpc-linux-gnu-gcc helloworld.c -o helloworldppc

(ie. replace "gcc" with "powerpc-linux-gnu-gcc" in normal instructions
for compiling a program)

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-06-26 19:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-26 16:10 Cross compile helloworld.c Burning Thumb
2013-06-26 16:19 ` Jonathan Wakely
2013-06-26 17:10   ` burningthumb
2013-06-26 17:35     ` Jonathan Wakely
2013-06-26 16:25 ` Andrew Haley
2013-06-26 16:33 ` Marc Glisse
2013-06-27 23:19   ` Ángel González

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).