Ruby on Rails安装问题(Windows) [英] Ruby on Rails installation issue (Windows)
本文介绍了Ruby on Rails安装问题(Windows)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我从RuyInstaller安装了Ruby 2.0.0和DevKit.创建新项目时出现错误消息:
I installed Ruby 2.0.0 and DevKit from RuyInstaller. I have an error message when I'm creating new project:
rails new testtest -d mysql
..... a lot of output here ........
Installing mysql2 (0.3.14)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
C:/Ruby200/bin/ruby.exe extconf.rb
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... 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.
我如何安装依赖项以使这个gem没有任何错误?
How can I install dependencies to make this gem without any errors?
推荐答案
You need MySQL 32-bit (or MySQL Connector C) to compile mysql2
gem compiling on Windows (even if you are using a 64-bit version of the OS).
请按照以下步骤操作:
- 下载MySQL Server 32位.zip文件(或者 MySQL Connector C 是也可以)
- 将
libmysql.dll
复制到%RUBY_HOME%\bin
(或直接将MySQL 32位lib
目录添加到PATH) -
使用
--with-mysql-lib
和--with-mysql-include
选项安装mysql2 gem
- Download MySQL Server 32-bit .zip file (Alternatively MySQL Connector C is also fine)
- Copy
libmysql.dll
to%RUBY_HOME%\bin
(or simply add MySQL 32-bitlib
directory to PATH) Install mysql2 gem with
--with-mysql-lib
and--with-mysql-include
options
gem install mysql2 -- '--with-mysql-lib="c:\path\to\32-bit-MySQL-Server\lib\opt" --with-mysql-include="c:\\path\to\32-bit-MySQL-Server\include"'
这篇关于Ruby on Rails安装问题(Windows)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文