2013-11-29 3 views
5

Я вижу, что у других была аналогичная проблема, но ни одно из решений не сработало для меня. Хватка 0,144 присутствует в других файлах драгоценных камней. Я сделал все, что указано здесь: https://github.com/brianmario/mysql2. Тем не менее я получаю следующее. Я не знаю, почему установщик указывает, что он не может найти каталог include, как я проверил, и он присутствует. Файл thread.h существует, но не в каталоге ruby. Скорее он здесь: C: \ RailsInstaller \ DevKit \ lib \ perl5 \ 5.8 \ msys \ CORE \Не удается установить mysql2 0.3.14 gem

Я запускаю Windows 7 и пытаюсь создать проект рельсов в Aptana 3. Мой 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

https://github.com/brianmario/mysql2/issues/359#issuecomment-16000721 ​​ –

+0

http://stackoverflow.com/questions/6258693/how-to-install-mysql2-gem-on- windows – fatfrog

+0

Я уже видел этот разговор и пытался, что было предложено. Та же проблема. – user1780242

ответ

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... 
+1

Просто нужно войти, чтобы сказать спасибо! «копирование файла libmysql.dll в домашний каталог ruby» на самом деле является ключевым моментом, хотя мне кажется, что файл .lib не нужен. Пользователям Windows также необходимо обратить внимание на архитектуру соединителя mysql (например, x86 (win32) или x64 (win64)), что также имеет решающее значение для сборки. Моя среда: Windows7, ruby ​​1.9.3, rails 3.2.15, mysql-connector-c-6.0.2-win32 для gem mysql2-0.3.14. К сожалению, win64-версия разъема не работает для меня –