Install libvirt plugin on vagrant version >= 1.8.1 on Windows PC - ruby

I ran into a problem installing libvirt plugin at vagrant version 1.8.1 using the following command:
vagrant plugin install --verbose vagrant-libvirt
This is the output I get:
Installing the 'vagrant-libvirt' plugin. This can take a few
minutes... Warning: this Gemfile contains multiple primary sources.
Using source more tha n once without a block is a security risk, and
may result in installing unexpect ed gems. To resolve this warning,
use a block to indicate which gems should come from the secondary
source. To upgrade this warning to an error, run bundle con fig
disable_multisource true. Fetching source index from
http://gems.hashicorp.com/ Fetching gem metadata from
https://rubygems.org/.......... Fetching version metadata from
https://rubygems.org/...... Fetching version metadata from
https://rubygems.org/.. Resolving dependencies....... Using builder
3.2.2 Using bundler 1.10.6 Using ffi 1.9.10 Using childprocess 0.5.9 Using erubis 2.7.0 Using excon 0.45.4 Using formatador 0.2.5 Using
fog-core 1.36.0 Using multi_json 1.11.2 Using fog-json 1.0.2 Using
mini_portile 0.6.0 Using nokogiri 1.6.3.1 Using fog-xml 0.1.2 Using
json 1.8.3 Installing ruby-libvirt 0.6.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
C:/HashiCorp/Vagrant/embedded/bin/ruby.exe -r ./siteconf20160225-6712-1ph8sm p.rb extconf.rb
* 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:/HashiCorp/Vagrant/embedded/bin/$(RUBY_BASE_NAME)
--with-libvirt-include
--without-libvirt-include
--with-libvirt-lib
--without-libvirt-lib
--with-libvirt-config
--without-libvirt-config
--with-pkg-config
--without-pkg-config extconf.rb:73:in `': libvirt library not found in default locations (Runti meError)
extconf failed, exit code 1
Gem files will remain installed in
C:/Users/Z003H1ZT/.vagrant.d/gems/gems/ruby-l ibvirt-0.6.0 for
inspection. Results logged to
C:/Users/Z003H1ZT/.vagrant.d/gems/extensions/x86-mingw32/2.2.0
/ruby-libvirt-0.6.0/gem_make.out Bundler, the underlying system
Vagrant uses to install plugins, reported an error. The error is shown
below. These errors are usually caused by misconfigured plugin
installations or transient network issues. The error from Bundler is:
An error occurred while installing ruby-libvirt (0.6.0), and Bundler
cannot cont inue. Make sure that gem install ruby-libvirt -v '0.6.0'
succeeds before bundling.
Other people having issues installing libvirt plugin on newly updated vagrant here.
As a second approach I tried to install the plugin offline with a downloaded vagrant-libvirt gem file using
vagrant plugin install vagrant-libvirt-0.0.32.gem
But there also appears an error:
Installing the 'vagrant-libvirt-0.0.32.gem' plugin. This can take a
few minutes. ..
C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/rubygems/resolver.rb:439:in
resolv e_for_zero': Unable to resolve dependency: 'vagrant-libvirt (=
0.0.32)' requires 'fog-libvirt (~> 0.0.1)' (Gem::UnsatisfiableDependencyError)
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/rubygems/resolver.rb:3
50:inresolve_for'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/rubygems/resolver.rb:1
96:in resolve'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/rubygems/request_set.r
b:358:inresolve'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/rubygems/dependency_in
staller.rb:473:in resolve_dependencies'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/rubygems/dependency_in
staller.rb:373:ininstall'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/b
undler.rb:129:in block in install_local'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/b
undler.rb:284:inblock in with_isolated_gem'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/rubygems/user_interact
ion.rb:45:in use_ui'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/b
undler.rb:283:inwith_isolated_gem'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/b
undler.rb:126:in install_local'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/p
lugin/manager.rb:47:ininstall_plugin'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/plugins/comma
nds/plugin/action/install_gem.rb:37:in call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/a
ction/warden.rb:34:incall'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/a
ction/builder.rb:116:in call'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/a
ction/runner.rb:66:inblock in run'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/u
til/busy.rb:19:in busy'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/a
ction/runner.rb:66:inrun'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/plugins/comma
nds/plugin/command/base.rb:14:in action'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/plugins/comma
nds/plugin/command/install.rb:32:inblock in execute'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/plugins/comma
nds/plugin/command/install.rb:31:in each'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/plugins/comma
nds/plugin/command/install.rb:31:inexecute'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/plugins/comma
nds/plugin/command/root.rb:56:in execute'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/c
li.rb:42:inexecute'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/e
nvironment.rb:302:in cli'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/bin/vagrant:1
74:in'
Are there some suggestion what I am doing wrong or a different approach?

Related

How to install Nokogiri on Manjaro

I installed, and reinstalled, Nokogiri multiple times, with and without sudo, and when running bundle install I get in my console:
Fetching nokogiri 1.10.7
Installing nokogiri 1.10.7 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/april/.rvm/gems/ruby-2.5.0/gems/nokogiri-1.10.7/ext/nokogiri
/home/april/.rvm/rubies/ruby-2.5.0/bin/ruby -I /home/april/.rvm/rubies/ruby-2.5.0/lib/ruby/site_ruby/2.5.0 -r
./siteconf20200331-50466-133fhom.rb extconf.rb
checking if the C compiler accepts ... *** 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=/home/april/.rvm/rubies/ruby-2.5.0/bin/$(RUBY_BASE_NAME)
--help
--clean
/home/april/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/mkmf.rb:456:in `try_do': The compiler failed to generate an
executable file. (RuntimeError)
You have to install development tools first.
from /home/april/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/mkmf.rb:574:in `block in try_compile'
from /home/april/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/mkmf.rb:521:in `with_werror'
from /home/april/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/mkmf.rb:574:in `try_compile'
from extconf.rb:138:in `nokogiri_try_compile'
from extconf.rb:162:in `block in add_cflags'
from /home/april/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/mkmf.rb:632:in `with_cflags'
from extconf.rb:161:in `add_cflags'
from extconf.rb:416:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/april/.rvm/gems/ruby-2.5.0/extensions/x86_64-linux/2.5.0/nokogiri-1.10.7/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/april/.rvm/gems/ruby-2.5.0/gems/nokogiri-1.10.7 for inspection.
Results logged to /home/april/.rvm/gems/ruby-2.5.0/extensions/x86_64-linux/2.5.0/nokogiri-1.10.7/gem_make.out
An error occurred while installing nokogiri (1.10.7), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.10.7'` succeeds before bundling.
In Gemfile:
activeadmin_addons was resolved to 1.6.0, which depends on
xdan-datetimepicker-rails was resolved to 2.5.4, which depends on
rails was resolved to 5.1.5, which depends on
actioncable was resolved to 5.1.5, which depends on
actionpack was resolved to 5.1.5, which depends on
actionview was resolved to 5.1.5, which depends on
rails-dom-testing was resolved to 2.0.3, which depends on
nokogiri
I also tried re-installing libxml2 and libxslt and I still keep running into this issue.

