Slashdot Mirror


Use x86 Boxes to Compile Mac OS X Binaries

IceFox writes "While working on the KDE on Darwin project I have only had one Mac to do development with. At the same time I have been playing around with distcc for Linux/x86 compiling. Combining the two projects I built a Mac OS X cross-compiler (for Linux/x86) and have created the DistccPPCKnoppix distribution. DistccPPCKnoppix is a 46MB Knoppix distribution based on distccKnoppix; with it you can use your extra x86 computers to build Linux/x86 or Mac OS X/PPC binaries. It might not be as shiny as an Xserve cluster, but it is a heck of a lot cheaper."

64 comments

  1. Sounds like a good idea by s1283134 · · Score: 0

    I am always up for cheap computing power.

  2. This is news? by shamino0 · · Score: 4, Interesting
    MacOS X has always used gcc as the main compiler. And GCC has always supported cross-compiling. I would be far more surprised if you couldn't compile Apple's version of GCC to cross-compile from Windows/Linux/Solaris/whatever.

    I suppose it's worth noting that someone's distributing such a cross-compiler, but the most newsworthy aspect is that it took somebody this long to get around to doing it.

    1. Re:This is news? by Ranger+Rick · · Score: 5, Informative

      The reason it's news is that GNU has no support for Mach-O, Apple has their own assembler and linker. Making them work on linux is a real pain in the ass.

      --

      WWJD? JWRTFM!!!

    2. Re:This is news? by torpor · · Score: 5, Funny

      Not any more though, and I have to say that having this new distcc-centric Knopix distro around has turned it from being 'a pain in the ass' to 'unbelievably easy, cheap, and fast!' ...

      oh dear. linux is unstoppable. you'd think that, by now, the point where linux is becoming 'The Development Environment of Choice' for compiling stuff for Other Operating Systems, well ... how can I put this: c'mon Microsoft, roll your own distro, for cryin' out loud!!!

      --
      ; -- the corruption of government starts with its secrets. a truly free people keep no secrets. --
  3. Works in reverse, too...I think! by cbiagini · · Score: 4, Informative
    Well, I'd like to say that I think it's really cool that a Mac developer is so enthusiastic about his project that he's going this far to get the product out.

    But check out this excerpt from gcc's man pages:
    -arch arch
    Compile for the specified target architecture arch. The allowable
    values are i386 and ppc. Multiple options work, and direct the
    compiler to produce ``fat'' binaries including object code for each
    architecture specified with -arch. This option only works if
    assembler and libraries are available for each architecture speci-
    fied. (APPLE ONLY)
    Aww man...all my moderation's going to be undone in this discussion now. Well, to the person who said something funny up there: Good job.
    1. Re:Works in reverse, too...I think! by cbiagini · · Score: 1

      Oh good. And now, to top it all off, someone who actually knows what they're talking about beat me to it. Good job to you, too, shamino0 :)

    2. Re:Works in reverse, too...I think! by cremes · · Score: 5, Informative

      Specifying '-arch i386' on MacOS X doesn't work though. OSX doesn't ship with fat libraries, so it isn't possible to generate an x86 executable using the gcc switches. To make this work, you need to recompile several system frameworks and libraries and install them on your box. This is hairy. I saw instructions on how to do this about 2 years ago somewhere...

      Compiling ppc on x86 or x86 on ppc is actually a bit easier using OpenDarwin. You can run this fat on your hardware and emit fat executables just as the man page suggests.

      cr

    3. Re:Works in reverse, too...I think! by lpontiac · · Score: 4, Interesting
      pecifying '-arch i386' on MacOS X doesn't work though. OSX doesn't ship with fat libraries, so it isn't possible to generate an x86 executable using the gcc switches.

      The Darwin 7.x installation CD you can get from Apple (also linked from opendarwin.org) does have fat binaries for everything, although MacOS X proper doesn't.

      Well, a slight correction - everything in /usr/bin in the Darwin 7.x is either a script or a fat binary, with one sole exception - distcc. Methinks Apple doesn't like the idea of Mac developers buying a Mac for every desk, then a pile of cheap x86's to make builds ten times faster :)

  4. fruits by lethe1001 · · Score: 5, Insightful
    It might not be as shiny as an Xserve cluster, but it is a heck of a lot cheaper.

    Um, yeah, an Xserve is a piece of hardware, and a C-compiler is a piece of software. apples and oranges.

    you could install distcc on your Xserve cluster, nnd it (the software) would still be cheap, and it (the hardware) would also be shiny.

    Um, i guess the point is that if you want distributed compiling for MacOSX, heretofore the only option was Xserve cluster, and now linux/x86 cluster is also an option. ok ok....

    1. Re:fruits by Anonymous Coward · · Score: 4, Funny

      apples and oranges

      Actually the article was about apples and pcs.

    2. Re:fruits by geoffspear · · Score: 3, Interesting

      Xcode will let me do distributed compiling on whatever random Macs happen to be on my network, without buying an Xserve cluster.

      --
      Don't blame me; I'm never given mod points.
    3. Re:fruits by AnonymousKev · · Score: 4, Funny
      Actually the article was about apples and pcs.

      So he should have said apples and lemons?

      --
      Anonymous Kev
      Proudly posting as AC since 1997
      (Finally got a dang account in 2004)
    4. Re:fruits by buckhead_buddy · · Score: 3, Informative

      Caveats: Xcode's distributed compiling is fantastic. It was an unexpected gift and I know a number of people who have networks to make great use of it. But...

      There is latency added to the compile process by having to distribute things out over the network. I think there was an Apple white paper or tech note that talked about these issues in more detail.

      It needs a speedy network. Apple engineers recommend Gigabit Ethernet but 100baseT will due in a pinch. They don't see much speed savings over 10BaseT or Airport.

      It needs fast processors. G5's are the recommended platform. Be wary of sub-Gigahertz G4's. Forget the G3's.

      The distributed compilation feature is a GREAT addition to XCode, but I still see a place for this project among those who are really on a tight budget (like me) but who still want to support Macs when feasible.

  5. Cool, I like this! by Cecil · · Score: 3, Interesting

    This is great! I do all my development on my 12" Powerbook G4, since I prefer to code in (and for) Mac OS X. That is all good, but it certainly isn't the fastest thing in the world, and I dread having to compile something large like Tex or Mozilla on it. If I was able to get it to do distributed compiles on the numerous Athlons I've got sitting around, it would be awesome.

    1. Re:Cool, I like this! by gabebear · · Score: 2
      I have an old P166Mhz laptop I use for with a Athlon XP 2100+ via distcc. It's ridiculous how much faster it can compile stuff.

      I wonder how hard it will be to get distcc going inside Xcode?

    2. Re:Cool, I like this! by Ranger+Rick · · Score: 4, Interesting

      XCode uses distcc for it's distributed compiles; the problem is it's an old version and the patch is no where near applying cleanly to modern distcc. Might be easier to just use something to advertise distcc on rendezvous manually.

      --

      WWJD? JWRTFM!!!

  6. How it should be by MrIrwin · · Score: 5, Interesting
    Ferrari use Fiat vans to ship car parts around.

    Mac is about the desktop, why not use cheap bland hardware for backend muling.

    And that is how it should be, we should be able to select the type of hardware for the job in hand, the software should run wherever it is required.

    --

    And if you thought that was boring you obviously havn't read my Journal ;-)

    1. Re:How it should be by gsfprez · · Score: 5, Interesting

      >why not use cheap bland hardware for backend muling?

      sometimes, you're a small business and you don't want to pay someone $xxxxxx to run your backend mules. You don't know how to grok Linux email and file servers because you're a parts manufacturer, or a solar panel business, or a gift basket maker...

      With Mac OS X Server and a $300 iMac off eBay and prudent backups, you could run email for 40 people and have your own webserver off your home DSL with no problem.

      I only know this because i did it. They know jack shit about running computers. I did the scary part and installed the server for them (i hit "okay" a lot) and then showed them...

      see this window? This is where you add users... this window shows you that your email server is running just fine.

      They call me every so often to tell me that things are fine. And i get to not answer dumbass questions and watch the playoffs on ESPN.

      They own their IT... their IT does not own them.

      With Linux, if you're going to have geeks around, then yes, its cheaper and does everything i just mentioned at a MUCH lower cost. But if you're not a geek, and you want services like email and web servers for small business, and you want rock solid performance (not Windows shitty performance) then you're wanting Mac OS X Server.

      Mac OS X Server is the greatest boon to small business i've ever seen. I have helped 4 small businesses (friends) do this - and they are all running just fine without me - and they have all the stability that they would get from a competent Linux install and a in-house geek running it.

      Mac OS X Server can get a lot of low-ball geeks fired... OR it can help low-ball geeks make a lot of money serving a lot more customers. Its all in how you think about it.

      --
      guns kill people like spoons make Rosie O'Donnell fat.
    2. Re:How it should be by trouser · · Score: 1

      Of course Fiat owns Ferrari these days and Ferrari don't make delivery vans anyway so the analogy is slightly flawed but I see what your getting at.

      --
      Now wash your hands.
    3. Re:How it should be by Halfbaked+Plan · · Score: 0, Flamebait

      Whoah! Nice Astroturf!

      The kind I could even lie down on and stare up at the clouds in.

      Too bad I can't afford the admission cost.

      --
      resigned
    4. Re:How it should be by AndyElf · · Score: 1

      Fiat (company) owns Ferrari (trade mark/brand)

      --

      --AP
    5. Re:How it should be by MrIrwin · · Score: 1
      Seeing as how we have pedantic trolls around........The Fiat group (which includes amongst other things IVECO trucks and New Holland tractors) owns Fiat automotive, which own the FIAT, Lancia and Alfa Romeo brands). The Fiat group has, as a seperate enitity from Fiat automotive, an approx 50% dtake in Ferrari (which, BTW, also owns Maserati). Ferrari is a sperate entity (hand building sports cars is after all very different from mass producing utilities), but they are related not only by stocks but by management. Most specifically, Motezemolo (the President of Ferrari) also sits on the Fiat automotive board.

      And before anybody opens another can of worms.....General Motors (or Vauxhall or OPEL depending where you live) owns 20% of FIAT automotive, not the FIAT group, and has zero connection with Ferrari.

      Just to complicate the issue, Metezemolo would like to take Alfa Romeo from FIAT automotive and attach it to Ferrari with the aim of making Alfa Romeos more of a specialist sports car producer rather than a mass producer.

      You see, I too can rant off topic.

      --

      And if you thought that was boring you obviously havn't read my Journal ;-)

    6. Re:How it should be by Lars+T. · · Score: 2, Insightful

      Too bad I can't afford the admission cost. Then you have no place in running a business. "With Mac OS X Server and a $300 iMac off eBay"

      --

      Lars T.

      To the guy who modded me down from perfect to terrible Karma - Apple haters still suck

    7. Re:How it should be by Anonymous Coward · · Score: 0

      General Motors owns Vauxhall and Opel, they are not interchangeable.

    8. Re:How it should be by System.out.println() · · Score: 1

      Mac OS X Server can get a lot of low-ball geeks fired... OR it can help low-ball geeks make a lot of money serving a lot more customers. Its all in how you think about it.


      So now we don't just have to worry about outsourcing to India, but outsourcing to our own computers even!

    9. Re:How it should be by MrIrwin · · Score: 1
      " General Motors owns Vauxhall and Opel, they are not interchangeable." Nowdays they are just trade marks and they are interchangable. For example, in the UK the GM range is sold under the Vauxhall name (many people think it is british!), the **same** range is sold in Italy under the Opel trademark, and most Italians have never even heard of Vauxhall.

      In both countries GM is perceived as a remote US company that makes non european cars such as ghetto cruisers, pick up, and SUV's.

      Just by Ironic twist, most Vauxhall/Opel utilities have FIAT drivetrains!

      --

      And if you thought that was boring you obviously havn't read my Journal ;-)

    10. Re:How it should be by Halfbaked+Plan · · Score: 1

      I sell Macs on eBay as a business. I don't buy them.

      --
      resigned
    11. Re:How it should be by grahamlee · · Score: 1

      So you sell stolen Macs then? I'll just go off and fill in that eBay feedback form....

  7. One more thing... by b1t+r0t · · Score: 4, Insightful

    Now all we need is for it to be compatible with Xcode.

    --

    --
    "Open source is good." - Steve Jobs
    "Open source is evil." - Microsoft
    1. Re:One more thing... by IceFox · · Score: 2, Informative

      Probably the same way that I do it under Linux. I alias make to make -j 32 in my bash init file and in the top of my path I have gcc g++ etc all point to distcc (just like the distcc man page gives as an example). So Xcode would just be calling make (really make -j 32) which calls g++-3.3 (really distcc). -Benjamin Meyer

      --
      Do you changes clothes while making the "chee-chee-cha-cha-choh" transformation sound?
    2. Re:One more thing... by snowtigger · · Score: 4, Informative

      It's almost compatible already. XCode uses standard GNU gcc, g++, etc. for compiling.

      In XCode, the equivalent of a Makefile is called project.pbxproj (it's a text file) and the equivalent of make is a command called pbxbuild.

      So everything you need to do is to create the utility that parses project.pbxproj and compiles.

      Of course, make with a Makefile works perfectly fine, but XCode doesn't create those files for you.

    3. Re: One more thing... by aqsalter · · Score: 3, Informative

      And one more thing...

      PBTOMAKE -- Xcode .pbproj to Unix Makefile

      ??

      Why not, I hear you ask??

    4. Re:One more thing... by douthat · · Score: 3, Informative
      I beleive he was talking about making it compatible with XCode's built-in "distributed build", which works automatically via Rendevous and doesn't require any mucking around with command lines. (i.e. Just press the "Build" button)

      From Apple
      Distributed build Anyone could guess that bringing multiple processors to bear on a build would make it go much faster, but Xcode lets you act on the obvious solution. With the Rendezvous-enabled distributed build feature it's easy to simply farm out your build by distributing compile workload across idle desktop machines or, better, deploy a dedicated Xserve build farm to do in minutes what would take hours on any single machine.
      --
      She loves me: 09F911029D74E35BD84156C5635688C0 She loves me not: 09F911029D74E35BD84156C5635688BF ...
    5. Re:One more thing... by IceFox · · Score: 1

      If someone can provide me more information about how this works (and can work in Linux) I will gladly add it to the CD. -Benjamin meyer

      --
      Do you changes clothes while making the "chee-chee-cha-cha-choh" transformation sound?
    6. Re:One more thing... by aqsalter · · Score: 1

      I'm just hypothesising, but...
      1. Set up Linux mDNS responder, as described here: RendezvousForLinuxHacks
      2. Find out the "service code" for xCode rendezvous services, and enter into config file.
      3. Profit!!

      Unfortunately there are comments about Apple using a different/older version of distcc - don't know how that is going to impact things ??

  8. Now there's a paradox by Anonymous Coward · · Score: 0, Funny

    If you compiled on ten computers, you could be using more computers to compile the program than actually could run the program.

    1. Re:Now there's a paradox by Frizzle+Fry · · Score: 0, Offtopic

      That's not a paradox.

      --
      I'd rather be lucky than good.
  9. The iso download by IceFox · · Score: 4, Informative

    Hehe I learned my lesson before. I'll be putting the 46MB iso up later tonight, but if someone wants to host it you can e-mail me or im (aim: icefox2) me and I can get you the file.

    -Benjamin Meyer

    --
    Do you changes clothes while making the "chee-chee-cha-cha-choh" transformation sound?
    1. Re:The iso download by VisorGuy · · Score: 1

      Use BitTorrent.

      --
      This user account is inactive account replaced by the PDA
    2. Re:The iso download by Steve+Cowan · · Score: 1

      Good call. That's exactly the type of thing it's meant for.

    3. Re:The iso download by Anonymous Coward · · Score: 1, Interesting

      http://www.archive.org/web/freecache.php

    4. Re:The iso download by IceFox · · Score: 1

      The link is back up, so feel free to p2p the iso with [insert your fav p2p network] and have fun! -Benjamin Meyer

      --
      Do you changes clothes while making the "chee-chee-cha-cha-choh" transformation sound?
    5. Re:The iso download by grahams · · Score: 1

      Didn't do you any good, CSH is shithammered anyway.

      Thanks, ben, it's not like I needed to check my mail or anything... :P :)

  10. Yessss by zpok · · Score: 1

    Everything that helps porting all that wealth over to OS X is welcome! :-)

    --
    I think, therefore I am...I think.
    1. Re:Yessss by NivenHuH · · Score: 3, Insightful

      You would think more people would love to work with Objective-C.. it really is a nice language =)

      --
      Just when you make it idiotproof, some idiot builds a better idiot.
    2. Re:Yessss by feloneous+cat · · Score: 1

      Objective-C really beats the pants off of C++ (or as I put it, makes programming fun again).

      The only downside to Objective-C is that you DO take a slight (very slight according to those in the know) performance hit.

      Other than that, I love it.

      --
      IANAL, but I've seen actors play them on TV
  11. Apple GCC vs. GNU GCC by WatertonMan · · Score: 3, Interesting

    I thought Apple's gcc was slightly different than the regular gcc - especially in terms of PPC optimizations. If true, then the code output won't be quite the same, will it?

    1. Re:Apple GCC vs. GNU GCC by tyrione · · Score: 2, Informative

      That changes with the very recent release of GCC 3.4 and moreso when GCC 3.5 is released.

    2. Re:Apple GCC vs. GNU GCC by TomorrowPlusX · · Score: 2, Interesting

      Any chance apple's Objective-C++ patches will *ever* be integrated into mainstream GCC?

      I simply could *not* get my development work done ( at least, not gracefully ) without Objective-C++, and that's a bit hampering considering I'm a believer in The Right Tool for the Right Job.

      Some things are better written in C++ and some things are better written in Objective-C. Sometimes both will be needed for one project, and if i have to write vanilla C glue between them I'll be rather unhappy. Sure, C glue-code works, but you tend to lose polymorphism, and you end up with a bunch of typedef'd pointer types, which while acceptable, give me vietnam-style flashbacks to GTK programming, and I don't like that.

      I love developing on Mac OS X, mainly because I love Cocoa. I'd love to be able to port my work to GNU Step, but without Objective-C++ it's simply not going to happen.

      --

      lorem ipsum, dolor sit amet
    3. Re:Apple GCC vs. GNU GCC by Jimithing+DMB · · Score: 1

      I've got an idea for this. First of all I'm going to follow these instructions to make myself a GCC and cctools that target OS X on PPC. Then I'm considering going back and compiling Apple's GCC targetting Linux because I'm rather curious to get wxWindows (err, wxWidgets now) for Cocoa working with GNUstep. The apple version of GCC should still be able to target linux and of course does have an Objective-C++ compiler which I need for wxCocoa.

  12. Error in Title... by Big+Sean+O · · Score: 1, Informative

    The correct word is "Boxen" not "Boxes". Don't you know it's ironical to spell easy words wr0ng?

    And it's also the slashdot way to point out every teh and misused apostrophe.

    --
    My father is a blogger.
    1. Re:Error in Title... by Anonymous Coward · · Score: 0

      nope. 'boxen' is not plural for box, it means 'box-like in nature' as in, "her boxen head was unbelievably disturbing."

    2. Re:Error in Title... by thryllkill · · Score: 1

      Boxen may not be a truly proper English way to pluralize the word box, but it is generally accepted when talking about computers to be a pluralization of the slang box. Box in this case meaning computer. You know, cause they are somewhat box shaped.

      --

      Note to self: No more arguing with the faithful.

  13. Nice job by -tji · · Score: 4, Interesting

    This is a cool concept. I would think that most Mac users have at least one fast/cheap PC laying around. I know I've got a few of them. You might as well use them for some extra horsepower.

    What would be really cool is an x86 agent for iMovie, iDVD, and Final Cut - where it could offload all of the number frunching of MPEG2 compression or other video conversion to some cheap PC's in the basement. I would love to have my 450MHz G4 Cube as the front end, and my Athlon 64 doing the heavy lifting behind the scenes.

    1. Re:Nice job by sean23007 · · Score: 1

      I cannot imagine Apple supporting that at all. They don't want to give the idea that they are admitting inferiority in their hardware. Saying "You can use our hardware in order to have access to our software, and use beige box PCs to do your processing" does not help you out next time you try to convince people it's not a good idea just to port your software to other hardware.

      And anyway, they want you to replace your G4-450 with a G5, not an Athlon64.

      --

      Lack of eloquence does not denote lack of intelligence, though they often coincide.
  14. Sparc... by Roogna · · Score: 2, Interesting


    Now when is someone going to post binaries for cross-compiling to Mach-O PPC from Sparc's. I've got a bunch of Sun's here I could be using. Granted, I know I could do this myself. But gcc takes so bloody long to compile ;)