Sunday, December 18, 2005

Ruby and Tk on Solaris

Learning Ruby has been a pleasant and rewardable experience. Since May of this year it became one of my most valuable assets for solving problems at work, replacing Perl.

The need to understand how Ruby on Rails works started the quest. And it was such a joy programming in Ruby that I felt compelled to expand its use beyond scripting and web applications development.

Some scripts were asking for a GUI so it seemed like the next step to take. There are a hand of toolkits for which there are Ruby interfaces, like Qt, Gtk and FOX, but I choosed Tk to begin with. I made some tests on Windows, but I couldn't run them on Solaris. When requiring tk I got this error:

LoadError: No such file to load -- tcltklib

I wasn't able to find instructions on where to get and install the missing tcltklib file with Google. Hopefully this post will change this, helping those having the same problem.

The missing library is found in the ext/tcltklib directory, right inside the Ruby distribution. The installation is really simple, after reading the README file:

# ruby extconf.rb --with-tcl-include=/usr/sfw/include
# make && make install

Trivial. But easy to overlook.

No comments: