I submitted an entry into the Linux on POWER contest that I previously discussed here. It turns out that the stuff I got working before (cmdftp in particular) was misleading, because the system that I was using to test on (University of Augsburg) didn’t actually HAVE a 64-bit compiler, and I didn’t know this! So I was compiling 32-bit applications the whole time.<p/>
Anyway, I spent a few days trying to get my hands on a linux/ppc64 machine to test on. There was one more community server listed on the contest site, so I applied to them, but in the meantime I figured I would see if I could make a system on my own that I could actually administer, rather than just get shell access. I tried to get several flavors of Linux running on a friend’s iMac G5, but it turns out that the iMac is significantly different from the G5 tower, and not too many people are trying to run Linux on these things! It didn’t work out very well – I got the Gentoo LiveCD to boot, but it didn’t have the sungem network drivers installed… etc., etc.<p/>
I spent a day on that and then finally got my invite for the other community server. I logged in and, lo and behold, I could actually compile 64-bit binaries! Woohoo! So I did. It was another four hours or so to port cmdftp properly, although a lot of that was administrivia (how to convince configure to pass -m64 to gcc? CFLAGS=-m64). The actual porting issue was pretty simple: the guy used function pointers everywhere, and he used the same template for them all: int (* f)(). Most of his functions really WERE ints, but a couple of them returned strings, and he was just casting the return value to a char* in those cases. Of course, on a 64-bit system, the pointers are 64-bit, and an int will only hold 32 bits! So what I did was created an entirely separate storage mechanism for the function pointers in question – I defined a new strfcn_ptr which was a char* (*f) () and then just used that where applicable.<p/>
Anyway, that was the main issue. Once I solved that and made everything run (my changes worked first time, of course :D ), I updated the README to mention the CFLAGS, zipped it up and submitted it. No sense wasting time, right? I think this port was definitely enough work to earn me a $1000. Hopefully I did it right! Wish me luck and cash!