The following error extconf. rb: 2: in 'require is prompted when installing mysql2 using gem.
The following error extconf. rb: 2: in 'require is prompted when installing mysql2 using gem.
1. When installing mysql2 using gem, the following error extconf. rb: 2: in 'require ': no such file to load -- mkmf (LoadError) from extconf. rb: 2 is prompted.
Building native extensions. This cocould take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/Usr/bin/ruby1.8 extconf. rb
Extconf. rb: 2: in 'require ': no such file to load -- mkmf (LoadError)
From extconf. rb: 2
Cause: mkmf is missing. mkmf. rb is part of the ruby1.8-dev package.
Solution: sudo apt-get install ruby1.8-dev
2. WARNING: This version of mysql2 (0.3.2) doesn't ship with the ActiveRecord adapter bundled anymore as it's now part of Rails 3.1
WARNING: Please use the 0.2.x releases if you plan on using it in Rails <= 3.0.x
Cause: the rails version is earlier than 3.1, and mysql2 is later than 0.3, resulting in version incompatibility;
Solution: In Gemfile, reduce the version of mysql2 to 'mysql2', '<0.3', or install an exact version using the gem install mysql2-v 0.2.7, set mysql2 to this version in gemfile, or upgrade rails to version 3.1 or later. This method is not verified.
3. Installing mysql2 (0.3.6) D:/develop/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/defaults/operating_system.rb: 9: in 'block in
Op (required)> ': The 'mysql2' native gem requires installed build tools. (Gem: InstallError)
Cause: Unable to install mysql2 because devkit is missing;
Solution: Go to 'HTTP: // rubyinstaller.org/downloads to download the devkit, install the test according to the instructions, and then execute.
4. Install mysql2 and report ERROR: Failed to build gem native extension. The details are as follows:
Building native extensions. This cocould take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
Google found that many people can install mysql's own parameters during installation ,, for example, include -- with-mysql-lib =$ {mysqlLibPath} Or -- with-mysql-dir =$ {mysqlDir} Or -- with-mysql-config =$ {mysqlConfigPath }. I have tried the same thing before. Finally, I installed a mysql Development Kit libmysqlclient-dev from apt to install mysql successfully on gem.