繁体   English   中英

带有xampp + rails + mysql2 gem的OS X Lion

[英]OS X Lion with xampp + rails + mysql2 gem

我一直试图找出如何通过XAMPP安装的MySQL使OS X Lion与rails中的mysql2 gem一起工作。

这是我尝试过的:

  • 安装了XAMPP开发套件
  • 安装了带有端口和brew的mysql5-server。 我现在都卸载了这两个。 因为它不能解决问题。
  • 从DMG文件安装了mysql5社区版。 现在已卸载,因为它不能解决问题。
  • 以tar格式下载了mysql5社区版的32位版本。 提取文件夹到'/ var / mysql'

这是我正在尝试尝试安装的命令:

gem install mysql2 -- --with-mysql-dir=/var/mysql --with-mysql-include=
/var/mysql/include --with-mysql-lib=/var/mysql/lib --with-mysql-config=
/Applications/XAMPP/xamppfiles/bin/mysql_config

我很茫然如何使它工作。 我唯一能想到的是,我以某种方式未正确指向目录。 我试过从with-mysql-include,with-mysql-dir和with-mysql-lib配置选项中删除/ include /,/ mysql /和/ lib /。 没有运气。 我尝试将其指向XAMPP安装。 仍然没有运气。

返回的错误是:

ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.

/Users/user/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb --with-mysql-dir=/var/mysql --with-mysql-include=/var/mysql/include --with-mysql-lib=/var/mysql --with-mysql-config=/Applications/XAMPP/xamppfiles/bin/mysql_config
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for mysql.h... no
checking for mysql/mysql.h... no
-----
mysql.h is missing.  please check your installation of mysql and try again.
-----
*** 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
    --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=/Users/user/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
    --with-mysql-config


Gem files will remain installed in /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11 for inspection.
Results logged to /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11/ext/mysql2/gem_make.out

最好不要理会XAMPP提供的东西,而只安装MySQL的新副本,并简化安装mysql2的Gem命令:

brew install mysql
gem install mysql2

由于所有这些,在通过Homebrew安装MySQL之后,您在安装gem时遇到错误:

--with-mysql-dir=/var/mysql --with-mysql-include= \
/var/mysql/include --with-mysql-lib=/var/mysql/lib --with-mysql-config= \
/Applications/XAMPP/xamppfiles/bin/mysql_config

因此,删除它可以解决问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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