Cross compiling

This is a discussion on Cross compiling within the Linux Programming forums, part of the Platform Specific Boards category; How to compile a program using gcc for linux ( Kernel 2.6.9 )-ppc architecture from a freeBSD based x86 machine?...

  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    2

    Cross compiling

    How to compile a program using gcc for linux ( Kernel 2.6.9 )-ppc architecture from a freeBSD based x86 machine?

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by X56THN View Post
    How to compile a program using gcc for linux ( Kernel 2.6.9 )-ppc architecture from a freeBSD based x86 machine?
    You'd have to get the gcc and binutils source code onto your machine, and then use ./configure to set up the processor and OS architectures for the cross compiler.

    There's a bunch of options for gcc's configure documented here: http://gcc.gnu.org/install/configure.html

    The ones you want would include:
    Code:
    --prefix=<somedir>   // To put your compiler in a specific place different from where a new native compiler goes. 
    --with-cpu=cpu  (ppc variant)
    For compilation speed, you may want to use:
    Code:
    --enable_languages=C,C++
    That way, it doesn't compile the Fortran, ADA, Java, Pascal and whatever other languages it may support.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Jun 2008
    Posts
    2
    A tried a large varity of combinations of the options and I can't build it, i will need moore specific help. I wasted too many days. Is any crosscompiler ready out of the box for ppc

  4. #4
    Registered User Jaqui's Avatar
    Join Date
    Feb 2005
    Posts
    416
    I do suspect that gcc by default on openBSD will cross compile.
    you would have to have a makefile that xplicitlye requires an executable for the target platform though.
    Quote Originally Posted by Jeff Henager
    If the average user can put a CD in and boot the system and follow the prompts, he can install and use Linux. If he can't do that simple task, he doesn't need to be around technology.

  5. #5
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    "xplicitlye" -> "explicitly" [Just thought I'd mentioned this because I couldn't figure it out at first.]

    I do suspect that gcc by default on openBSD will cross compile.
    Perhaps -- but to PPC? (You know -- Apple.)

    If you can't get it to work, you might be able to use an emulator such as VirtualBox to emulate the PPC system, and run GCC on that. I've never tried this, but it might work.

    Do you actually have access to a PPC system? If so, there are lots of ways you could do this, not to mention simply SSH'ing to the PPC machine (assuming the computers are networked) and compiling from there. At the least, you could copy the PPC machine's installation of GCC onto your FreeBSD one and use an emulator from there. (This is assuming that the PPC computer, if it even exists, has a compiler installed.)

    [edit] You want more specific instructions? Give more specific descriptions of what went wrong. Did you get an error from make? Did GCC build, but just not compile anything? Perhaps it built and works, but actually generates FreeBSD executables?

    There's lots of stuff around about this sort of thing. Keep looking.


    [/edit]
    Last edited by dwks; 07-02-2008 at 01:13 PM.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  6. #6
    Registered User Jaqui's Avatar
    Join Date
    Feb 2005
    Posts
    416
    thanks dkws, my bad laptop keyboard used for that post.
    [ way to low a pressure for a keystroke ]

    ppc virtualization is problematical.

    I have watched someone testing it with every vm tool he can get and they all fail in some fashion for usable ppc system.

    and yup, you will get ppc as a build option if you have cross compiling supported.
    Quote Originally Posted by Jeff Henager
    If the average user can put a CD in and boot the system and follow the prompts, he can install and use Linux. If he can't do that simple task, he doesn't need to be around technology.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. cross compilation doubt
    By vlrk in forum Linux Programming
    Replies: 6
    Last Post: 04-16-2009, 01:02 PM
  2. all about cross compilation
    By munna_dude in forum Linux Programming
    Replies: 1
    Last Post: 08-27-2008, 04:15 AM
  3. Minimax, URGENT :(
    By Dark-MX0Z in forum C++ Programming
    Replies: 6
    Last Post: 11-14-2007, 05:29 AM
  4. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  5. Cross Compiling with Linux and Turbo C
    By ozgulker in forum Linux Programming
    Replies: 0
    Last Post: 11-18-2002, 02:07 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21