Ruby command-t SEGV - ruby

I am on ubuntu 11.10 and have had vim-gnome installed and working. Using vundle and have installed seeral packages all working.
I have installed command-t but it will not function until C extensions are compiled. Reading the manual this is the solution.
rake make
For me the location is actually:
~/.vim/bundle/command-t
Anyway so I turned rvm off and installed the system 1.8 as advised in the command-t help guide.
I checked the documentation and the most common cause of command-t errors is compiling against the wrong ruby.
So I found this command to check the compiled version.
renshaw#renshaw-TravelMate-5740G:~/.vim/bundle/command-t$ ldd `which vim` | grep ruby
libruby1.8.so.1.8 => /usr/lib/libruby1.8.so.1.8 (0x00007f913932c000)
So I installed rake for the ruby 1.8 and compiled with rake make
renshaw#renshaw-TravelMate-5740G:~/.vim/bundle/command-t$ sudo rake make
/usr/bin/ruby1.8 extconf.rb
checking for ruby.h... yes
and off it goes and compiles.
however start gvim and run \t for command-t and
Vim: Caught deadly signal SEGV
Vim: Finished.
Segmentation fault
How can I get command-t going on ubuntu 11.10?
Update.
Built Gvim from sources using
hg clone https://vim.googlecode.com/hg/ vim
cd vim
sudo ./configure --enable-rubyinterp=yes --enable-pythoninterp=yes --enable-gui=gtk2
make
make install
vim --version | grep ruby
The vim version command returns correct that ruby support is built against my installed system 1.8 but it still SEGV when using command T.
So found and tried this
cd ~/.vim/ruby/command-t
/usr/bin/ruby extconf.rb
make
This failed as well.
I then add this to bashrc from a previous support ticket.
vim() {
(unset GEM_PATH GEM_HOME; command vim "$#")
}

I had similar problems when using the rake task. I solved it by compiling the extension myself.
From the command-t plugin directory:
rvm use system
cd ruby/command-t
ruby extconf.rb
make
sudo make install

Ubuntu 13.04 has the very same issue. After trying different combinations, here is what worked for me.
I don't like building from the source, so I used vim-nox package:
sudo apt-get install vim-nox
Now, when compiling command-t with Ruby 1.8.7 or Ruby 2.0.0 SEGV signals were caught. In order to experiment with different Ruby versions, I installed rvm:
curl -L https://get.rvm.io | bash
Then I used Ruby 1.9.1 to compile the command-t extension:
rvm install 1.9.1
rvm use 1.9.1
cd ~/.vim/bundle/command-t/ruby/command-t
ruby extconf.rb
make
To sum up: vim-nox + ruby 1.9.1 = vim command-t works well on Ubuntu 13.04.

I got it to work on Ubuntu 11.10 following these instructions and building Vim and Command-T with Ruby 1.9.2p290 -
sudo apt-get install python-dev ruby-dev mercurial ncurses-dev liblua5.1-0-dev lua5.1
rvm use 1.9.2
hg clone https://vim.googlecode.com/hg/ ~/vim
cd ~/vim
hg update -C v7-3-154
./configure --with-features=huge --disable-largefile \
--enable-perlinterp --enable-pythoninterp \
--enable-rubyinterp --enable-gui=gtk2 \
make
sudo make install
And then following the Command-T installation instructions for Pathogen, in my case.

