[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Problem installing Ruby/Tk

Christopher Latif

12/18/2006 1:03:00 PM

Installed Linux
Ruby 1.8.5 from source

I dont't know if I have Tcl/Tk installed already, but I found this
folder:
/home/christopherl/ruby-1.8.5/ext/tk
/home/christopherl/ruby-1.8.5/lib/test/unit/ui/tk

I have also Ruby in these folders:
/usr/lib/ruby
/usr/local/lib/ruby

I tried to run this program
require 'tk'

hello = TkRoot.new {title "Hello World"}
Tk.mainloop

But got this when I tried to run the program:
test.rb:1:in `require': no such file to load -- Tk (LoadError)
from test.rb:1

Suggestions?

--
Posted via http://www.ruby-....

13 Answers

Uma Geller

12/18/2006 2:22:00 PM

0

> Installed Linux
> Ruby 1.8.5 from source
> I dont't know if I have Tcl/Tk installed already, but I found this
> folder:
> /home/christopherl/ruby-1.8.5/ext/tk
> /home/christopherl/ruby-1.8.5/lib/test/unit/ui/tk

Yes that's the _source_ for the tk extensions
Ruby needs that to be compiled

> I have also Ruby in these folders:
> /usr/lib/ruby
> /usr/local/lib/ruby

good

> But got this when I tried to run the program:
> test.rb:1:in `require': no such file to load -- Tk (LoadError)
> from test.rb:1
> Suggestions?

It looks like the build process wasn't able to find Tcl/Tk headers, so
your compiled Ruby ended up without compiled tk extensions.

Can you check whether you have Tk installed in your system, and in
case the answer is positive, verify it provides the necessary header
files.

If the package you use for Tk provides the headers, it may be storing
them in a find the build process is not able to find without
assistance, so you would have to let the ruby build process know that.

Hope that helps

best,
UG
---
Uma Geller
http://umageller.wor...

Christopher Latif

12/18/2006 3:40:00 PM

0

> Can you check whether you have Tk installed in your system, and in
> case the answer is positive, verify it provides the necessary header
> files.
>
> If the package you use for Tk provides the headers, it may be storing
> them in a find the build process is not able to find without
> assistance, so you would have to let the ruby build process know that.
>
How can I determine if I have Tk installed?
I have a Tk.rb in the folder /home/christopherl/ruby-1.8.5/ext/tk/lib.

Here are some folders I have:
home/christopherl/ruby-1.8.5/ext/tk
/home/christopherl/ruby-1.8.5/ext/tk/lib
/home/christopherl/ruby-1.8.5/ext/tk/lib/tk
/home/christopherl/ruby-1.8.5/ext/tk/lib/tkextlib
/home/christopherl/ruby-1.8.5/ext/tk/sample
/home/christopherl/ruby-1.8.5/ext/tk/tkutil

--
Posted via http://www.ruby-....

Uma Geller

12/18/2006 4:28:00 PM

0

> How can I determine if I have Tk installed?
> I have a Tk.rb in the folder /home/christopherl/ruby-1.8.5/ext/tk/lib.
> Here are some folders I have:
> home/christopherl/ruby-1.8.5/ext/tk
> /home/christopherl/ruby-1.8.5/ext/tk/lib
> /home/christopherl/ruby-1.8.5/ext/tk/lib/tk
> /home/christopherl/ruby-1.8.5/ext/tk/lib/tkextlib
> /home/christopherl/ruby-1.8.5/ext/tk/sample
> /home/christopherl/ruby-1.8.5/ext/tk/tkutil

That's actually not Tk, but Ruby's Tk binding for Tk, which needs the
actual Tk library in order to be compiled.

Tk usually comes together with Tcl, a scripting language that was the
first to bundle Tk, so a good way to find out whether you have the
Tcl/Tk pair at all is:
which tclsh

In my openSuse 10.1 box I found libtk to be at:
/usr/lib/libtk8.4.so

but that alone is not enough, you also need to have the C header
files, most probably somewhere inside /usr/include

this is so the ruby build process can build the Tk extension binary
linked against the shared library, so both the Tk header (.h) and the
binary (.so) are needed.

If you find out you don't have Tk installed, or only one of the needed
pieces, you will need to install the part you're missing.

If you use Debian or a Debian based distro like
Ubuntu: http://packages.debian.org/unstable/...
so you can:
apt-get install tk8.4
apt-get install tk8.4-dev

I think Redhat, Suse and Fedora come with Tk by default, but if you
are missing them for some reason, you can install what you need using
Yast, Yum, or apt for RPM.

Of course, the remaining option is building and installing Tcl/tk from
source, just as you're doing with Ruby. Source available at:
http://... (neat TLD by the way)

Hope that helps,

UG
---
Uma Geller
http://umageller.wor...

Christopher Latif

12/18/2006 4:50:00 PM

0

I've installed ActiveTcl8.4, in /usr/local/ActiveTcl-8.4.

I tried to require 'tk' but same problem.
Ruby don't find right path or something??

I've read this text, same problem as me, but I don't understand, do you?
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-...


--
Posted via http://www.ruby-....

David Vallner

12/18/2006 5:53:00 PM

0

Christopher Latif wrote:
> I've installed ActiveTcl8.4, in /usr/local/ActiveTcl-8.4.
>
> I tried to require 'tk' but same problem.
> Ruby don't find right path or something??
>
> I've read this text, same problem as me, but I don't understand, do you?
> http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-...
>
>

Does ActiveTcl come with development headers and files? Did you install
ActiveTcl before or after Ruby? Did the ./configure for Ruby say if and
where it found Tcl? Did you try to reconfigure Ruby manually pointing
./configure at the relevant Tcl/Tk directories and reinstall? Why aren't
you using prebuilt binaries anyway?

David Vallner

Christopher Latif

12/18/2006 6:10:00 PM

0

> Does ActiveTcl come with development headers and files? Did you install
> ActiveTcl before or after Ruby? Did the ./configure for Ruby say if and
> where it found Tcl? Did you try to reconfigure Ruby manually pointing
> ./configure at the relevant Tcl/Tk directories and reinstall? Why aren't
> you using prebuilt binaries anyway?

I've installed ActiveTcl after Ruby.
where do I run ./configure?
what is prebuilt binaries? isn't that?

--
Posted via http://www.ruby-....

Paul Lutus

12/18/2006 6:29:00 PM

0

Christopher Latif wrote:

/ ...

> I've installed ActiveTcl after Ruby.
> where do I run ./configure?

In the root directory of the source. Where an executable script file named
"configure" is located.

> what is prebuilt binaries? isn't that?

"Prebuilt binaries" are executable binaries pre-compiled and ready to to run
on a particular operating system version.

The earlier poster's point is that using prebuilt binaries avoids the
problems you are having right now, assuming they are available for your
operating system version.

--
Paul Lutus
http://www.ara...

Uma Geller

12/18/2006 6:58:00 PM

0

> I've installed ActiveTcl8.4, in /usr/local/ActiveTcl-8.4.
> I tried to require 'tk' but same problem.
> Ruby don't find right path or something??

no, when you require "tk", what you're doing is to load the **ruby
binding for tk** not Tk itself. In turn the ruby binding will load
libtk.so.
In order to build the **ruby binding** when you compile ruby (or
afterwards, using the same build process) you need:
1) Tk shared binary object ( /usr/lib/libtk*.so
2) Tk C headers somewhere in /usr/include

I have no idea what is Active Tcl like, never used that particular
product, but I'm sure the guidelines I gave you should at least give
us an idea of what's the problem.
If Active Tcl is similar to other products like Active Perl, then it
doesn't come with the necessary header files.

did you try any of the tests I suggested in the previous mail ?

> I've read this text, same problem as me, but I don't understand, do you?
> http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-...

finding a new problem won't solve yours, it's as easy as following
these minimal checks

best,

Hidetoshi NAGAI

12/19/2006 1:09:00 AM

0

Christopher Latif

12/19/2006 12:16:00 PM

0

I found the C headers Tk.h and tcl.h in:
/usr/local/ActiveTcl-8.4/include

and libtk.so in:
usr/local/ActiveTcl-8.4/lib

how do I now put it all toghether?
why ran congfigure shell script a couple of times, suddenly the script
is
gone??

thanks for your support.

--
Posted via http://www.ruby-....