Crashed Pips - Computers, politics, emetic trash

Friday, March 21, 2008

Distributed Building in Xcode

Filed under: Macintosh, Programming — Tags: , , , — Jonathan Rothwell @ 20:05

Building a programming project, especially a very big project, takes a long time, especially on older computers. This is because many files have to be compiled, linked and built. However, Mac OS X allows a way around this using Distributed Builds.

Distributed Builds distributes the workload across any Mac on your network that has opted in, speeding up the process significantly. This is a form of node computing, which operates almost all modern supercomputers. Distributed Builds divide the workload using the Bonjour protocol, using code that is based on Xgrid, which is Mac OS X’s grid computing system (used in System X, a supercomputer at Virginia Tech constructed entirely of Power Mac G5s originally, and now Xserve G5s). Even a little bit of added computing power will improve things drastically.

There are several prerequisites to this. Firstly, the other computers must be Macs running OS X. They must also have an equivalent or higher version of both OS X and Xcode as the ones installed as your main development machine. I’ll go into this in the instructions.

Firstly, however, you must have a suitable environment. You can carry out the build directly over the network, without any fuss whatsoever. It is a ridiculously simple process. If you have a Mac which doesn’t have AirPort which needs it, and is lying around doing nothing, then you can connect it using a relatively cheap Ethernet switch to a Mac which does have AirPort. You can then share the wireless and Internet connection over this subnet. For example, I have a spare Power Mac G3, which I’ve attached to Welchman, my iMac DV, in the following arrangement.

So, with that sorted, it’s important to check the prerequisites for doing a distributed build. In this event, both my machines are running Mac OS X Tiger, but I could also add a Leopard computer if I so wished.

Now, let’s go about setting the damn thing up.

  1. Install Xcode on all machines that don’t already have it installed. Xcode is Mac OS X’s excellent IDE. It can be found on your OS X CD, or can be downloaded from developer.apple.com. It can take up quite a bit of space, but if you don’t install the documentation (this can all be accessed online) it reduces the amount of space needed drastically. If you downloaded the disk image, you can also save some space by ejecting and then Trashing this afterwards.
  2. Open Xcode. By default, it is installed under /Developer/Applications. You might find it useful to drag it onto the Dock to work with later.
  3. On the main development machine, open Xcode preferences (Command-,). Go to the Distributed Builds tab, and check the ‘Distribute builds to…’ switch. Activate the ‘Share my computer with low priority’ switch: you may need to authenticate to do this.
  4. On your other machines, open Xcode preferences, and go to the distributed build tab. Authenticate, and tick the ’share my computer’ box(es). Everything is now set up.
  5. When you next build your Xcode project, the build will be distributed across the machines you have enabled to have the build distributed to.
It really is a cinch. You might have to allow it through the OS X firewall (it is a predefined option), and you might (if you have no DHCP server) have to assign IP addresses manually, but these are in rare cases. Otherwise, you should be just fine and ready to go. And, believe me, it really speeds up the build process.



Friday, December 28, 2007

Review: C All-In-One Desk Reference for Dummies

Filed under: Reviews — Tags: , — Jonathan Rothwell @ 14:47

I originally got my basic grounding in the C programming language from C for Dummies by Dan Gookin. Therefore, when given the companion book, C All-In-One Desk Reference for Dummies, I knew it was going to be a great help in brushing up on the language’s nuances.

The book is immaculately laid out, and is very easy to follow. The descriptions are very good as well; the book makes pointers less of a nightmare than most other programming books out there. However, I do think that it progresses perhaps a little too fast: however, as I’d read C for Dummies beforehand, I already knew my way around and could manage.

The book does have its faults: the return(0); form has now gone out of vogue in favour of return 0;, although to be fair Dan does address this on the book’s semi-official companion website. Either way, that’s hardly going to cause the compiler to cough up errors.

What I do have a problem with is the use of gets() beyond the first section. True, the gets() function is fine to do some learning with, but beyond learning about pointers it’s best to learn about the alternatives. While the website states that fgets() is an adequate alternative to stick with just for now (which it is) I recommend using Charles Falconer’s ggets(), a replacement for the untidy mess of fgets() and scanf(), which eliminates insecurities by doing bounds checking at the same time. Clicky

Overall, however, the book is very good, very informative and incredibly useful.


C All-In-One Desk Reference for Dummies by Dan Gookin
ISBN: 0-7645-7069-2 RRP: £23.99 (UK)
C All-In-One Desk Reference for Dummies is now available via the
Crashed Pips shop in partnership with amazon.co.uk.



Powered by WordPress 2.7 Comments are the responsibility of their respective author. The Rest © 2007-2009 Jonathan Rothwell, unless otherwise stated.