简体   繁体   中英

Rails 3.0.3, Ruby 1.8.7 (Cygwin), Windows 7 64-bit, MySQL 5.5. - MySQL gem fails to install

I'm trying to install the MySQL Gem for Ruby on Rails on Windows 7 64-bit. I've installed MySQL Essential 5.1.54 Winx64 from the MySQL website. I've installed Cygwin, which comes with ruby 1.8.7 (2008-08-11 patchlevel 72) [i386-cygwin]. I've installed Rails 3.0.3 from the rails website. When I do 'gem install mysql', it outputs:

Building native extensions.   This could take a while...
ERROR:  Error installing mysql:
        ERROR: Failed to build gem native extension

/usr/bin/ruby.exe extconf.rb
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsnl... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... 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.

I've downloaded the Instant Rails libmySQL.dll and replaced that in my MySQL directory(C:\\Program Files\\MySQL\\MySQL Server 5.1\\bin). I have a /etc/my.cnf that points to using 127.0.0.1 as the mysql host. I can connect to mysql in my cygwin bash shell. I can connect to mysql in a Command Prompt window. I can start rails using SQLite3 as the database. I've tried supplying --with-mysql-dir=C:\\Program Files\\MySQL\\MySQL Server 5.1\\bin to the gem install.

试试--with-mysql-dir = C:\\ Program Files \\ MySQL \\ MySQL Server 5.1,祝您好运!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM