Ruby Core Dump On Requiring TK - ruby

I tried to use Ruby's TK library today, and it failed miserably, spitting out a nice long core dump.
I'm not sure what I could have done wrong, as I double checked that TK was installed, and even went so far as to reinstall it. I also tried two different versions of Ruby, 2.0.0 and 1.9.3.
The code I tried to execute was simply:
require 'tk'
Here's the core dump on pastebin. Hopefully that will help narrow it down.
http://pastebin.com/LqZ7B8kK
My system details are as follows:
OS: Manjaro Linux, x86_64
Ruby: 1.9.3 and 2.0.0
Using RVM
TK installed
I'd rather not use a different GUI library, as the others seem to be less cross-platform.
Finally, I noticed that StackOverflow doesn't have a tk tag. Someone with enough reputation points might want to create that and get the badge for it. :D

unfortunately pastebin seems to be down right now, so I can't help much, have you enabled tk on your rvm installation? apparently it's disabled by default: RVM Ruby with TK installation (OSX)
the relevant code snippet is
rvm install 1.9.2 --enable-shared --enable-pthread --with-tk --with-tcl
for ruby 1.9.2

Related

`require': cannot load such file -- oauth

I was happily using Emacs's evernote-mode until stupidly removed OS X system ruby (I'm on Yosemite). Then I tried installing one via RVM (first tried 2.0 then 1.9), got all necessary gems, yet thing is still broken. Throws this message:
$HOME/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- oauth (LoadError)
from $HOME/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
from $HOME/.rvm/rubies/ruby-1.9.3-p551/bin/enclient.rb:40:in `<main>'
Please help me to fix that
upd: I don't see the point of reinstalling system ruby (as people suggested) and then having it conflicting with those that I want to use via RVM. Ruby developers advise to use RVM. I symlinked my default Ruby to /usr/bin/ruby.
I seems that specific script uses something I don't have. I remember having hard time figuring out all dependencies and gems and installing them the first time I used that script and after hours of investigating it finally worked. But this time I got stuck.
I tried to run the script outside of Emacs and it runs with no errors (maybe that's not enough to find what's broken)
I tried to run irb and require modules one by one. It says => true until reaches require 'oauth/consumer'. I guess that's what's missing maybe? I run gem install oauth_consumer. It installed few gems, and now says => true for oauth/consumer in irb, the script though still doesn't work
i removed systems ruby once. i just had to go to the trash and put back everything i deleted and it worked for me. don't know how you "removed" your system ruby. besides, if you installed one with RVM then you have to tell RVM to choose and use/set a default ruby. because RVM won't install ruby 1.9.1 (rather a higher version which i think you did). So you have to set to that version.
Like this:
$ rvm --default use 2.1.5
don't forget to install oauth as well. Hope it helps.

Ruby Gems suddenly stopped working on ubuntu 12.04

