Tcl interface

I’m running ruby on a kubuntu dapper installation. I compiled ruby from
source for the installation.

I just tried starting an application using the ‘tcl’ interface. Problem:
when I use require ‘tcl’, I get an error message telling me that tcl
will not load. Looking at the book, “Programming Ruby”, it says that the
tcl interface is part of the standard installation. I have installed tcl
through synaptic - and it tells me that it is installed.

What do I need to do to make this package available? All help greatly
appreciated.
—Michael

Michael S. wrote:

appreciated.
—Michael

I dunno, but you might have to build the ruby tk extension after
installing tk, in case it is checking for a working tk and aborting the
build if it doesn’t find one. Apologies in advance if this doesn’t
help…

Joel VanderWerf wrote:

I dunno, but you might have to build the ruby tk extension after
installing tk, in case it is checking for a working tk and aborting the
build if it doesn’t find one. Apologies in advance if this doesn’t
help…

That sounds like it would work. The problem, though, is that I can’t
find ANY information on building the Ruby tk interface.

I’ve googled, Asked, searched the ruby site all to no avail. The only
thing I’ve found is in the “Programming Ruby” book, which says that it’s
installed as part of the ruby release.

Does anyone have any information on where to get / how to build this. I
do have tk installed on the system.

—Michael

From: Michael S. [email protected]
Subject: Re: tcl interface
Date: Sat, 24 Feb 2007 07:15:18 +0900
Message-ID: [email protected]

That sounds like it would work. The problem, though, is that I can’t
find ANY information on building the Ruby tk interface.

The basic library of Tcl/Tk interface on Ruby is ‘tcltklib’.
Please read ‘ext/tk/README.tcltklib’ on the source tree.
Tk library is required to compile ‘tcltklib’.
if you succed to make ‘tcltklib’, you will succeed “require ‘tk’”.
^^
‘tk’ is a higher order library of Tcl/Tk interface.

If you want to use Tcl interpreters without Tk,
you have to use ‘tcltklib’ directly.
For example,

require ‘tcltklib’
ip = TclTkIp.new(’’, false)
ip._invoke(‘info’, ‘commands’)

or

ip._eval(‘info commands’)

ip.mainloop(false) # if you need

From: Michael S. [email protected]
Subject: Re: tcl interface
Date: Sat, 24 Feb 2007 12:01:50 +0900
Message-ID: [email protected]

I did. I’ve insured that tcl and tk (with development files) are
installed. I verified that the library files are in /usr/lib, and the
include files are in /usr/include/tcl8.4

I then rebuilt ruby with the following commands:
make clean

Please “rm ext/tk/Makefile”.

./configure --prefix=/usr/ --with-tcllib=tcl8.4 --with-tklib=tk8.4
–with-tcl-include =/usr/include/tcl8.4 --with-tcl-lib=/usr/lib
–with-tk-include=/usr/include/tcl8.4 --with-tk-lib=/usr/lib

Maybe, ‘–enable-pthread’ is required (depend on your Tcl/Tk library).

Hidetoshi NAGAI wrote:

Please “rm ext/tk/Makefile”.

./configure --prefix=/usr/ --with-tcllib=tcl8.4 --with-tklib=tk8.4
–with-tcl-include =/usr/include/tcl8.4 --with-tcl-lib=/usr/lib
–with-tk-include=/usr/include/tcl8.4 --with-tk-lib=/usr/lib

Maybe, ‘–enable-pthread’ is required (depend on your Tcl/Tk library).

I did both these, and it now works great. I don’t know which fixed it,
but suffice it to say it’s fixed.

Just out of curiosity: do you know of any other libraries that are
potential trouble spots?

Regardless - thanks much
—Michael

Hidetoshi NAGAI wrote:

The basic library of Tcl/Tk interface on Ruby is ‘tcltklib’.
Please read ‘ext/tk/README.tcltklib’ on the source tree.
Tk library is required to compile ‘tcltklib’.
if you succed to make ‘tcltklib’, you will succeed “require ‘tk’”.

I did. I’ve insured that tcl and tk (with development files) are
installed. I verified that the library files are in /usr/lib, and the
include files are in /usr/include/tcl8.4

I then rebuilt ruby with the following commands:
make clean
./configure --prefix=/usr/ --with-tcllib=tcl8.4 --with-tklib=tk8.4
–with-tcl-include =/usr/include/tcl8.4 --with-tcl-lib=/usr/lib
–with-tk-include=/usr/include/tcl8.4 --with-tk-lib=/usr/lib
make
sudo make install

Still, require ‘tk’ fails telling me that tcltklib isn’t there.

I’ve grepped the configure script and the makefiles for ‘tcl’ and ‘tk’
and don’t see where the configuration parameters are even used. grep tk
doesn’t find anything, and grep tcl doesn’t find anything practical.

Beyond that, I don’t see anything to help me diagnose why tcltklib isn’t
being made.

Any clues, or is it just not possible to configure?

‘tk’ is a higher order library of Tcl/Tk interface.

If you want to use Tcl interpreters without Tk,
you have to use ‘tcltklib’ directly.
For example,

require ‘tcltklib’
ip = TclTkIp.new(’’, false)
ip._invoke(‘info’, ‘commands’)

or

ip._eval(‘info commands’)

ip.mainloop(false) # if you need

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs