Ruby: install mysql2 - ruby

Windows 7 32bits
Hi everyone, how can I install mysql2 properly in windows 7 I have this error:
c:\dev\mysql2>gem install mysql2-0.3.13.gem --no-ri --no-rdoc -- --with-mysql-di r=c:\mysql-connector-c-noinstall-6.0.2-win32
This could take a while...
ERROR: Error installing mysql2-0.3.13.gem:
ERROR: Failed to build gem native extension.
C:/Ruby200/bin/ruby.exe extconf.rb --with-mysql-dir=c:\mysql-connector-c-noi
nstall-6.0.2-win32
Gem files will remain installed in C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.
3.13 for inspection.
Results logged to C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.13/ext/mysql2/g
em_make.out
c:\dev\mysql2>

Try to install using different version, It's happens because sometime binary is not available for specific verion for window.
gem install mysql2 -v 0.2.6
If still you have issues, Try below steps.
1) Download the MySql C Connector from: http://dev.mysql.com/downloads/connector/c/
NOTE Don't download the installer, download the ARCHIVE for your OS
2) Extract the file to C:\mysql-connector
3) Then ran:
gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:\mysql-connector\lib" --with-mysql-include="C:\mysql-connector\include" --with-mysql-dir="C:\mysql-connector"'
It's works for me.

Related

cannot install sqlite3 using gem

I'm trying to install Metasploit on my Raspberry Pi 2.
But when I try to execute this command:
gem install wirble sqlite3 bundler
I get this error:
Successfully installed wirble-0.1.3 Parsing documentation for
wirble-0.1.3 Done installing documentation for wirble after 2 seconds
Building native extensions. This could take a while... ERROR: Error
installing sqlite3:
ERROR: Failed to build gem native extension.
/usr/bin/ruby2.1 extconf.rb mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in
/var/lib/gems/2.1.0/gems/sqlite3-1.3.13 for inspection. Results logged
to
/var/lib/gems/2.1.0/extensions/arm-linux/2.1.0/sqlite3-1.3.13/gem_make.out
Successfully installed bundler-1.15.4 Parsing documentation for
bundler-1.15.4 Done installing documentation for bundler after 73
seconds 2 gems installed
The system is missing ruby dev files. If you are using Debian
sudo apt-get install ruby-dev
should do the work.
Install ruby-dev using your package managers. (package name may differ across different linux distros)

ERROR: Error installing jekyll: ERROR: Failed to build gem native extension

My system has:
ruby 2.0.0p451 (2014-02-24) [x64-mingw32]
gem -version 2.2.2
devKit : DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe
When I try to run gem install jekyll, I get this error:
D:\devKit>gem install jekyll
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
"D:/Program Files (x86)/Ruby200-x64/bin/ruby.exe" extconf.rb
D:/Program Files (x86)/Ruby200-x64/bin/ruby.exe: invalid switch in RUBYOPT: -F (
RuntimeError)
extconf failed, exit code 1
Gem files will remain installed in D:/Program Files (x86)/Ruby200-x64/lib/ruby/g
ems/2.0.0/gems/fast-stemmer-1.0.2 for inspection.
Results logged to D:/Program Files (x86)/Ruby200-x64/lib/ruby/gems/2.0.0/extensi
ons/x64-mingw32/2.0.0/fast-stemmer-1.0.2/gem_make.out
I got this error while installing Jekyll on Linux (Mint 17, which is based on Ubuntu 14.04).
I eventually found the solution here. I needed both the ruby-dev package and nodejs (the latter due to a bug in Jekyll).
sudo apt-get install ruby ruby-dev make
sudo gem install jekyll --no-rdoc --no-ri
sudo apt-get install nodejs
I ran into this problem too. Running the following installed Jekyll for me:
$ \curl -L https://get.rvm.io | bash -s stable --rails --autolibs=enabled
$ sudo gem install jekyll
This installs RVM, updates Rails and installs Jekyll.
BTW - Most of the posts I've found indicate it's a problem with Xcode not having the developer tools installed. I have a newer MacBook Pro on which this stuff was installed by default, so attempting to install the Xcode dev tools did nothing for me (unlike the above, which did everything I needed).
try
gem update
then
gem install jekyll
And you may want to try with Ruby 1.9.3 and compatible DevKit.

