# Tcl interface

**URL:** <https://www.ruby-forum.com/t/tcl-interface/86606>\
**Category:** Ruby\
**Created:** [February 23, 2007, 5:42pm UTC](https://www.ruby-forum.com/t/tcl-interface/86606 "2007-02-23T17:42:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [February 23, 2007, 5:42pm UTC](https://www.ruby-forum.com/t/tcl-interface/86606/1 "2007-02-23T17:42:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [February 23, 2007, 11:06pm UTC](https://www.ruby-forum.com/t/tcl-interface/86606/2 "2007-02-23T23:06:10Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [February 23, 2007, 11:15pm UTC](https://www.ruby-forum.com/t/tcl-interface/86606/3 "2007-02-23T23:15:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [February 23, 2007, 11:49pm UTC](https://www.ruby-forum.com/t/tcl-interface/86606/4 "2007-02-23T23:49:17Z")

</div>

From: Michael S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: tcl interface  
Date: Sat, 24 Feb 2007 07:15:18 +0900  
Message-ID: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> 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

---

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [February 24, 2007, 8:48am UTC](https://www.ruby-forum.com/t/tcl-interface/86606/5 "2007-02-24T08:48:50Z")

</div>

From: Michael S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: tcl interface  
Date: Sat, 24 Feb 2007 12:01:50 +0900  
Message-ID: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> 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).

---

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [February 25, 2007, 12:09am UTC](https://www.ruby-forum.com/t/tcl-interface/86606/6 "2007-02-25T00:09:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [February 24, 2007, 4:01am UTC](https://www.ruby-forum.com/t/tcl-interface/86606/7 "2007-02-24T04:01:47Z")

</div>

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