Trouble with gem installations

I am in a coding bootcamp and I have encountered an error in which I am having a hard time fixing. I currently in an exercise where I am learning how to create dynamic routes. Every time I run my server I am getting errors when I go to my routes and it states that:
Could not find nokogiri-1.8.2 in any of the sources
Run `bundle install` to install missing gems.
I tried to bundle install after adding nokogiri to my gemfile but all I get is this error below. I need some help cause I don't know what is going on and I am a total noob in regards to this stuff.
Ignoring unf_ext-0.0.7.5 because its extensions are not built. Try: gem pristine unf_ext --version 0.0.7.5
Ignoring websocket-driver-0.7.0 because its extensions are not built. Try: gem pristine websocket-driver --version 0.7.0
Fetching gem metadata from http://rubygems.org/........
Using rake 12.3.0
Using concurrent-ruby 1.0.5
Using i18n 0.9.5
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 5.1.5
Using activemodel 5.1.5
Using arel 8.0.0
Using activerecord 5.1.5
Using public_suffix 3.0.2
Using addressable 2.5.2
Using bundler 1.16.6
Using mini_mime 1.0.0
Using mini_portile2 2.3.0
Fetching nokogiri 1.8.2
Installing nokogiri 1.8.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/Users/kenkuts/.rvm/gems/ruby-2.5.0/gems/nokogiri-1.8.2/ext/nokogiri
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r
./siteconf20181215-54662-1izm05e.rb extconf.rb --use-system-libraries
Ignoring unf_ext-0.0.7.5 because its extensions are not built. Try: gem pristine
unf_ext --version 0.0.7.5
Ignoring websocket-driver-0.7.0 because its extensions are not built. Try: gem
pristine websocket-driver --version 0.7.0
checking if the C compiler accepts ... *** 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=/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/$(RUBY_BASE_NAME)
--help
--clean
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:456:in
`try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:571:in
`block in try_compile'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:522:in
`with_werror'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:571:in
`try_compile'
from extconf.rb:138:in `nokogiri_try_compile'
from extconf.rb:162:in `block in add_cflags'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:629:in
`with_cflags'
from extconf.rb:161:in `add_cflags'
from extconf.rb:410:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can
be found here:
/Users/kenkuts/.rvm/gems/ruby-2.5.0/extensions/universal-darwin-18/2.3.0/nokogiri-1.8.2/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in
/Users/kenkuts/.rvm/gems/ruby-2.5.0/gems/nokogiri-1.8.2 for inspection.
Results logged to
/Users/kenkuts/.rvm/gems/ruby-2.5.0/extensions/universal-darwin-18/2.3.0/nokogiri-1.8.2/gem_make.out
An error occurred while installing nokogiri (1.8.2), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.8.2' --source 'http://rubygems.org/'`
succeeds before bundling.
In Gemfile:
capybara was resolved to 2.18.0, which depends on
xpath was resolved to 3.0.0, which depends on
nokogiri
You may need to download Xcode from the App Store, and run the commands
xcode-select --install
sudo xcodebuild -license`
The nokogiri install instructions mention this:
https://www.nokogiri.org/tutorials/installing_nokogiri.html#install_with_included_libraries__recommended_
This isn't an "answer" as much as a set of (hopefully) helpful things too long for a comment.
Sandbox your gems
I always run bundler in the following way now, so that one project's dependencies have no impact on the gems I use system wide or on other projects:
bundle install --binstubs --path=vendor.noindex
That will put all executables in PROJECT_DIR/bin and all gems in PROJECT_DIR/vendor.noindex. The "noindex" bit stops Spotlight from indexing the gems. To run rspec would now be:
bin/rspec
To start from a clean slate I run:
rm -rf .bundle bin Gemfile.lock vendor.noindex
Note: Always be careful using an rm -rf!!!!
Installing and finding dependencies
The last time I installed Nokogiri using the gem install command it looked like this:
gem install nokogiri -- \
--use-system-libraries \
--with-xml2-include=/opt/pkg/include/libxml2 \
--with-xml2-lib=/opt/pkg/lib \
--with-xslt-include=/opt/pkg/include/libxslt \
--with-xslt-lib=/opt/pkg/lib
As other commenters have noticed, this shows that you need XCode installed (always worth checking for updates) and that I've used libraries installed by another package manager (I've used pkgrsc above though you could use Macports or Homebrew and maybe some others).
To find the libs you need to link to try running:
find `/usr` -name libxml2 -type d 2> >(grep -v 'Permission denied' >&2)
Or change the /usr to /opt if you're installing there via pkgsrc/Macports/Fink etc. You may need to put a sudo in front depending on the permissions.
There's also the locate command, e.g.
locate libxml2
Which will bring up lots of stuff.

Your Gemfile.lock is corrupt. The following gems are missing from the DEPENDENCIES section:

I am installing one app and I was in this step that I should run bundle install and I get this error
enter code here➜ mavatar git:(master) ✗ bundle install
Fetching gem metadata from http://rubygems.org/
Fetching version metadata from http://rubygems.org/
Fetching dependency metadata from http://rubygems.org/
Using rake 0.9.2
Using multi_json 1.8.2
Using bcrypt-ruby 3.0.1
Using builder 3.0.4
Using i18n 0.6.5
Using erubis 2.7.0
Using rack 1.3.6
Using hike 1.2.1
Using tilt 1.3.3
Installing nokogiri 1.5.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/farbodi/.rvm/gems/ruby-2.3.0-
dev/gems/nokogiri-1.5.0/ext/nokogiri
/home/farbodi/.rvm/rubies/ruby-2.3.0-dev/bin/ruby -r
./siteconf20160806-31805-mdcnrl.rb extconf.rb
*** 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=/home/farbodi/.rvm/rubies/ruby-2.3.0-dev/bin/$(RUBY_BASE_NAME)
extconf.rb:10:in `<main>': uninitialized constant Config (NameError)
Did you mean? RbConfig
CONFIG
extconf failed, exit code 1
Gem files will remain installed in /home/farbodi/.rvm/gems/ruby-
2.3.0-dev/gems/nokogiri-1.5.0 for inspection.
Results logged to /home/farbodi/.rvm/gems/ruby-2.3.0-
dev/extensions/x86_64-linux/2.3.0/nokogiri-1.5.0/gem_make.out
Your Gemfile.lock is corrupt. The following gems are missing from the
DEPENDENCIES section: 'archive-tar-minitar' 'hoe' 'rcov'
So I tried to run this : gem update
gem install hoe
gem install rcov
gem install archive-tar-minitar
gem install nokogiri -v 1.5.0 which gives me ERROR: Failed to build gem native extension. error
I also installed bundle older version, I can pass this step but I get same problem in somewhere else.
I also used rvm and my ruby version is ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux] , And Bundler version 1.12.5
I am new to ruby and gem and bundle I am all confused and I don't know how to start to learn what is going on and how to solve the errors.
You need to install some system packages.
If you are using redhat based, install libxml2 and libxslt and zlib-devel
and if you are using debian based, install zlib1g-dev and liblzma-dev packages

