【问题标题】:I get this error while I try to install rails尝试安装 rails 时出现此错误
【发布时间】:2014-05-01 08:32:34
【问题描述】:

我正在尝试安装 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

【问题讨论】:

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


【解决方案1】:

在您的终端中,运行以下命令:

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 

【讨论】:

  • 我可以用 rbenv 代替 rvm 吗?还是你推荐 RVM 比 rbenv 更好?
  • 很高兴您能够安装 Rails,玩得开心,欢迎来到敏捷 Web 开发世界 :)
【解决方案2】:

我的问题是我试图将 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

这就是我的问题得到解决的方法,我希望我能够帮助遇到同样问题的其他人......

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-18
    • 2015-05-04
    • 2018-12-16
    • 2021-08-25
    • 1970-01-01
    • 1970-01-01
    • 2023-01-03
    • 2021-09-12
    相关资源
    最近更新 更多