我尝试安装rails时遇到此错误

时间:2014-03-24 05:28:59

标签: ruby-on-rails ruby macos ruby-on-rails-4 osx-mavericks

我试图安装Rails并且我得到了这个错误.....我怎么能解决这个问题我已经尝试安装一个星期了,我似乎无法让它为我的死。

/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

2 个答案:

答案 0 :(得分:0)

在终端中,运行命令:

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

然后尝试在同一个终端上安装,这应该告诉编译器将错误视为警告继续编译......

否则,您可以尝试使用rvm和最新版本的ruby安装rails:

#Install rvm
\curl -sSL https://get.rvm.io | bash -s stable

#Install last version of ruby: 
rvm install ruby-2.0.0

#Install rails
gem install rails 

答案 1 :(得分:0)

我的问题是我试图将rails安装到系统ruby中,我猜这是一个问题。感谢@rorra我发现我需要或者需要一个版本管理器(RVM或rbenv),因此这些错误在命中时不会持续存在。所以我采取的步骤:

# Ran this on my command line like @rorra told me to (because of my earlier error)
export ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future

# Installed Homebrew
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

# Installed ruby-build 
brew install ruby-build

# Add the your .bash_profile this line (this is to let rbenv know it has to initialize itself everytime you open a terminal shell)
eval "$(rbenv init -)"

# Install Ruby Using rbenv
rbenv install ***(version of ruby you need)***

# Use this to rehash the Version manager:
rbenv rehash

# Set the ruby version you want to use or the recently installed one
rbenv global ***(version number installed)***

# Install the gem *Bundler* then rehash by following **step 6**
gem install bundler

# Install rails 
gem install rail --no-ri --no-rdoc

那就是我的问题如何得到解决我希望我能够帮助其他人遇到同样的问题......