我浏览过很多网站,但没有一个对其他人有效的网站似乎对我也有效。
C:/Users/Holly/Desktop/Brolie>gem install mysql2 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:/Ruby200-x64/bin/ruby.exe extconf.rb 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
*** 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-x64/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}/ extconf.rb:37:in `<main>': undefined method `[]' for nil:NilClass (NoMethodError )
Gem files will remain installed in
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql 2-0.3.13 for inspection.
Results logged to
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.13/ext/mysq
l2/gem_make.out
我的 DevKit 是正确的下载。我尝试添加连接器,但没有任何作用。通过类进行逐步安装,所以我知道我正在按正确的顺序执行操作,但没有任何方法可以帮助解决此错误。
最佳答案
这实际上看起来像是 extconf.rb:37
上的错误,而不是缺少依赖项或某些编译问题。
假设您三次检查您的 ruby 版本是否受此版本的 gem 支持,并且您使用的是您的 ruby 版本支持的最新版本,我建议 open an issue on github .
关于mysql - gem安装mysql2 windows native 扩展等问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18665502/