After a couple of days of not doing pretty much anything on the ubuntu box, I decided to try out some ruby stuff. For this, I wanted to fire up pry. Unfortunately, I was presented with
Sorry, you can't use Pry without Readline or a compatible library.
Please gem install rb-readline or recompile Ruby --with-readline.
~/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
`require': libreadline.so.5: cannot open shared object file: No such
file or directory -
~/.rbenv/versions/2.1.1/lib/ruby/2.1.0/x86_64-linux/readline.so
(LoadError)
Being quite new to linux in general, I figured I'd just do as it said, and install this rb-readline. The installation passes just fine, but doesnt seem to do anything at all. If I do gem list p, the package just doesn't appear.
So yeah, I just don't know what to do to get it working again, and the only thing I managed to find by searching was related to an installation without rbenv and had something to do with sudo etc.
Any ideas?
Without understanding the problem and following the advice in option 2 of the message:
Sorry, you can't use Pry without Readline or a compatible library.
Possible solutions:
* Rebuild Ruby with Readline support using `--with-readline`
* Use the rb-readline gem, which is a pure-Ruby port of Readline <==== Option 2
* Use the pry-coolline gem, a pure-ruby alternative to Readline
I added the gem into the Gemfile (as follows), bundled and pry was then available.
group :development, :test do
gem 'pry'
gem 'rb-readline'
end
I had this problem too. I am using rbenv and reinstalling ruby via
rbenv install -f 2.2.3
did fixed it for me. Of course you'd put in your respective version. -f forces the installation even though you already have that specific version installed. use rbenv global to find out what version you have installed and set.
I have some problem. But I don't want to add gem 'rb-readline'. So try it...
$ln -s /usr/local/opt/readline/lib/libreadline.8.0.dylib /usr/local/opt/readline/lib/libreadline.7.dylib
Do a sudo apt-get install libreadline-dev, seems like you're missing the readline shared library that pry is wanting. If it worked before, not sure why the library isn't there anymore.
I ended up doing rbenv uninstall, followed by rbenv install and re-installing all the gems, and got it back to working. Still no idea what caused it in the first place, but it works now.

How to install/use Ruby Shoes (without Hackety Hack)?

SOLUTION:
You have the same problem, you have to compile Shoes (https://github.com/shoes/shoes/wiki/Building-Shoes-on-Linux)
if rake doesn't work, try to install ruby 1.9.2 through rvm.
I recently started to learn Ruby, and i came across this library.
I tried to install it using the .run file provided by the official site, but it seems like it's broken. If i run it, it tells me:
./shoes-3.1.0.run: 1: eval: ./shoes: not found
And yes, after extracting the file, i found a folder which didnt contain it.
The only runnable thing i find is HacketyHack, which worked, but I prefer to use my own editor.
Since I have just started to learn Ruby, I'm not comfortable with playing with the .rb files to get it working outside of HH. I also tried to install it via apt-get, but after running 'shoes', all i get is:
no such file to load -- rubygems
Compiling from source code didn't work for me. Is there anything else I can try, or am I doing something terribly wrong?
The problem seems to be your ruby version. ruby in the apt repositories is version 1.8.7 which is quite old. Try apt-get install ruby1.9.1
If that doesn't work, I would recommend using rvm. Install, then simply rvm install ruby-2.0.0 which is the latest version, then rvm use 2.0.0. If shoes doesn't work under any of these versions, it's probably a bug in shoes.

Can RVM find versions of ruby it did not install?

I'm running os x lion. A version of ruby was installed when I installed the OS. I then installed RVM and then installed ruby 1.9.2 and made it the default for new shells.
Default Ruby (for new shells)
ruby-1.9.2-p290 [ x86_64 ]
What happend to the older version of Ruby that was already on my system and how can I remove it since RVM doesn't see it?
When I try to use the new hash syntax in code written in textmate or sublime text 2 it fails. When the same code is run in the shell it works. So how do I make ruby 1.9.2 the only ruby installed on my system?
You do NOT want to uninstall the system Ruby. It is required for a lot of applications (including RVM) to function properly.
If you want applications like Textmate or Sublime Text to use a different version of Ruby, you can update their individual configuration settings to set the path to the Ruby binary you wish to use.
Since those apps don't run ruby from the shell like you do they don't work seamlessly with RVM. Fortunately RVM's web site has instructions on integrating RVM with TextMate. You shouldn't have trouble applying the same process for Sublime Text 2 but if you do the web does not want for tutorials on the topic.
Also, RVM is not responsible for any ruby it didn't install. the only other ruby it gives access to is the system ruby, and there it doesn't do gemsets etc. (This is also due to systems like debian that specifically block off things like gem update --system so you don't poison the package that was installed. RVM protects from that as well)

Ruby Irb reacts strangely to control keys

I'm (extremely) new to Ruby, having started today.
I just moved from my system's Ruby 1.8 installation to Ruby 1.9, compiled from source. In doing so, irb has taken a turn for the worse. It reacts in a most unfriendly way to the non-alphanumeric control keys:
UP key prints: ^[[A
DOWN key prints: ^[[B
DELETE key prints: ^[[3~
...and so on. The main result of this for me is that I have no access to previously issued commands. Nor does tab-completion work; though none of this seems to be an issue with Wirble - the same happens when I remove my ~/.irbrc.
I'm using:
Ubuntu 9.10
GNOME Terminal 2.28.1
ruby 1.9.1p376 (2009-12-07 revision 26041) [i686-linux]
Irb version 0.9.5 (05/04/13)
Any ideas? :(
This could be a readline issue. You could try installing libreadline and libreadline-dev packages and rebuild Ruby after that, see if it helps:
apt-get install libreadline5 libreadline5-dev
If you use OS X Snow Leopard and have the same problem there is a description how to fix it here: http://snippets.dzone.com/posts/show/10511
readline is the correct answer. just wanted to say that for os x, you can install readline via homebrew.

Resources