Problems installing gems with RubyGems

I'm using Debian 5
Ruby version 1.8.7
Rubygems version 2.0.3
Rails version 3.2.12
I made my Ruby on Rails app and want to deploy it publicly, so I tried to install "Mongrel" without any luck and then "Unicorn" also without any luck and same error.
vps1198019:~# gem install mongrel
Building native extensions. This could take a while...
ERROR: Error installing mongrel:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/ext/http11/gem_make.out
and
vps1198019:~# gem install unicorn
Building native extensions. This could take a while...
ERROR: Error installing unicorn:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/kgio-2.8.0 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/kgio-2.8.0/ext/kgio/gem_make.out
Try using below command. Because of version mismatch, gem is not installed.
$ gem install mongrel --pre
So I found a solution for my problem by installed it more manually. I downloaded Unicorn from http://rubyforge.org/frs/?group_id=1306 (.gem file). Stored it in server. Went to that folder with terminal. Then I accessed it with
gem install --local unicorn.gem
Then it prompted that I must have kgio and raindrops so I installed them:
gem install kgio
gem install raindrops
and repeated first command.

Using RubyGems on ubuntu server

I have installed Ruby on Rails on my Ubuntu 10.04 Server by official tutorial: https://help.ubuntu.com/10.04/serverguide/C/ruby-on-rails.html
But I have some troubles with it. Please, help me!
1) I can't install ANY gem!
sudo gem install sqlite3-ruby
returns
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native
extension.
/usr/bin/ruby1.8 extconf.rb
extconf.rb:3:in `require': no such
file to load -- mkmf (LoadError) from
extconf.rb:3
Gem files will remain installed in
/var/lib/gems/1.8/gems/sqlite3-1.3.3
for inspection. Results logged to
/var/lib/gems/1.8/gems/sqlite3-1.3.3/ext/sqlite3/gem_make.out
2) When i'am trying to get Rails version by command
rails -v
Server prints:
getopt: invalid option -- 'v'
Terminating...
If you are not set on using the packages in the Ubuntu repos(and I see no reason why you'd be), I'd suggest following this guide:
http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you
Consider going through and making sure your sqlite3 libraries are installed. It looks as though you may be missing the required dependencies to build your gem. In this case you might try running this before installing your gem:
sudo apt-get install libsqlite3-dev
Also, try
rails --version
instead.

error while installing fastthread from ruby gem . How to remove the error?

gem install fastthread -v1.0.7
Building native extensions. This could take a while...
ERROR: Error installing fastthread:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
extconf.rb:8:in `require': no such file to load -- mkmf (LoadError)
from extconf.rb:8
Gem files will remain installed in /var/lib/gems/1.8/gems/fastthread-1.0.7 for inspection.
Results logged to /var/lib/gems/1.8/gems/fastthread-1.0.7/ext/fastthread/gem_make.out
This is what I got when I tried installing from fastthread to set up SUP mail client on my system . How to get rid of this error?
Install these and then try re-installing:
sudo apt-get install ruby1.8-dev
Try this link http://kenno.wordpress.com/2009/07/25/fixed-extconf-rb8in-require-no-such-file-to-load-mkmf-loaderror/
I was getting this same error in OS X Lion. Having Xcode 4.3 installed doesn't cut it. You have to go to preferences in Xcode and install the command line tools, which installs the necessary compiler tools for doing native builds on the system. After I did this, then gem install fastthread worked for me.
Just to add to this, on debian and ubuntu the "complete" ruby package is this:
ruby1.8 ruby1.8-dev ri1.8 rdoc1.8 irb1.8 ruby1.8-elisp
ruby1.8-examples libdbm-ruby1.8 libgdbm-ruby1.8 libtcltk-ruby1.8
libopenssl-ruby1.8 libreadline-ruby1.8
So something like
sudo aptitude install ruby1.8 ruby1.8-dev ri1.8 rdoc1.8 irb1.8 ruby1.8-elisp ruby1.8-examples libdbm-ruby1.8 libgdbm-ruby1.8 libtcltk-ruby1.8 libopenssl-ruby1.8 libreadline-ruby1.8
Will save you a lot of time when doing bundle install on a large project.

Resources