zakihayaメモ

RubyとRailsのことが中心

OS X Marvericksで最新のXCodeを入れてbundle installするとエラーになる

開発用のMacが来たので、リポジトリからソースを取ってきてbundle installをすると、下のようなエラーが発生する。

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

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

make "DESTDIR="
compiling atomic_reference.c
atomic_reference.c:53:9: warning: implicit declaration of function 'OSAtomicCompareAndSwap64' is invalid in C99 [-Wimplicit-function-declaration]
    if (OSAtomicCompareAndSwap64(expect_value, new_value, &DATA_PTR(self))) {
        ^
1 warning generated.
linking shared-object atomic_reference.bundle
clang: error: unknown argument: '-multiply_definedsuppress' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
make: *** [atomic_reference.bundle] Error 1


Gem files will remain installed in /Users/zakihaya/Sites/projectname/vendor/bundle/ruby/2.0.0/gems/atomic-1.1.14 for inspection.
Results logged to /Users/zakihaya/Sites/projectname/vendor/bundle/ruby/2.0.0/gems/atomic-1.1.14/ext/gem_make.out
An error occurred while installing atomic (1.1.14), and Bundler cannot continue.
Make sure that `gem install atomic -v '1.1.14'` succeeds before bundling.

調べていたら、同じような状況に困っている人を発見。

ruby - Can't install mysql gem on OS X - Stack Overflow

これを参考に、

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

でうまくいった。