ruby - 无法在 OS X 10.6 Snow Leopard 服务器上安装 mysql gem

标签 ruby osx-snow-leopard osx-server ruby-on-rails-4

在 OS X Server 10.6 上安装 mysql ruby​​ gem 时遇到问题。

这是我遇到的错误:

macserver:~ admin$ sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-       config=/usr/bin/mysql_config

Building native extensions. This could take a while…

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

/Users/admin/.rvm/rubies/ruby-1.8.7-p371/bin/ruby extconf.rb --with-mysql-config=/usr/bin/mysql_config

checking for mysql_ssl_set()… yes
checking for rb_str_set_len()… yes
checking for rb_thread_start_timer()… yes
checking for mysql.h… no
checking for mysql/mysql.h… 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.

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=/Users/admin/.rvm/rubies/ruby-1.8.7-p371/bin/ruby
--with-mysql-config

Gem files will remain installed in /Users/admin/.rvm/gems/ruby-1.8.7-p371/gems/mysql-2.9.1 for inspection.
Results logged to /Users/admin/.rvm/gems/ruby-1.8.7-p371/gems/mysql-2.9.1/ext/mysql_api/gem_make.out

感谢任何帮助。

最佳答案

您需要安装 MySQL 的开发头文件。 Oracle 的默认二进制包不包括这些。

如果您使用的是 Homebrew 或 MacPorts,它们都可以提供所需的文件。

关于ruby - 无法在 OS X 10.6 Snow Leopard 服务器上安装 mysql gem,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15302193/

相关文章:

ruby - 将数组转换为哈希键

ruby - 枚举器中的当前对象

Ruby:在模块内调用 gem 子类会产生未初始化的常量

macos - Mac OS X : Keyboard shortcut for moving active window to another screen

xcode - 无法确定 xxxTest TEST_HOST 的包标识符

arrays - 如何初始化三维 ruby​​ 数组

python - easy_install 在 Mac 上损坏

java - 从 OS X GUI 启动 jar 时如何设置 java 标志?

osx-server - Xcode 机器人设置当前集成号

ios - 尝试将机器人添加到 xcode 服务器 : "This server cannot build for any platform" 时出错