This is how I fixed this problem (I believe it's caused by version missmatch):
I had an old version of vim installed (from apt using debian). The old version of vim was using old 1.9.x version of Ruby libraries. I compiled command-t according to the guide in https://github.com/wincent/Command-T. I used ruby 2.1.x during the compilation process. I got SEGV when i did t. I believe it was caused by the version missmatch between the Ruby I used when I compiled command-t and the Ruby vim is using. So the fix was to compile vim against the same Ruby libs that command-t was compiled against. When I upgraded my vim using "apt-get install vim" everything started to work. Now the new version of vim is using the same new Ruby libraries that come with the package manager.

Related

Getting hard time installing Ruby on mac

I am trying to install Ruby on my mac and that too the latest version but having trouble.
The pre-installed ruby on mac is of verion 2.0 however, I need to upgrade the same to latest.
I tried installing ruby with Homebrew like brew install ruby but whenever i check the version, it shows me the earlier version only. Refer Terminal screenshot:
Am trying to learn ruby but this thing got me stuck for long.
Have also tried another package manager rbenv and did rbenv install 2.5.1 but that failed with the following error I have no idea about
The Ruby zlib extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Configure options used:
--prefix=/Users/vshukla/.rbenv/versions/2.5.1
--with-openssl-dir=/usr/local/opt/openssl
CC=clang
CFLAGS= -O3 -Wno-error=shorten-64-to-32
LDFLAGS=-L/Users/vshukla/.rbenv/versions/2.5.1/lib
CPPFLAGS=-I/Users/vshukla/.rbenv/versions/2.5.1/include
Please guide.
Homebrew has correctly installed the last version of ruby in /usr/local/bin. You can check it with:
/usr/local/bin/ruby --version
The macOS version of ruby is installed in /usr/bin. You can check it with:
/usr/bin/ruby --version
If you want to always run the Homebrew versions of installed tools, you have to put /use/local/bin before /usr/bin in your PATH environment variable. You can do this by adding the following line in your ~/.bash_profile:
export PATH="/usr/local/bin:$PATH"
P.S.: According to your macos ruby version, you don't have the last macOS version.
The compile error log contains:
The Ruby zlib extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Try installing "zlib" and then try again, by running:
brew install zlib

how to install ruby 2.0 in debian 6?

I want o install ruby 2.0 and I have followed many tutorials, but none of them works, and the defaul repo apt-get install ruby brings me the 1.8 version (and due is debian has restrictions to update it if is not through the repo) any way to do it?
Ive tried this way
cd /usr/src
wget ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p0.tar.gz
tar xjf ruby.xxx.tar.bz2
cd rubyxxx
./configure --enable-shared
make
make install
and just that, I get error on the next steps, when I make a ruby -version I get this
-bash: /usr/bin/ruby: No such file or directory
the end of the tuto install
cd ext/openssl/
ruby extconf.rb
make install
cd ../readline/
ruby extconf.rb
make install
gem update --system
any idea how to do this in debian 6? thanks
Compile it from the source.
Go here: https://www.ruby-lang.org/en/downloads/
Get the latest stable Ruby 2.x, download the tarball, and compile it. You will be surprised that everything will actually work out of the box, except that you'll have to reinstall the gems once you upgrade to 2.x. Your 2.x will be installed into /usr/local/bin/ruby, so in some of my local scripts, I had to change the shebang to #! /usr/local/bin/ruby to get them work with 2.x. Ruby 1.9.3 will continue being available under /usr/bin/ruby. I'm no theorist or core developer, but this is my experience as a user. And while most gems work with 2.x perfectly, some more complicated ones (such as watir-webdriver), I wasn't able to get working with it, so I still keep 1.9.3 around.
(Update: Now with higher versions of 2.0 and 2.1 in sight, most developers whose gems are alive already adapted to Ruby 2.x.)
If it's a server, you may want to take a look at RVM (https://rvm.io/). It would make your install as simple as :
curl -L https://get.rvm.io | bash -s stable --rails --autolibs=enabled

Rubygems on OSX missing

I feel like a compelte idiot, but I've been wrking on this all day and getting no where.
I've restarted several times trying to get a full install of Ruby on my OSX environment, RVM, Brew, Ruby: and every time I get through to the Ruby install it bottoms out on the rubygems install.
The reason I'm having to start again is that the RVM wouldn't update in Jewelerybox after my first successfull install (used a packaged all-in-one RubyInstaller) so I couldn't manage my gems - a problem caused by the initial Ruby install on the system living in the /usr/local and not under my own directory. To fix this I uninstalled all my Ruby stuff and started again.
All ok until the ruby compiler started gacking on the rubygems install section when installing ruby 2.0.0. Checking out the OSX system files under usr/bin I see that rubygems isn't there either (it should be present by default on OSX). Any ideas? (note that XCode is up to date and has command line tools installed)
Last attempt was:
$ rvm get head --autolibs=3 # get the latest RVM and build required libs
$ rvm requirements # just in case, install all other required stuff
$ rvm remove 2.0.0
$ rvm install ruby-2.0.0
. . . which fires the following error:
[2013-03-19 23:21:50] /Users/matthew.evans/.rvm/rubies/ruby-2.0.0-p0/bin/ruby
Exception `LoadError' at /Users/matthew.evans/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/rubygems.rb:1073 - cannot load such file -- rubygems/defaults/operating_system
Exception `LoadError' at /Users/matthew.evans/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/rubygems.rb:1082 - cannot load such file -- rubygems/defaults/ruby
mkdir -p /Users/matthew.evans/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0
...
install -c -m 0755 /var/folders/nq/wkj89k854tl0w97n68qdn820pzk_51/T/gem.84634 /Users/matthew.evans/.rvm/rubies/ruby-2.0.0-p0/bin/gem
rm /var/folders/nq/wkj89k854tl0w97n68qdn820pzk_51/T/gem.84634
ERROR: While executing gem ... (NoMethodError)
undefined method `fu_stream_blksize' for #<Gem::Commands::SetupCommand:0x007ffd0e054818>
Installing RubyGems
Installing gem executable
I had the exact same error installing ruby v2 within rvm today. I was in a user account on Ubuntu who needed to use 'sudo' -- and enter my account password for sudo -- in order to install OS dependencies.
Your question mentions running rvm requirements to install dependencies. That seems to be new behavior in rvm, as of v1.19. It seemed to install a bunch of dependencies just fine. But then installing ruby bombed.
In earlier rvm versions, typing rvm requirements would just list the dependencies for rvm and for ruby, as in Archonic's answer.
I typed rvm implode and then started over with:
\curl -L https://get.rvm.io | bash -s 1.18.21
source /home/deploy/.rvm/scripts/rvm
rvm requirements
At that point I could install the libraries/tools that rvm said I needed for rvm and ruby, and then rvm install ruby-2.0.0-p0 succeeded.
I believe the issue is where RVM places your dependencies - global vs your user folder. From a book called "Agile development with rails":
First, you’ll need to make sure you have Xcode 3 or later installed...
$ xcodebuild -version
If you have Xcode version 3 installed, you’ll need to install the Git version control system separately. Verify your installation by running the following command:
$ git --version
Next, install RVM itself:
$ curl -L https://get.rvm.io | bash -s stable
Exit your command window or Terminal application and open a new one. This causes your .bash_login to be reloaded. Execute the following command, which provides additional installation instructions tailored to your specific operating system:
$ rvm requirements
Look for the line that tells you how to install the necessary OS dependencies for Ruby (MRI). Once you complete those instructions, you can proceed to install the Ruby interpreter itself:
$ rvm install 2.0.0
The preceding step will take a while as it downloads, configures, and compiles the necessary executables. Once it completes, use that environment, and install rails:
$ rvm use 2.0.0
$ gem install rails --version 4.0.0.beta1 --no-ri --no-rdoc
With the exception of the rvm use statement, each of the above instructions need only be done once. The rvm use statement needs to be repeated each time you open a shell window. The use keyword is optional, so you can abbreviate this to rvm 2.0.0. You can also choose to make it the default Ruby interpreter for new terminal sessions with the following command:
$ rvm --default 2.0.0
You can verify successful installation using the following command:
$ rails -v
If you have trouble, try the suggestions listed under the Troubleshooting Your Install heading on the rvm site.
Hope that does it for you!
This worked for me:
rvm get head
rvm requirements
rvm install ruby-2.0

Ruby 1.9.1 isn't recognized on Ubuntu

I wanted to install ruby 1.9.1 instead of the older version so I ran this command on Ubuntu:
sudo apt-get install ruby1.9.1-full
After the install was complete, I got the following error(s):
WARNING: Installing to ~/.gem since /var/lib/gems/1.9.1 and
/var/lib/gems/1.9.1/bin aren't both writable.
WARNING: You don't have /home/brooks/.gem/ruby/1.9.1/bin in your PATH,
gem executables will not run.
When I run "ruby -v" (without the quotes) I get the following response:
bash: /usr/bin/ruby: No such file or directory
So my questions are: 1) Why is it so difficult to install ruby, 2) How can I resolve this problem?
Thank you for your help!
Br
After the install was complete, I got the following error(s):
Those aren't errors. They're warnings issued by rubygems. If you want to avoid them run rubygems with sudo or add add /home/brooks/.gem/ruby/1.9.1/bin to your PATH variable. Or if you don't care that you can't run executables installed by gems without specifying the whole path, just ignore them.
When I run "ruby -v" (without the quotes) I get the following response:
bash: /usr/bin/ruby: No such file or directory
Try ruby1.9.1 -v
On my Linux systems I ignore apt-get for Ruby, except for the default ruby package that goes into /usr/bin. I will load any other version, like 1.8.7-head or 1.9.1-whatever using RVM into my own space if it's just for me.
If the ruby being installed is system-wide I will use a source tarball and install into /usr/local/bin and adjust my path or the #! line in the source code to determine which version I want invoked.
In my experience Ruby is easy to install on Ubuntu or any Linux as long as I don't use the packages. I know that hurts the feelings of the package maintainers but I haven't found their fruits to be to my taste very often.
For the average user I highly recommend RVM for development and testing as you can have multiple rubies installed and jump back and forth easily by using a #!/usr/bin/env ruby invocation and letting RVM adjust the version I'll run against by doing a rvm use 1.8.7 or rvm use 1.9.1. Or, you can run commands against each installed instance by using rvm ruby .... RVM is a great piece of software and Wayne should be knighted. :-)
On my Ubuntu, /usr/bin/ruby is ruby1.8. /usr/bin/ruby1.9 is ruby1.9 and /usr/bin/ruby1.9.1 is ruby1.9.1
It's a good idea to leave /usr/bin/ruby as ruby1.8 as there may be system programs that expect it to be ruby1.8
You need to update your alternatives for ruby. Try
sudo update-alternatives --config ruby
If you don't already have an option for a particular version you have installed, see this post: http://ubuntuforums.org/showpost.php?p=10057489&postcount=6
1) Why is it so difficult to install
ruby
So difficult?
2) How can I resolve this problem?
Synaptic lists Ruby1.9.1 does that install okay?
Here's the Ruby 1.9.1-p378 tarball - you could try ye olde ./configure && make && make install
I used rvm link text to install ruby 1.9.1 and then 1.9.2
To solve this problem:
sudo apt-get remove ruby ruby1.9.1-full
Download and decompress ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.1-p378.tar.gz.
cd ruby-1.9.1-p378
ls configure - if there isn't a "file not found" error, skip to step 6.
autoconf
./configure - if there are any errors, post them in a comment.
make
sudo make install
which ruby - if there is any output, do not go on.
which ruby-1.9.1 or which ruby1.9.1 - There should be output from one of those.
cd to the directory revealed by step 10.
sudo ln -s <your_ruby> ruby, where <your_ruby> is whichever command in step 10 produced output, either ruby-1.9.1 or ruby1.9.1.
repeat step 12, replacing ruby for gem, irb, ri, and rdoc. So one might be sudo ln -s gem-1.9.1 gem.
If you get the same WARNING: Installing to ~/.gem since...:
nano ~/.profile
append this:
.
export PATH=/home/brooks/.gem/ruby/1.9.1/bin:$PATH
export GEM_HOME=/home/brooks/.gem/ruby/1.9.1
Again, if there are any errors, post them in a comment on this answer.

Installing Ruby 1.9.1 on Ubuntu?

I wonder about installing the latest version of Ruby on Ubuntu 9.04. Now I can run through the ./configure and make stuff fine, but what I wonder about: how to avoid conflicts with the packaging system? For example if some other package I install depends on Ruby, wouldn't the package manager install the (outdated) Ruby package and in the worst case overwrite my files?
So I think I need some way to tell Ubuntu that Ruby is in fact already installed?
Save yourself the headache and use RVM (Ruby Version Manager)
Keep in mind, Rails 3 works best with Ruby 1.9.2. Ruby 1.9.2 fixes up quite a few bugs in 1.9.1 and is preferable to running 1.9.1.
With RVM installing 1.9.2 is a breeze.
sudo apt-get install ruby1.9.1-full
(http://www.ruby-lang.org/en/downloads/)
After running
sudo apt-get install ruby1.9.1-full
It's solution is to run the following command:
sudo update-alternatives --config ruby
Then you will get this output:
There are 2 choices for the alternative ruby (providing /usr/bin/ruby).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/ruby1.8 50 auto mode
1 /usr/bin/ruby1.8 50 manual mode
2 /usr/bin/ruby1.9.1 10 manual mode
Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/bin/ruby1.9.1 to provide /usr/bin/ruby (ruby) in manual mode.
$ ruby --version
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
Credit for this solution goes to person who answered https://askubuntu.com/questions/91693/how-do-you-uninstall-ruby-1-8-7-and-install-ruby-1-9-2 . Currently the ruby1.9.1 package is actually ruby 1.9.2.
The way I did it was to build it using checkinstall which lets you build a deb package. So I downloaded the Ruby 1.9.1 source, did a "configure" and then "make", did a "checkinstall" and made the package name ruby1.9 so it installs as if it were a new version of ruby 1.9 (as it should).
I got the Ruby specific info from this site.
You can install most software in a different directory with the --prefix=/path switch. And it is common to install in /opt/ for everyone on your pc, or in $HOME if it is only for you.
For installing in /opt:
$ ./configure –prefix=/opt/ruby
$ make install
If you want to use the /opt installed ruby, edit you ~/.bashrc and add
export PATH=/opt/ruby/bin/:$PATH
If you don't want to have the custom Ruby build as default, you can add this to your ~/.bashrc instead of the former command
function setupruby {
export PATH=/opt/ruby/bin/:$PATH
}
Here is a short and convenient way to install 1.9.1 and to make it default:
http://michalf.me/blog:make-ruby-1-9-default-on-ubuntu-9-10-karmic-koala
I created a launchpad ppa for ruby 1.9.2. Details in the links below
http://www.humbug.in/2010/launchpad-ppa-for-ruby-1-9-2-and-some-ruby-bindings/
sudo add-apt-repository ppa:pratikmsinha/ruby192+bindings
cd /etc/apt/sources.list.d/; sudo mv pratikmsinha-ruby192+bindings-lucid.list pratikmsinha-ruby192bindings-lucid.list
sudo aptitude update
sudo aptitude install ruby1.9.2
Looking through Synaptic it seems like you don't even have to deal with the Multiverse or third-party repositories. But since sudo apt-get install ruby currently installs an alias to ruby1.8, you should install ruby1.9 explicitly – manually or via the repositories – and create the alias ruby yourself.
You may want to put the binary in /usr/bin since that's where the distribution would put it anyway. Anywhere on your PATH is fine, though.

Resources