Remoting

Universal Binaries with GCC

I wanted to post a screenshot of the successful Mac build, but it was on Gophur’s Mac. +Delegation/-Screenshottery.

Took me a little while figuring out how to build lua 5.1 and tolua++ as universal binaries. On the mac, gcc will accept multiple “-arch” options.

What you have to watch out for is existing, single-arch entries and then you add the following flags to CFLAGS/CCFLAGS/LDFLAGS:

-mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOS10.4u.sdk -arch i386 -arch ppc

You might also need to add “-force_cpusubtype_ALL” but I don’t quite get why.

The last gotcha for me was that I’d already gotten architecture-specific versions of the libraries installed which leads to some weird symptoms while trying to build new versions, and the lua5.1 sources appear to be missing the “doc” folder.

Async Ajax streaming

Well, fnar.

 

I got my web-based Mac client builder working after wrestling with Roxen and Apache to convince one of them to send raw output without waiting for the CGI script to finish (Apache needed my CGI script to explicitly output a “Content-Encoding: chunked” header of it’s own). I’ve got my little status <div> updating on the fly by using setInterval to periodically check for new lines of text added to ajax.responseText. And it works under Safari and Firefox.

Apparently, though, IE doesn’t populate responseText until readyState == 4 and status == 200; if you try to access it before then you get a javascript error saying “The data necessary to complete this operation is not yet available”. Oh, well, networking remains one of Microsoft’s weakest areas. Maybe they’ll get compatible in a future version of XMLHttpRequest / XMLHTTP.

Chunked encoding…

I’ve spent all evening wrestling with an itty-bitty problem, getting the output of a CGI script to … well, output. I finally narrowed it down to a couple of simple things:

. Compression was enabled, so apache has to read all the output from the CGI before it can do anything,
. I wasn’t adding the “Content-Encoding: chunked” header by myself, so apache wants to read all the output before writing anything to the browser.

Thanks, Apache.