Unable to install capybara-webkit - ruby-on-rails-3

When I run
abhay$ gem install capybara-webkit
I get the following error messages.
Building native extensions. This could take a while...
ERROR: Error installing capybara-webkit:
ERROR: Failed to build gem native extension.
/Users/abhay/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
Gem files will remain installed in /Users/abhay/.rvm/gems/ruby-1.9.2-p180/gems/capybara- webkit-0.12.1 for inspection.
Results logged to /Users/abhay/.rvm/gems/ruby-1.9.2-p180/gems/capybara-webkit-0.12.1/./gem_make.out

I had to install QT link as capybara-webkit gem uses it to compile and install.

This sounds a lot like a duplicate of this https://stackoverflow.com/a/11622193
I found the solutions in this answer worked well:
https://stackoverflow.com/a/11622193/3088748

Related

gem not working after installing 'thin' - rails 3.2.8

I got stuck in a dead end after trying to install the gem 'thin' on the environment
RHEL 6.0
Ruby 1.9.3
Rails 3.2.8
As indicated, I added
gem 'thin'
to my Gemfile and ran
bundle install
The installation seemed to be successful, but after that, whenever I run 'gem', I get
<internal:prelude>:8:in `lock': ERROR: Failed to build gem native extension. (Gem::Ext::BuildError)
ERROR: Failed to build gem native extension.
deadlock; recursive locking
Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.3 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/extensions/x86_64-linux/1.9.1-static/eventmachine-1.0.3/gem_make.out
While if I run again 'bundle install' I get
Unfortunately, a fatal error has occurred. Please see the Bundler troubleshooting documentation at
http://bit.ly/bundler-issues. Thanks!
<internal:prelude>:8:in `lock': ERROR: Failed to build gem native extension. (Gem::Ext::BuildError)
ERROR: Failed to build gem native extension.
deadlock; recursive locking
Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.3 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/extensions/x86_64-linux/1.9.1-static/eventmachine-1.0.3/gem_make.out
I even tried to follow troubleshooting at https://github.com/bundler/bundler/blob/master/ISSUES.md but nothing has changed.
Looks like there's something corrupted in the eventmachine gem installation, but I can't neither uninstall or reinstall it.
Has anybody got an idea?
I would like at least to be able to revert to the (working) configuration prior to thin installation....

JRuby failing to install gem dependency cool.io

