Loh*_* MV 16 ruby rubygems ruby-on-rails mysql2
我在安装时收到以下错误消息,如果需要发布更多详细信息,请告诉我.
我按照以下位置的说明操作:https: //github.com/oneclick/rubyinstaller/wiki/Development-Kit
我正在使用ruby 1.9.2p136(2010-12-25)[i386-mingw32].
这是我得到的:
E:\work_desk\trunk>gem install mysql2 -v 0.2.4
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
C:/Ruby192/bin/ruby.exe extconf.rb
checking for rb_thread_blocking_region()... yes
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:/Ruby192/bin/ruby
--with-mysql-dir
--without-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:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql2-0.
2.4 for inspection.
Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql2-0.2.4/ext/mysql2/ge
m_make.out
Run Code Online (Sandbox Code Playgroud)
Lui*_*ena 31
您尝试安装的mysql2 gem的特定版本(0.2.4)不仅缺少Windows的二进制文件,而且在Windows上存在问题.
请安装mysql2 gem而不指明版本:
gem install mysql2
Run Code Online (Sandbox Code Playgroud)
哪个将安装最新版本(我发布此版本时为0.2.6)并且还提供了跳过编译步骤的Windows二进制文件.
如果您仍想强制编译(因为您的MySQL版本与用于生成二进制gem的版本不同,您需要从RubyInstaller网站安装RubyInstaller的DevKit:
http://rubyinstaller.org/downloads
并按照我们的wiki(从下载页面链接)中的DevKit安装说明进行操作
您需要在gem安装过程中提供标头和库的路径,并根据以下说明调整MySQL安装位置:
subst X: "C:\Program Files (x86)\MySQL\MySQL Server 5.1"
gem install mysql2 --platform=ruby -- --with-mysql-dir=X: --with-mysql-lib=X:\lib\opt
subst X: /D
Run Code Online (Sandbox Code Playgroud)
上面的命令用于subst
避免带有空格的路径问题,您应该始终避免这些问题.
希望这可以帮助.
Saw*_*ant 18
在寻找使其工作的方法之后,我终于在命令提示符下安装了以下内容:
gem install mysql2 -v 0.2.6
Run Code Online (Sandbox Code Playgroud)
结果如下:
Fetching: mysql2-0.2.6-x86-mingw32.gem (100%)
Successfully installed mysql2-0.2.6-x86-minw32
1 gem installed
Installing ri documentation for mysql2-0.2.6-x86-mingw32...
Enclosing class/module 'mMysql2' for class Client not known
Installing RDoc documentation for mysql2-0.2.6-x86-mingw32...
Enclosing class/module 'mMysql2' for class Client not known
Run Code Online (Sandbox Code Playgroud)
试试吧.它应该工作.
归档时间: |
|
查看次数: |
28851 次 |
最近记录: |