简体   繁体   中英

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

I followed the " http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/ " for setting the connection between Ruby on rails app and mysql server 5.1

So when I install the mysql gem with the following command:

gem install mysql --platform=ruby -- --with-mysql-dir=C:/mysql-connector-c-noinstall-6.0.2-win32

So I'm getting the following error log:

Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.

  C:/Ruby187/bin/ruby.exe extconf.rb --with-mysql-dir=C:/mysql-connector-c 

-noinstall-6.0.2-win32 checking for main() in -llibmysql... no * 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:/Ruby187/bin/ruby
--with-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
--with-libmysqllib
--without-libmysqllib

Gem files will remain installed in C:/Ruby187/lib/ruby/gems/1.8/gems/mysql-2.9.1 for inspection. Results logged to C:/Ruby187/lib/ruby/gems/1.8/gems/mysql-2.9.1/ext/mysql_api/ge m_make.out

Extra Info: Ruby version 1.8.7 Windows 7 64 bit Mysql version 5.1

  1. Download the mysql/C connector Zip file.

  2. UnZip that to the specific folder say C: drive .

  3. Copy the libmySQL.dll from mysql/C connector Zip file.

  4. try this command gem install mysql --platform=ruby -- --with- mysql-lib=C:\\mysql-C-connector\\lib --with- mysql-include=c:\\mysql-C-connector\\include

Please install Devkit first
https://github.com/oneclick/rubyinstaller/wiki/development-kit
http://rubyinstaller.org/downloads/

Follow instructions from github repo and it will work fine.

使用railsinstaller安装导轨会更容易。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM