我看到其他人也有类似的问题,但没有一个解决方案对我有用。 0.3.14 gem存在于其他gem文件中。我完全按照此处的说明完成了所有事情:https://github.com/brianmario/mysql2。我仍然得到以下内容。我不知道为什么安装程序指示它找不到包含目录,因为我已经检查过并且它存在。 thread.h文件存在,但不存在于ruby目录中。而是它在这里:C:\ RailsInstaller \ DevKit \ lib \ perl5 \ 5.8 \ msys \ CORE \
我正在运行Windows 7并尝试在Aptana 3中构建我的rails项目。我的Ruby是1.9.3。
$ gem install mysql2 -v 0.3.14 -- --with-mysql-dir=C:\MySQL-Connector-C-6.1
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:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb --with-mysql-dir=C:MySQL-Connector-C-6.1
checking for ruby/thread.h... no
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
-----
Cannot find include dir at C:MySQL-Connector-C-6.1/include
-----
*** 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:/RailsInstaller/Ruby1.9.3/bin/ruby
--with-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
Gem files will remain installed in c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.14 for inspection.
Results logged to c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.14/ext/mysql2/gem_make.out
还试过这个:
$ gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:\MySQL-Connector-C-6.1\lib" --with-mysql-include="C:\MySQL-Connector-C-6.1
\include" --with-mysql-dir="C:\MySQL-Connector-C-6.1"'
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:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb --with-mysql-lib="C:\MySQL-Connector-C-6.1\lib" --with-mysql-include="C:\MyS
QL-Connector-C-6.1\include" --with-mysql-dir="C:\MySQL-Connector-C-6.1"
checking for ruby/thread.h... no
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
-----
Cannot find include dir at C:\MySQL-Connector-C-6.1\include;C:\MySQL-Connector-C-6.1\include;C:\MySQL-Connector-C-6.1/include
-----
*** 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 files will remain installed in c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.14 for inspection.
Results logged to c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.14/ext/mysql2/gem_make.out
另一种建议配置:
$ gem install mysql2 -v 0.3.14 -- '--with-mysql-config="C:\wamp\bin\mysql\mysql5.5.24\bin"'
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:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb --with-mysql-config="C:\wamp\bin\mysql\mysql5.5.24\bin"
checking for ruby/thread.h... no
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
-----
Using mysql_config at C:\wamp\bin\mysql\mysql5.5.24\bin
-----
*** 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.
extconf.rb:55:in ``': Permission denied - C:\wamp\bin\mysql\mysql5.5.24\bin --version (Errno::EACCES)
from extconf.rb:55:in `<main>'
Gem files will remain installed in c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.14 for inspection.
Results logged to c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.14/ext/mysql2/gem_make.out
为了清楚起见,我在此处删除了冗余配置选项。请注意,此尝试生成了权限被拒绝错误。
答案 0 :(得分:10)
我发现了问题!这就是问题所在。说明说将libmysql.dll文件复制到ruby主目录。需要复制的文件不是.dll - 它是libmysql.lib文件(或两者)。我复制了它,它编译得很好。耶!
$ gem install mysql2 -v 0.3.14 -- '--with-mysql-dir="C:\MySQL-Connector-C-6.1"'
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed mysql2-0.3.14
1 gem installed
Installing ri documentation for mysql2-0.3.14...
Installing RDoc documentation for mysql2-0.3.14...