Rails - gem install mysql doesn't work on cygwin

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-22 00:17:39

问题


I tried to do

gem install mysql

but there is an error. "Could not create Makefile due to some reason..."

How do I fix this? I believe I installed mysql on cygwin. Help!!


回答1:


gem install mysql --platform x86-mingw32 works in cygwin




回答2:


  • First, download the MySQL source code - you'll want the same version as whatever MySQL version you already have running (I'm using 5.1.42, which is the current binary from the MySQL Web site, but select whatever you need here: MySQL Snapshots)
  • Second, find a copy of ttydefaults.h and copy it into your /usr/include/sys - this one is fine: ttydefaults.h. When I say grab it and put it in, I mean literally either use wget or type:

vi /usr/include/sys/ttydefaults.h

and paste it in

  • Third, go into your mysql source directory, and type ./configure --without-server --without-readline. Wait until this finishes.
  • Fourth, go into your mysql/libmysql directory, and type make install.
  • Fifth, go into your mysql/include directory and type:

cp mysqld_error.h /usr/local/include/mysql/

  • Next type:

gem install mysql

  • Finally, go into your source directory for ruby, and make sure all items where you want to connect to "localhost" have "host: 127.0.0.1" instead of leaving the host off. If you leave the host blank, or leave it as local host, you will get a /tmp/mysql.sock error.



回答3:


Unfortunately, you may have to recompile MySQL to obtain the necessary library files.



来源:https://stackoverflow.com/questions/1787677/rails-gem-install-mysql-doesnt-work-on-cygwin

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!