无法在 OS X 上安装 mysql gem

Can#39;t install mysql gem on OS X(无法在 OS X 上安装 mysql gem)

本文介绍了无法在 OS X 上安装 mysql gem的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在做一个

sudo gem 安装 mysql

sudo gem install mysql

在 OS X 上安装 mysql gem.这失败了,输出如下:

on OS X to install the mysql gem. This fails with the following output:

构建原生扩展.这可能需要一段时间...

Building native extensions. This could take a while...

错误:安装 mysql 时出错:

ERROR: Error installing mysql:

错误:构建 gem 原生扩展失败.

ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb

正在检查 mysql_ssl_set()...是的

checking for mysql_ssl_set()... yes

正在检查 rb_str_set_len()...是的

checking for rb_str_set_len()... yes

正在检查 rb_thread_start_timer()...否

checking for rb_thread_start_timer()... no

正在检查 mysql.h...是的

checking for mysql.h... yes

创建 Makefile

creating Makefile

使DESTDIR="干净

make "DESTDIR=" clean

制作DESTDIR="

make "DESTDIR="

编译mysql.c

链接共享对象mysql/mysql_api.bundle

linking shared-object mysql/mysql_api.bundle

clang:错误:未知参数:'-multiply_definedsuppress' [-Wunused-command-line-> argument-hard-error-in-future]

clang: error: unknown argument: '-multiply_definedsuppress' [-Wunused-command-line-> argument-hard-error-in-future]

clang:注意:这将是未来的硬错误(不能降级为警告)

clang: note: this will be a hard error (cannot be downgraded to a warning) in the future

make: * [mysql_api.bundle] 错误 1

make: * [mysql_api.bundle] Error 1

制作失败,退出代码 2

make failed, exit code 2

Gem 文件将继续安装在/Library/Ruby/Gems/2.0.0/gems/mysql-2.9.1 以供检查.

Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/mysql-2.9.1 for inspection.

结果记录到/Library/Ruby/Gems/2.0.0/extensions/universal-darwin-13/2.0.0/mysql-2.9.1/gem_make.out

Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-13/2.0.0/mysql-2.9.1/gem_make.out

知道是什么原因造成的吗?如果有什么不同的话,我已经用自制软件安装了 mysql.

Any idea what could be causing this? I have mysql installed with homebrew if that makes a difference.

推荐答案

来自 Apple 的 Xcode/Clang 发行说明:

Xcode 5.1 中的 Apple LLVM 编译器将无法识别的命令行选项视为错误.在构建 Python 本机扩展和 Ruby Gems 时已经出现了这个问题,其中当前指定了一些无效的编译器选项.需要更改使用无效编译器选项的项目以删除这些选项.为了帮助缓解这种转变,编译器将暂时接受将错误降级为警告的选项:

The Apple LLVM compiler in Xcode 5.1 treats unrecognized command-line options as errors. This issue has been seen when building both Python native extensions and Ruby Gems, where some invalid compiler options are currently specified. Projects using invalid compiler options will need to be changed to remove those options. To help ?ease that transition, the compiler will temporarily accept an option to downgrade the error to a warning:

-Wno-error=unused-command-line-argument-hard-error-in-future

ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install GemName

这篇关于无法在 OS X 上安装 mysql gem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:无法在 OS X 上安装 mysql gem

基础教程推荐