Getting error when installing gem 'frank-cucumber' with ruby 1.9.2

Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/..
Using i18n (0.6.1)
Using multi_json (1.7.2)
Using activesupport (3.2.13)
Using builder (3.2.0)
Using colored (1.2)
Using diff-lcs (1.2.1)
Using json (1.7.7)
Using gherkin (2.11.6)
Using cucumber (1.2.3)
Installing dnssd (2.0) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/home/ramkishan/.rvm/rubies/ruby-1.9.2-p318/bin/ruby extconf.rb
checking for dns_sd.h... no
unable to find dnssd header
*** 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
--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=/home/ramkishan/.rvm/rubies/ruby-1.9.2-p318/bin/ruby
--with-warnings
--without-warnings
--with-dnssd-dir
--without-dnssd-dir
--with-dnssd-include
--without-dnssd-include=${dnssd-dir}/include
--with-dnssd-lib
--without-dnssd-lib=${dnssd-dir}/lib
Gem files will remain installed in /home/ramkishan/.rvm/gems/ruby-1.9.2-p318#andriod/gems/dnssd-2.0 for inspection.
Results logged to /home/ramkishan/.rvm/gems/ruby-1.9.2-p318#andriod/gems/dnssd-2.0/ext/dnssd/gem_make.out
An error occurred while installing dnssd (2.0), and Bundler cannot continue.
Make sure that `gem install dnssd -v '2.0'` succeeds before bundling.
I have installed gem install dnssd -v '2.0' but problem is remain same. Help me how to resolve it.
The dnssd gem relies on your operating system having a library for dnssd.
Assuming you're not using OS X, which I think has this library built-in, you should install libavahi-compat-libdnssd-dev.
On Ubuntu, it's sudo apt-get install libavahi-compat-libdnssd-dev
I'm guessing you're not on OSX. If you're on Ubuntu, you can run
$> sudo apt-get install libavahi-compat-libdnssd-dev
to install the missing libraries.

