gcc-4.6安装ruby gem scrypt时出错

时间:2014-12-26 20:38:07

标签: ruby gcc

我正在尝试安装scrypt gem并继续运行错误,如下所示。

Fetching: ffi-1.9.6.gem (100%)
Building native extensions.  This could take a while...
Successfully installed ffi-1.9.6
Fetching: ffi-compiler-0.1.3.gem (100%)
Successfully installed ffi-compiler-0.1.3
Fetching: scrypt-2.0.0.gem (100%)
ERROR:  Error installing scrypt:
    ERROR: Failed to build gem native extension.

Building native extensions.  This could take a while...
    /Users/CHENGLC/.rvm/rubies/ruby-1.9.3-p551/bin/ruby -rubygems /Users/CHENGLC/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/bin/rake RUBYARCHDIR=/Users/CHENGLC/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/gems/1.9.1/extensions/x86_64-darwin-13/1.9.1/scrypt-2.0.0 RUBYLIBDIR=/Users/CHENGLC/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/gems/1.9.1/extensions/x86_64-darwin-13/1.9.1/scrypt-2.0.0
mkdir -p x86_64-darwin

/usr/local/opt/gcc46/bin/gcc-4.6 -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -Wall -msse -msse2 -arch x86_64 -arch i386  -o x86_64-darwin/crypto_scrypt-sse.o -c ./crypto_scrypt-sse.c


gcc-4.6: error: x86_64: No such file or directory
gcc-4.6: error: i386: No such file or directory
gcc-4.6: error: unrecognized option '-arch'
gcc-4.6: error: unrecognized option '-arch'

rake aborted!
Command failed with status (1): [/usr/local/opt/gcc46/bin/gcc-4.6 -fexcepti...]

Tasks: TOP => default => x86_64-darwin/libscrypt_ext.bundle => x86_64-darwin/crypto_scrypt-sse.o
(See full trace by running task with --trace)

rake failed, exit code 1

我试图重新安装ruby,重置rvm并重新安装gcc,但这些没有帮助。如果有办法解决这个问题,请告诉我。以下是环境:

ruby -v 
ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-darwin13.4.0]

rvm -v 
rvm 1.26.6 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]

除此之外,我想知道是否有可用于设置环境的材料,例如:.bashrc文件中的每一行是什么意思?

提前致谢。

1 个答案:

答案 0 :(得分:0)

在CLI中尝试以下步骤

brew tap homebrew/versions && brew install apple-gcc42

brew link --force apple-gcc42

ln -nsf $(which gcc-4.2) /usr/bin/gcc-4.2

之后尝试安装宝石。