在Windows下安装mysql ruby gem失败,使用ruby 2.0.0 [英] Installing mysql ruby gem in windows fails using ruby 2.0.0
问题描述
使用巧克力我已经安装了ruby和ruby.devkit
cinst ruby
cinst ruby.devkit
然后,我按照 github wiki ,并测试devkit,详细信息见 point 5
gem install json --platform = ruby
ruby -rubygems -erequire'json';把JSON.load('[42]')。检查
这工作正常,所以我认为我的开发工具包安装是正确的。然而,当我尝试像这样安装mysql gem
gem install mysql --platform = ruby - --with-mysql- dir = C:/mysql-connector-c-noinstall-6.0.2-win32
我得到以下错误
这可能需要一段时间...
错误:安装mysql时出错:
错误:无法构建gem原生扩展。
C:/ruby200/bin/ruby.exe extconf.rb --with-mysql-dir = C:/mysql-connector-c-noinstall-6.0.2-win32
检查for main()in -llibmysql ... no
*** extconf.rb失败***
由于某些原因无法创建Makefile,可能缺少必要的
库和/或头。检查mkmf.log文件以获取更多详细信息。您可能
需要配置选项。
提供的配置选项:
--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:/ ruby200 / bin / ruby
--with-mysql-dir
--with-mysql-include
- -without-mysql-include = $ {mysql-dir} / include
--with-mysql-lib = $ {mysql-dir} /
--with-libmysqllib
--without -libmysqllib
Gem文件将保留安装在C:/ruby200/lib/ruby/gems/2.0.0/gems/mysql-2.9.1中进行检查。
记录到C的结果:/ruby200/lib/ruby/gems/2.0.0/gems/mysql-2.9.1/ext/mysql_api/gem_make.out
我的所有路径都是正确的,我是遵循本教程。日志文件对我来说帮助不大,但在这里。
have_library:检查-llibmysql中的main()。 .. -------------------- no
gcc -o conftest.exe -IC:/ruby200/include/ruby-2.0。 0 / i386-mingw32 -IC:/ruby200/include/ruby-2.0.0/ruby/backward -IC:/ruby200/include/ruby-2.0.0 -I。-IC:/ mysql-connector-c-noinstall- 6.0.2-win32 / include -DFD_SETSIZE = 2048 -D_WIN32_WINNT = 0x0501 -D_FILE_OFFSET_BITS = 64 -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-圆括号-Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wclaclaration-after-statement -Wimplicit-function-declaration conftest.c -L。-LC:/ ruby200 / lib -LC:\ mysql-connector-c-noinstall-6.0.2-win32\lib\libmysql.dll -LC:/mysql-connector-c-noinstall-6.0.2-win32/ -L。 - lmsvcrt-ruby200 -lshell32 -lws2_32 -limagehlp -lshlwapi
检查的程序是:
/ * begin * /
1:#includeruby.h
2:
3 :#include< winsock2.h>
4:#include< windows.h>
5:int main(int argc,char ** argv)
6:{
7:return 0;
8:}
/ * end * /
相关问题
-
在Windows上安装mysql-2.9.0 gem失败,原因是缺少libmysql 完全相同的错误,但我已经在做接受的答案,仍然收到错误
这个答案似乎表明,我不应该打算试图建立宝石,只需使用二进制版本 https://stackoverflow.com/a/13613036/799628 ,所以也许我会这样做......
mysql2
gem代替它,它具有足够的功能我需要。 他需要 mysql
gem来安装以下命令:
gem安装mysql --platform = ruby - --with-opt-dir = C:/mysql-connector-c-noinstall-6.0.2-win32
Using chocolately I have installed ruby and ruby.devkit
cinst ruby
cinst ruby.devkit
I then followed the instructions on the github wiki and tested the devkit as so detailed in point 5
gem install json --platform=ruby
ruby -rubygems -e "require 'json'; puts JSON.load('[42]').inspect"
This worked ok so I assume my devkit installation was correct. However when I try to install mysql gem like so
gem install mysql --platform=ruby -- --with-mysql-dir=C:/mysql-connector-c-noinstall-6.0.2-win32
I get the following error
This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
C:/ruby200/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:/ruby200/bin/ruby
--with-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib=${mysql-dir}/
--with-libmysqllib
--without-libmysqllib
Gem files will remain installed in C:/ruby200/lib/ruby/gems/2.0.0/gems/mysql-2.9.1 for inspection.
Results logged to C:/ruby200/lib/ruby/gems/2.0.0/gems/mysql-2.9.1/ext/mysql_api/gem_make.out
I've got all the paths correct and I was following this tutorial. The log file isn't much help to me but here it is.
have_library: checking for main() in -llibmysql... -------------------- no
"gcc -o conftest.exe -IC:/ruby200/include/ruby-2.0.0/i386-mingw32 -IC:/ruby200/include/ruby-2.0.0/ruby/backward -IC:/ruby200/include/ruby-2.0.0 -I. -IC:/mysql-connector-c-noinstall-6.0.2-win32/include -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D_FILE_OFFSET_BITS=64 -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c -L. -LC:/ruby200/lib -LC:\mysql-connector-c-noinstall-6.0.2-win32\lib\libmysql.dll -LC:/mysql-connector-c-noinstall-6.0.2-win32/ -L. -lmsvcrt-ruby200 -lshell32 -lws2_32 -limagehlp -lshlwapi "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: int main(int argc, char **argv)
6: {
7: return 0;
8: }
/* end */
Related questions
Installing mysql-2.9.0 gem on Windows fails due to lack of libmysql Has the exact same error but I'm already doing the accepted answer and still getting the error
this answer seems to suggest that I shouldn't bother trying to build the gem and just use the binary version https://stackoverflow.com/a/13613036/799628 so maybe I'll just do that...
Note: I ended up using the mysql2
gem instead which has enough functionality for what I'm needing.
To get the mysql
gem to work the following command for installation was required
gem install mysql --platform=ruby -- --with-opt-dir=C:/mysql-connector-c-noinstall-6.0.2-win32
这篇关于在Windows下安装mysql ruby gem失败,使用ruby 2.0.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!