Ruby gem mysql2 install error

I have the Ruby version ruby 1.9.2p0 (2010-08-18) [i386-mingw32] installed in Windows7.
and the gem vesion 1.3.7
When i tried to install mysql gem, it is showing Failed to build gem native extension error, why is this? my mysql version is 5.1.36(WampServer)
E:\RubyApps\test_app2>gem install mysql2
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
E:/Ruby192/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=E:/Ruby192/bin/ruby
E:/Ruby192/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The complier failed to genera
te an executable file. (RuntimeError)
You have to install development tools first.
from E:/Ruby192/lib/ruby/1.9.1/mkmf.rb:435:in `try_link0'
from E:/Ruby192/lib/ruby/1.9.1/mkmf.rb:440:in `try_link'
from E:/Ruby192/lib/ruby/1.9.1/mkmf.rb:552:in `try_func'
from E:/Ruby192/lib/ruby/1.9.1/mkmf.rb:797:in `block in have_func'
from E:/Ruby192/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking_for'
from E:/Ruby192/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) in postp
one'
from E:/Ruby192/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from E:/Ruby192/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone'
from E:/Ruby192/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from E:/Ruby192/lib/ruby/1.9.1/mkmf.rb:276:in `postpone'
from E:/Ruby192/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for'
from E:/Ruby192/lib/ruby/1.9.1/mkmf.rb:796:in `have_func'
from extconf.rb:9:in `<main>'
Gem files will remain installed in E:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql2-0.
2.3 for inspection.
Results logged to E:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql2-0.2.3/ext/mysql2/ge
m_make.out
E:\RubyApps\test_app2>
If you are having this same problem in Linux, basically you just need to install a few libraries first. This worked for me.
> sudo apt-get install libmysql-ruby libmysqlclient-dev
> gem install mysql
source: http://heatware.net/ruby-rails/solved-installing-mysql-gem-extconf-rb-failed-error/
Since this keeps coming up on google as on of the top results, I should point out that this answers is from almost 2 years ago. Here is a more updated answer: How to use "mysql2" gem in Rails 3 application on Windows 7?
According to the developer there is a already a reported bug for it and he is working on parting mysql2 over to Windows. As of now - it's still in the works. Use the older mysql driver for now - or use sqlite for local development.
This is from the googlegroups discussion
Blockquote
Hey Erwann,
There's a ticket on the mysql2 issue tracker for Win32 support already
at http://github.com/brianmario/mysql2/issues#issue/8 . You can follow
it for progress; I'm doing my best to get things working smoothly for
you guys. Hang tight! :)
Just for the record: The problem should be solved!
The mysql2 gem v.0.2.6 is out, having win32 support.
gem install mysql2 worked without problems now.
See: http://github.com/brianmario/mysql2/issues/issue/8#issue/8/comment/479748
it works,
c:> gem install mysql2 -- '--with-mysql-lib="C:\Prog
ram Files\MySQL\MySQL Connector C 6.0.2\lib\opt" --with-mysql-include="C:\Progra
m Files\MySQL\MySQL Connector C 6.0.2\include"'
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed mysql2-0.3.6
1 gem installed
Installing ri documentation for mysql2-0.3.6...
Enclosing class/module 'mMysql2' for class Client not known
Installing RDoc documentation for mysql2-0.3.6...
Enclosing class/module 'mMysql2' for class Client not known
Note:
I. If there is no lib and include directory in your mysql then install mysql connector c
II. First install DevKit then only you can install mysql2 plugin in windows
https://github.com/oneclick/rubyinstaller/wiki/Development-Kit
You can try
gem install mysql2 -v '0.0.00' -- --with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include
Have you installed the DevKit correctly? If doubt, cross check the steps of installation on -
http://rorguide.blogspot.com/2011/03/installing-mysql2-gem-on-ruby-192-and.html
I was able to install mysql2 gem after following these steps.
Under Cygwin, I had to be sure to install not just libmysqlclient18, but also libmysqlclient-devel. Then "gem install mysql2" went fine.
There is also, of course, a ruby-mysql2 package in Cygwin.
key: the line that says You have to install development tools first.
ref: devkit
use
gem install mysql
for windows, till mysql2 get it right.

Resources