Saturday, June 13, 2009

Fudgie's glTail with Chipmunk on MS Windows!

Hey folks,

It has been a while. Recently I have been busy with other stuff besides the usual, but a friend of mine suggested (and I completely agree) to be a good utilitarian and post something that will bring the greatest happiness for the greatest number of users :)

Which is this:

but on Windows...

My impression after solving this puzzle is that a number of folks have been getting stuck on implementing Fudgie's glTail (a real-time log file visualization tool) to work on Windows with Chipmunk (a 2D physics game engine).

Here is my take on what I did to get it working (after lots of trials and errors). Before you start doing anything, read this post completely to make sure you won't miss some crucial detail beforehand. Basically it came to the following 13 steps:

Now you need the following two packages:

  1. ruby-opengl 0.40.1
  2. net-ssh 1.1.4

Make sure that you download and install the correct version.

Right, so lets see how to put these two packages into Ruby commands:

  • Fire up the package manager of Ruby
    (Start Menu > Ruby > RubyGems > RubyGems Package Manager)
    NOTE: Packages might take some time to download/install.
  • Type: gem install ruby-opengl --version 0.40.1 [ENTER]
  • Type: 2 [ENTER] for option #2 - ruby-opengl 0.40.1 (i386-mswin32)
  • Type: gem install -y net-ssh -v 1.1.4

So far, so good. Now for the crucial part:

Almost done, chipmunk.so (which is like a .DLL file) is set.

Now when you configure your .yaml file, as was mentioned in the documentation at http://github.com/Fudge/gltail/tree/, you may need to do the following:

  • In the config file you may use IP-Addresses instead of host names. That worked for me somehow when I was trying to connect to my remote host.
  • Check in the bin directory of glTail if the gl_tail file has an extension, if not put .rb as an extension.

Ok, so now its time to run the script. CD in MS-DOS to the root of your glTail directory and type the following:
bin\gl_tail.rb config.yaml

If you see any problems, you may need to do some code editing in the Ruby Files. Do not be troubled, after all this time, this will just take a few more minutes. The error I got and, which solution is given below is a TYPE_ERROR where a function is called and expects one parameter to be an INTEGER but this parameter is NIL during run-time and Ruby does not find that very 24K gold standard, so:

  • Fire up your favorite good ol' code editor and open the file element.rb in the lib\gl_tail\ directory, go to line 276. If I'm not mistaken you should see something like glDeleteLists(@text_list,1).
  • @text_list is NIL for some unknown reason, so we need to wrap an IF statement around it, like this:
    if @text_list != nil
      glDeleteLists(@text_list,1)
    end
  • Now, Ruby will notice another NIL issue, but this time on line 255. Do the same as the previous one, and wrap the @text_list with the above IF-statement.

If all comes to pass, you now are the proud user of a Chipmunk Newton-based awesome log file visualizer... ON WINDOWS MAN!

I would personally like to thank all the folks that have worked on this, including:
- DKnight
- Sebastian Hungerecker-2
- Jim
And of course not excluding:
- Mr.Fudgie
- And the folks at Chipmunk

9 comments:

Fudge said...

Thanks for the detailed walk-through. I was pretty certain it would be possible under Windows, but as I don't even have Windows installed it was a bit hard to debug. :-)

Francis Laclé said...

No problem, its nice to have a tool that makes real-time log tailing worthwhile ;)

Keep it up!

Patrick Moore said...

Really keen to get this working, but I get the following errors. I've checked against the code in 'font_store.rb' and font.bin is definitely there. I'm unfamiliar with Rails though.

I followed your instructions, made those edits, set up copssh (http://www.itefix.no/i2/copssh) on a Windows 2003R2 webserver, and edited the config file to point at the IIS log (e.g. /cygdrive/d/LogFiles/W3SVC2041809229/ex091007.log)
I get:

C:/inetpub/wwwroot/gltail/bin/../lib/gl_tail/font_store.rb:38:in `generate_textures': undefined method `ord' for 0:Fixnum (NoMethodError)
from C:/inetpub/wwwroot/gltail/bin/../lib/gl_tail/font_store.rb:37:in`upto'
from C:/inetpub/wwwroot/gltail/bin/../lib/gl_tail/font_store.rb:37:in`generate_textures'
from C:/inetpub/wwwroot/gltail/bin/../lib/gl_tail/font_store.rb:36:in`upto'
from C:/inetpub/wwwroot/gltail/bin/../lib/gl_tail/font_store.rb:in`generate_textures'
from C:/inetpub/wwwroot/gltail/bin/../lib/gl_tail/font_store.rb:31:in`upto'
from C:/inetpub/wwwroot/gltail/bin/../lib/gl_tail/font_store.rb:31:in `generate_textures'
from C:/inetpub/wwwroot/gltail/bin/../lib/gl_tail/font_store.rb:69:in `generate_font'
from C:/inetpub/wwwroot/gltail/bin/../lib/gl_tail/engine.rb:345:in `start'
from C:/inetpub/wwwroot/gltail/bin/gl_tail.rb:111

Any ideas?

Fudge said...

Either use ruby 1.9.1 or remove the .ord part of the offending lines.

Patrick Moore said...

Thanks! However now I get:
!!! Could not authenticate on x.x.x.x. Make sure you have set the username and password correctly...

But using PuTTY with those same credentials connects to that machine fine. The build of copssh I installed on that servers apparently incorporates OpenSSH 5.3p1. Could there be some version intolerance?

Francis Laclé said...

Perhaps,

I also got a problem while trying to connect. It was resolved when I used IP-Addresses instead of host names.
Good thing it works with PuTTY though.

@Fudge, thanks for the quick reply :)

Patrick Moore said...

After switching to the latest version of net-ssh it worked ok. Now though, I get no output in the OpenGL windows except the two grey vertical bars. If I run with --debug I do see log output, but it doesn't draw blobs. Updating to a newer ruby-opengl doesn't help.
Did you encounter this?

Francis Laclé said...

Do you get any errors? Could you paste the log output?

Fudge said...

Do you have to corresponding blocks defined in your config.yaml?