5

I have installed a new rails project like so:

$ rails new site

and it executes and reaches:

bundle install

but then I get this error, when it appears to try installing a dependency

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb 
checking for libkern/OSAtomic.h... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling atomic_reference.c
atomic_reference.c:57:59: warning: incompatible pointer types passing 'void **' to      parameter of type 'volatile int64_t *' (aka 'volatile long long *') [-Wincompatible-pointer-types]
if (OSAtomicCompareAndSwap64(expect_value, new_value, &DATA_PTR(self))) {
                                                      ^~~~~~~~~~~~~~~
/usr/include/libkern/OSAtomic.h:507:93: note: passing argument to parameter '__theValue'   here
bool    OSAtomicCompareAndSwap64( int64_t __oldValue, int64_t __newValue, volatile int64_t   *__theValue );
                                                                                        ^
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

make failed, exit code 2

Gem files will remain installed in /Users/mikeguppy/.bundler/tmp/26234/gems/atomic-1.1.16 for inspection.
Results logged to /Users/mikeguppy/.bundler/tmp/26234/extensions/universal-darwin-13/2.0.0/atomic-1.1.16/gem_make.out
An error occurred while installing atomic (1.1.16), and Bundler cannot continue.
Make sure that `gem install atomic -v '1.1.16'` succeeds before bundling.

I have then tried installing atomic independently with:

gem install atomic

and again no luck.

I'm running Ruby 2.0 on Mac OS 10.9.2


Any help would be much appreciated!

moreguppy
  • 51
  • 1
  • 4
  • What's your rails version? `rails -v` – Leonel Galán Mar 17 '14 at 17:33
  • @Leito I followed the answer below and uninstalled atomic. Now I don't have rails :/ so no -v im afraid – moreguppy Mar 17 '14 at 17:40
  • @Leito and now I can't install rails – moreguppy Mar 17 '14 at 17:41
  • I'm sure the problem is now different. You need to provide more information (don't just say "doesn't work"/"i can't") in order for us to help. Chatting in the comments is discouraged, so either post a new issue regarding installing rails or create a chat room where we could discuss further. – Leonel Galán Mar 17 '14 at 17:47
  • possible duplicate of [Ruby Gem install Json fails on Mavericks and Xcode 5.1 - unknown argument: '-multiply\_definedsuppress'](http://stackoverflow.com/questions/22352838/ruby-gem-install-json-fails-on-mavericks-and-xcode-5-1-unknown-argument-mul) – Nakilon Apr 20 '14 at 01:31

9 Answers9

4

this worked for me: sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install rails

ThomasW
  • 16,981
  • 4
  • 79
  • 106
Hermann
  • 41
  • 5
2

I had this same problem and what worked for me was installing RVM, installing Ruby 2.1.1 (an upgrade from the 2.0 that comes packaged in Mavericks)...

rvm get stable
rvm reinstall 2.1.1

(use whatever the latest version is, for me that's 2.1.1)

...and then run rvm use 2.1.1 to make sure that I had switched to using that version.

After that, my gem installs ran smoothly.

Dylan
  • 1,026
  • 1
  • 10
  • 20
1

This appears to be an issue relating to the system Ruby that is packaged with Mavericks (2.0.0p247), see details about the bug here: https://bugs.ruby-lang.org/issues/9624

I got around this by installing rbenv (or RVM if you prefer) and then installing Ruby 2.1.1 so as not to tamper with the system Ruby version. You will still get a warning during the installation of the atomic gem but it won't fail at least.

rbenv here: https://github.com/sstephenson/rbenv

jwswart
  • 1,226
  • 14
  • 16
  • 1
    Oh just to be clear it's not only the Ruby version with Mavericks, it's the combination of that version and Xcode 5.1 update. The newer Ruby 2.1.x just doesn't use the illegal command line options. – jwswart Mar 18 '14 at 21:17
  • Neckbeard rubyists might want to check out https://github.com/postmodern/chruby + https://github.com/postmodern/ruby-install –  Mar 21 '14 at 02:32
1

I had the same problem when installed rails. My ruby version is 1.9.3 p448 and OS is OS X Mavericks (10.9.2).

Here's what I tried and it works.

$ gem install rails --version 4.0.4

[ref] http://ruby.railstutorial.org/chapters/beginning#top

ohyes
  • 3,210
  • 3
  • 20
  • 24
0

First uninstall any existing atomic gem

gem uninstall atomic

Then reinstall it using

gem install atomic -v '1.1.16'

After this try to create a new rails application

rails new projectname

I don't know which version of Rails you are currently using. Sometimes, re-installing Rails to a stable version seems to help. You may want to try that as well if the above steps didn't resolve the issue.

Kirti Thorat
  • 52,578
  • 9
  • 101
  • 108
0

I had a similar problem recently and it was because Xcode updated automatically to 5.1. This version contains a bug/problem with gcc.

The clue is here:

-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning)

Sadly I had to downgrade Xcode - available here.

homerjam
  • 659
  • 7
  • 17
0

Ruby 2.1.5 on Maverick via rvm installed atomic 1.1.16 without issue.

Martin Streicher
  • 1,983
  • 1
  • 18
  • 18
0

This error can occur if you are bundling with the wrong version of ruby for the bundle. Check the Gemfile for the ruby version and then check the output of ruby -v. If there is a version mismatch, use rvm to make sure you are using the same version of ruby, then re-bundle.

I got this exact error and fixed it by changing the version of ruby I was using.

quetzaluz
  • 1,071
  • 12
  • 17
0

None of these worked for me. I came up with my own solution. The problem lies in json versions less than 2.0. When I tried to upgrade json, I got an error message about dependency issues with rails and sdoc. Here's what I ended up doing:

  1. Open your Gemfile.
  2. Comment out the lines for sdoc and rails.
  3. Add this line: gem 'json', '> 2'
  4. Run bundle install.

Worked for me.

omikes
  • 8,064
  • 8
  • 37
  • 50