top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Cross compile helloworld.c for powerpc

0 votes
651 views

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

posted Jun 26, 2013 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button
Doesn't Ubuntu have a crossbuild-essential-powerpc package?

3 Answers

+1 vote

I have done for freescale board. you have to install power-pc compiler in your linux machine. you have to export PATH=$PATH:"path of powerpc-linux-gcc" in your linux machine. then you have to give command powerpc-linux-gcc file.c.

answer Jun 27, 2013 by Vimal Kumar Mishra
0 votes

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.

answer Jun 26, 2013 by anonymous
0 votes

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.

answer Jun 26, 2013 by anonymous
Similar Questions
+2 votes

I need to use microhttpd.a and pthread.a to build a cross-compiled program to be deployed on an arm-linux-gnueabihf device.

Where can I find instructions on how to do this? Or, is this simply a matter of downloading the source code and compiling (on a 64 bit UbuntuPC) to a library with my existing gcc-arm-linux-gnueabihf-4.8 cross-compiler?

While I may be able to find microhttpd.a and pthread.a binaries for an arm-linux-gnueabihf device, they will likely have been built with a different version of gcc-arm-linux-gnueabihf, which, I fear, could open up a can of worms.

0 votes

how can I configure GCC to emit the calls to __cxa_thread_atexit() for destructor registration? On a Linux PowerPC target I see the registration of destructors, but not on the powerpc-rtems target. I guess I missed a configuration option or define. Has someone a hint for me?

0 votes

I'm studying about C compiler for increasing software quality. So I want to get all of compile error message list of gcc about C language. I was trying to find it. But I can't find it anywhere. How can I find it?

Please help?

+1 vote

Is there a conditional define that expands to a string of the full gcc command-line used to compile the given .c/.cc file? I'd like to embed in the executable the exact compilation options used to build it.

+2 votes

I want to build a 'static toolchain', with option --disable-shared, for no shared library include/depend in the toolchain-self

cause I don't want the target binary runs depend on the toolchain, such as libc.so, ld-xxx.so.

But when the target binary need the function dlopen, it give a build error that libc.a need to recompile with -fPIC

So, how to compile glibc with -fPIC? or maybe I should ask is it possible to gen a shared library with
static toolchain?

...