I can not get ruby before , requiring "tk" . I am using rvm, ruby 2.0.0, ActiveTcl-8.6 and Ubuntu 12.04 LTS. I ran a wish with ActiveTcl and it seems to work.
I looked at the RVM website http://rvm.io/integration/tk and a few StackOverflow questions such as RVM Ruby with TK (OSX) installation .
I tried rvm reinstalling 2.0.0 --enable-shared -enable-pthread -with-tk -with-tcl several times in different versions of ruby without success.
Any thoughts?
When I run irb and execute require'tk ' , I get the following:
LoadError: cannot load such file -- tk from /home/brooks/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require' from /home/brooks/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require' from (irb):2 from /home/brooks/.rvm/rubies/ruby-2.0.0-p353/bin/irb:12:in `<main>'
When this works, I think you need to return true .
I have not tried anything else because I cannot figure out what else to do. I watched how to work and check the boot path using ruby -e '$:' I get
[ brooks@ubuntu :~/sites/depot]$ruby -e 'puts $:' /home/brooks/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0 /home/brooks/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/x86_64-linux /home/brooks/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby /home/brooks/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/vendor_ruby/2.0.0 /home/brooks/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/vendor_ruby/2.0.0/x86_64-linux /home/brooks/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/vendor_ruby /home/brooks/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0 /home/brooks/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/x86_64-linux
This is similar to what you expect, I think. Sorry for the formatting, I'm new to the editor.
Following the idea that this is a path problem, I found tk.rb in my files and tried the following in irb:
2.0.0-p353 :003 > require '/home/brooks/.rvm/src/ruby-2.0.0-p353/ext/tk/lib/tk' LoadError: cannot load such file -- tcltklib from /home/brooks/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require' from /home/brooks/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require' from /home/brooks/.rvm/src/ruby-2.0.0-p353/ext/tk/lib/tk.rb:6:in `<top (required)>' from /home/brooks/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require' from /home/brooks/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require' from (irb):3 from /home/brooks/.rvm/rubies/ruby-2.0.0-p353/bin/irb:12:in `<main>'
So now tcltklib is required in the tk.rb file, which causes the problem. This seems to confirm that there is a problem with $ PATH or $ load_path. But a search for the tcltklib.rb file does not cause anything. There is a tcltklib.c file.
I tried a few more things. After a more thorough reading of the output of the ruby installation via rvm, a warning appeared that X11 lib was not installed and that Tk would not be active after the ruby build. I did sudo apt-get install libx11-dev and then rvm reinstall 2.0.0 --enable-shared --enable-pthread --with-tk --with-tcl again. This time, irb requires 'tk' , which caused a core dump. I tried again and it worked. Then I ran a short ruby script that also uses require 'tk' . It also dropped kernels, but worked after several attempts. Now it hit or missed for both, sometimes it works, sometimes it resets the kernels.