therubyracer install error. I tried all other SO solutions and still no luck

爱⌒轻易说出口 提交于 2019-12-11 06:25:35

问题


I think this is a common problem of installing therubyracer gem in Rails. It is a dependency for the twitter-bootstrap-rails gem.

I have tried solution such as this: `gem install therubyracer` fails on Mac OS X Lion

Here is the portion of my gem file that's relavant:

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'

  gem 'twitter-bootstrap-rails'
end

And here is the error I got when running bundle install:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /Users/lionel_lei/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb 
checking for main() in -lobjc... yes
creating Makefile

make
compiling rr.cpp
make: clang++: No such file or directory
make: *** [rr.o] Error 1


Gem files will remain installed in /Users/lionel_lei/.rvm/gems/ruby-1.9.3-p194/gems/therubyracer-0.10.2 for inspection.
Results logged to /Users/lionel_lei/.rvm/gems/ruby-1.9.3-p194/gems/therubyracer-0.10.2/ext/v8/gem_make.out
An error occured while installing therubyracer (0.10.2), and Bundler cannot continue.
Make sure that `gem install therubyracer -v '0.10.2'` succeeds before bundling.

My system environment is: Rails 3.2.6 ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.1] Mac OSX 10.7.4 (lion) Xcode 4.5

  • I've been pulling my hair out. I am new to ruby/rails, heck I am new to coding in general so the error message doesn't make much sense to me. I am guessing it's some kind of compiler issue.

Thanks for your help.


回答1:


I experienced the same problem, which I resolved by installing libv8 (gem install libv8), then installing therubyracer. You will need to have Apple XCode installed first (install from the App Store) as this includes the c compiler that you will need to build libv8.

EDIT: Once you have installed XCode, if you are using the latest version you will need to manually install the "command line tools" to get the c compiler, you can find this in XCode --> preferences --> downloads --> install command line tools.



来源:https://stackoverflow.com/questions/12720909/therubyracer-install-error-i-tried-all-other-so-solutions-and-still-no-luck

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!