2014-10-05 7 views
0

ruby ​​2.1.1을 새로 설치하고 homebrew로 V8을 다시 설치했지만이 '인식 할 수없는 명령 행 옵션'오류가 발생합니다.OSX에 rubyracer를 설치하십시오

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

    /Users/jspooner/.rvm/rubies/ruby-2.1.2/bin/ruby extconf.rb 
checking for main() in -lpthread... yes 
checking for main() in -lobjc... yes 
creating Makefile 

make "DESTDIR=" clean 

make "DESTDIR=" 
compiling accessor.cc 
g++: error: unrecognized command line option '-rdynamic' 
make: *** [accessor.o] Error 1 

make failed, exit code 2 

g ++ 버전

g++ -v 
Using built-in specs. 
COLLECT_GCC=g++ 
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/4.8.3/libexec/gcc/x86_64-apple-darwin13.2.0/4.8.3/lto-wrapper 
Target: x86_64-apple-darwin13.2.0 
Configured with: ../configure --build=x86_64-apple-darwin13.2.0 --prefix=/usr/local/Cellar/gcc/4.8.3 --enable-languages=c,c++,objc,obj-c++,fortran --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-cloog=/usr/local/opt/cloog --with-isl=/usr/local/opt/isl --with-system-zlib --enable-version-specific-runtime-libs --enable-libstdcxx-time=yes --enable-stage1-checking --enable-checking=release --enable-lto --disable-werror --enable-plugin --disable-nls --enable-multilib 
Thread model: posix 
gcc version 4.8.3 (GCC) 

답변

0

내가 양조 업데이트 GCC를 실행했다.

brew upgrade gcc 
==> Upgrading 1 outdated package, with result: 
gcc 4.9.1 
==> Upgrading gcc 
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/gcc-4.9.1.mavericks.bottle.2.tar.gz 
######################################################################## 100.0% 
==> Pouring gcc-4.9.1.mavericks.bottle.2.tar.gz 
==> Caveats 
GCC has been built with multilib support. Notably, OpenMP may not work: 
    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60670 
If you need OpenMP support you may want to 
    brew reinstall gcc --without-multilib 
==> Summary 
    /usr/local/Cellar/gcc/4.9.1: 1152 files, 203M 
0

g ++와 gcc의 심볼 링크를 변경하면 Mac OS 10.10에서 저에게 효과적입니다.

ls -al /opt/local/bin/gcc 
ls -al /opt/local/bin/g++ 
sudo rm /opt/local/bin/gcc 
sudo rm /opt/local/bin/g++ 
sudo ln -s /usr/bin/llvm-gcc /opt/local/bin/gcc 
sudo ln -s /usr/bin/llvm-g++ /opt/local/bin/g++ 
gem install therubyracer -v '0.12.1' 
sudo rm /opt/local/bin/g++ 
sudo rm /opt/local/bin/gcc 
sudo ln -s /opt/local/bin/g++-mp-4.9 /opt/local/bin/g++ 
sudo ln -s /opt/local/bin/gcc-mp-4.9 /opt/local/bin/gcc 
1

경우 (우분투 VM에 예컨대 :)이 상황을 가진 우분투 사용자

gem install therubyracer -v '0.11.4'                      
\Building native extensions. This could take a while... 
ERROR: Error installing therubyracer: 
     ERROR: Failed to build gem native extension. 

    /home/deploy/.rbenv/versions/2.0.0-p247/bin/ruby extconf.rb 
checking for main() in -lpthread... yes 
creating Makefile 

make "DESTDIR=" 
compiling accessor.cc 
make: g++: Command not found 
make: *** [accessor.o] Error 127 


Gem files will remain installed in /home/deploy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/therubyracer-0.11.4 for inspection. 
Results logged to /home/deploy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/therubyracer-0.11.4/ext/v8/gem_make.out 

우분투 솔루션 :

sudo apt-get install build-essential g++