Tuesday, April 07, 2009

We'd only have to call it 'DAMP'

Since, in a fit of exuberant irony, my crash reporter clone is causing more crashes than it reports, I thought I'd give it a rest for a little while and instead look at getting some untested applications running instead. I thought that maybe having a working web app stack might be of some use to someone, so decided to look at the Apache-MySQL-PHP trio.



Binary roots are available on Mac OS Forge for Apache and MySQL, which I should have taken as a warning. They both installed without too much trouble: Apache needed expat, which was available but uninstalled, and MySQL just needed a little post-installation configuration, creating the default database and so on. So far, so good.



There was also a binary root of PHP4 available, but I thought, no, we'll go for the almost latest PHP5 in the apache_mod_php project. Of course, the absence of a binary root means that it wouldn't build for the boys at Apple, but then they don't usually try that hard.



Four hours later and I'm about ready to smash something. Trying to coax darwinbuild into building something it doesn't want to is one of the most frustrating experiences its ever been my misfortune to undertake. A custom build .plist got me over one set of problems — it was trying to build all four OS X architectures and threw a fit when it hit a library which had been stripped down to just i386 — but right now it's refusing to see a set of header files which are absolutely definitely there, and I have no idea what to try next, short of hacking the source code about, which I really didn't want to have to do.



Tomorrow I'll waste some more time seeing if I can get a tool chain running in Darwin itself. We then may be able to get non-Apple source packages to compile natively... although I'm not going to hold my breath.



I honestly can't wait until Snow Leopard comes out and we have to start again from scratch.


Saturday, April 04, 2009

Nothing to (Crash) Report

I wish I could write the kind of informative technical blog post I've spent the past couple of days Googling for. Instead I seem to spend all of my time trudging along in other people's footsteps. And all of my open source efforts appear to be focused on re-inventing Apple's wheel.


Case in point: I'm currently trying to implement a crash reporter-like daemon for Darwin. A couple of launchd-spawned daemons expect to find it waiting for them, and scrawl their displeasure at its absence across the console, which is a pain as I've just got a proper getty-based login prompt up and running. Crash reporter is, of course, closed source, so enter my pale imitation. The power of cut-and-paste quickly got me the appropriate .plists, which shut the nagging daemons right up. Until one of them crashed, meaning I might as well make the fake crash reporter do something useful and report the crash.


So I'm now working on code which combines interacting with launchd — to retrieve the ports it's set up in advance for the daemon — and Mach exceptions — by which the actual crash is reported. If there are two less-well-documented parts of OS X/Darwin, well, I doubt anyone outside of Apple has heard of them. The launchd side of things I managed to get working using code from one of Darwin's launchd-using parts (I think it was xinit). Mach exceptions — and in particular, the difference between exc_server() and mach_exc_server(), and why one refuses to work while the other is hiding from the linker — however, are still a mystery to me.


I guess a trip to the darwin-dev mailing list on Monday is in order.