Question

I see that others have had a similar problem but none of the solutions have worked for me. The 0.3.14 gem is present in with the other gem files. I've done everything exactly as indicated here: https://github.com/brianmario/mysql2. Still I get the following. I don't know why the installer is indicating it can't find the include directory, as I've checked and it's present. The thread.h file exists, but not in the ruby directory. Rather it is here: C:\RailsInstaller\DevKit\lib\perl5\5.8\msys\CORE\

I'm running Windows 7 and trying to build my rails project in Aptana 3. My Ruby is 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

Also tried this:

$ 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

And the alternative suggested configuration:

$ 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

For the sake of clarity, I have removed the redundant configuration options here. Note that this attempt generated a permission denied error.

Était-ce utile?

La solution

I found the problem! Here's the issue. Instructions said to copy the libmysql.dll file to the ruby home directory. The file that needs to be copied is NOT the .dll -- it's the libmysql.lib file (or both). I copied that over and it compiled fine. Yay!

$ 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...
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top