I'm new with ruby and I'm facing a problem with installing some gems required by a ruby project I'm trying to build
I have installed rvm and I try to run the following command to fetch, if I understand well the missing dependencies of my project
$> jruby --1.9 /home/user/.gem/jruby/1.9/bin/bundle install
And I fall into the following exception:
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Installing rake 0.9.6
Installing addressable 2.3.6
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/jruby-1.7.12-dev/bin/jruby extconf.rb
/usr/local/rvm/rubies/jruby-1.7.12/lib/ruby/shared/mkmf.rb:14: Use RbConfig instead of obsolete and deprecated Config.
mkmf.rb can't find header files for ruby at /usr/local/rvm/rubies/jruby-1.7.12/lib/native/include/ruby/ruby.h
extconf failed, uncaught signal 1
Gem files will remain installed in /usr/local/rvm/gems/jruby-1.7.12/gems/cool.io-1.2.4 for inspection.
Results logged to /usr/local/rvm/gems/jruby-1.7.12/extensions/universal-java-1.7/1.9/cool.io-1.2.4/gem_make.out
My version is
$> ruby -v
jruby 1.7.12 (1.9.3p392) 2014-04-15 643e292 on Java HotSpot(TM) 64-Bit Server VM 1.7.0_60-b19 [linux-amd64]
I've seen on similar posts that a dev package is missing but how do I install it via rvm?
JRuby's native extension support was an experiment and is not recommended to be used.
All of your gems that use MRI's native extension API might just no longer work on JRuby, usually mature gems provide a JRuby specific alternative but that is not always the case.
cool.io gem seems to be one of those (will only work on MRI as it needs to build it's native extension)

ROR + An error occurred while installing kgio (2.8.0), and Bundler cannot continue

Same Question I think : Rails-Unicorn-Install-Error-KGIO
While running bundle install, system is giving error for installing gems.
Gem files will remain installed in c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9
.1/gems/kgio-2.8.0 for inspection.
Results logged to c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/kgio-2.8.
0/ext/kgio/gem_make.out
An error occurred while installing kgio (2.8.0), and Bundler cannot continue.
Make sure that `gem install kgio -v '2.8.0'` succeeds before bundling.
Here I am unable to install kgio gem. I tried a lot but no success. Is there any way to come out of this.
Thanks in advance.
Removed the Unicorn gem from gem list.
gem 'unicorn'
If you are running Windows 7:
Error Installing "kgio-2.9.2" Gem on Windows
platforms :ruby do
gem 'unicorn'
end

Error "...cannot load such file -- mysql2/2.0/mysql2 (LoadError)". On Windows XP with Ruby 2.0.0

The command rails server throws this error.
C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.rb:2:in `require': cannot load
such file -- mysql2/2.0/mysql2 (LoadError)
I use Ruby 2.0.0 from RubyInstaller on Windows XP box.
I figured out what is the problem but I don't know how to solve it. The problem is that there is no any 2.0/ directory in the mysql2-0.3.11-x86-mingw32 gem. This is the gem that rails installs as its dependency from Gemfile:
GEM
remote: https://rubygems.org/
specs:
... many gems here
mysql2 (0.3.11-x86-mingw32)
... many gems here
DEPENDENCIES
...
mysql2
...
This is what is in that mysql2.rb file:
# C:\Ruby200\lib\ruby\gems\2.0.0\gems\mysql2-0.3.11-x86-mingw32\lib\mysql2\mysql2.rb
RUBY_VERSION =~ /(\d+.\d+)/
require "mysql2/#{$1}/mysql2" # <<-- this is that #2 line that throws an error
It is obvious that it takes the current Ruby version number and uses it as the path segment to reach some mysql2 file. In fact it is mysql2.so file. As I use Ruby 2.0.0 the path segment is 2.0:
mysql2/2.0/mysql2
Ok, now lets see how that directory of mysql2-0.3.11-x86-mingw32 gem looks like:
dir: C:\Ruby200\lib\ruby\gems\2.0.0\gems\mysql2-0.3.11-x86-mingw32\lib\mysql2\
No any 2.0/ directory.
I know the issue about libmysql.dll. I have it in my C:\Ruby200\bin. It doesn't help.
I read this answer https://stackoverflow.com/a/5368767/1114926 from the creator of RubyInstaller. I tried but it didn't help. It works for Ruby 1.9.3 because there is 1.9/ directory. But it doesn't work for Ruby 2.0.0.
How to solve it?
UPD 1:
Thank you for your answer. I've tried. Unfortunately I have ERROR: Failed to build gem native extension. error:
C:\>gem install mysql2 --platform=ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
C:/Ruby200/bin/ruby.exe extconf.rb
checking for rb_thread_blocking_region()... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby200/bin/ruby
C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:431:in `try_do': The compiler failed to generate an executable file. (Runtim
eError)
You have to install development tools first.
... other code follows here...
It says:
You have to install development tools first.
But I have full DevKit installed, RubyInstaller installs it. Can't understand what else does it need.
I've already posted an issue to mysql2 GitHub page https://github.com/brianmario/mysql2/issues/364. No answers yet.
Had the absolutely same issue on Windows 7 x64 with Ruby 2.0.0 and DevKit 4.7.
The following steps helped me.
gem uninstall mysql2
Download last MySQL connector from http://cdn.mysql.com/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32.zip
Extract it to C:\connector-6.0.2
gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:\connector-6.0.2\lib" --with-mysql-include="C:\connector-6.0.2\include" --with-mysql-dir="C:\connector-6.0.2"'
Or even shorter:
gem install mysql2 --platform=ruby -- --with-opt-dir="C:\connector-6.0.2"
uninstall mysql2-0.3.11-x86-mingw32, gems compiled before Ruby200 won't work. You have to compile it yourself.
If you run gem uninstall mysql2 and there is a non compiled version listed then just uninstall mysql2-0.3.11-x86-mingw32 - the compiled version else...
Installation
gem install mysql2 --platform=ruby. that would work.
Follow this guide on installing devkit http://rubyonwindowsguides.github.com/book/ch02-04.html.
Then try again.
Exactly the same behavior when I try to install Redmine on windows XP
when I try to do the "rake generate_secret_token", I got "cannot load
such file -- mysql2/2.0/mysql2 (LoadError)"
and when I try to re build mysql2 using --platform=ruby, I got the
same message as you green.
for the moment, I am stucked there ... but if anybody has anything to allow me to move forward, it will be very welcome.
I will keep informed as well
antoine
I almost done the same what #odiszapc described. Uninstall old gem, download mysql-connector-c-noinstall, unzip, but finally I used this command to build native gem:
gem install mysql2 --platform=ruby -- --with-opt-dir=/c/connector-6.0.2
(If you use git-bash then you can use unix style directory syntax.)
Copy paste from that link: https://github.com/brianmario/mysql2/issues/359. It worked for me.
If after installing the gem, you get an error:
"The specified module could not be found.
C:/Devel/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.11/lib/mysql2/mysql2.so"
That can be fixed by copying libmysql.dll to Ruby's bin folder.

RVM: Incorrect Ruby version referenced after removal

Just updated the version of Ruby (1.9.2 to 1.9.3) I have installed but now getting the following error when running rake:
$ rake
-bash: /Users/mike.simmonds/.rvm/gems/ruby-1.9.3-p0/bin/rake: /Users/mike.simmonds/.rvm/rubies/ruby-1.9.2-p180/bin/ruby: bad interpreter: No such file or directory
Any tips?
It appears reinstalling the rake gem has fixed it.
looks like a gem pristine task failed and you had older rvm, I have already changed the upgrade code to run upgrade for every gem separately and report you list of failed gems.
It's important to read outputs of rvm, even we try to automate things and make things very easy - sometimes there is not much we can do with the available tools.