Tuesday, May 25, 2010

Thrift under windows XP

Thrift is nice. It's a decent RPC framework, it's seems quite developer-friendly as long as all the right nuts and bolts are attached in their proper places. This includes having a compiler running on your development system.

For various historical reasons my primary development system is now based on Windows XP, but with daily contributions from OSX and Linux. This means that if I'm to use Thrift, I need a Thrift compiler on XP. This is why I have spent the better part of a day making that happen.

I'm still not certain if i've got everything right, or even if I've gotten enough right for my installation to be really useful, but I do have a running version of the thrift compiler and it seems to be compiling thrift code written by someone else on my project so I have good feeling about this.

Now: What did I have to do in order to get thrift up&running?

  • First I took a peek at this page that explains some things that needs to be done. I tried the binaries, but they are useless and obsolete, so next I tried to compile things for myself. I chose the Cygwin option.
  • First attempt failed badly, no malloc or free found in (lib/cpp/src/Thrift.cpp), so I added "#include " and that bug disappeared.
  • Then I had to move my ant installation to somewhere without a space in its path (that wasn't so hard, I just made a junction (the windows version of hard links) from C:/ to the old installation and put the location in the path). Since paths are hardwired into the makefiles, I had to run ./configure to make this change valid.
  • Then many and varied strange things happened. I didn't really catch on to what what was happening until I saw something along the lines of "FIND " (some error message). The clue here was the capitalized FIND. This indicated that it was windows's find-implementation, not cygwin's that was being used by the make scripts. So I had to change all instances of "find" to "/usr/local/find". I guess i could have changed my path instead, but I didn't. You might want to try to change the path before rewriting all the makefiles :-)
  • Then tings compiled. The compilation stopped with some error message, I restarted it, the compilation continued and finally terminated successfully.
  • I ran "make install" and got myself a thrift.exe installation in /usr/local/bin (cygwin path).

I won't claim that this will work for anyone else, or even to claim very strongly that it has worked for me yet, but this is what I did, and so far it seems to have produced an useful result.

The mind boggles at the fact that this is actually (probably) the simplest way to get a decent RPC mechanism compiled on windows XP in 2010.

No comments: