“gem install therubyracer -v '0.10.2'” on osx mavericks not installing

后端 未结 12 1693
说谎
说谎 2020-11-28 17:22

Trying to install therubyracer on mavericks using \"gem install therubyracer -v \'0.10.2\'\" but i am getting the following error:

/Users/dennischen/.rvm/rub         


        
相关标签:
12条回答
  • 2020-11-28 18:09

    I had the same problem, this works for me:

    therubyracer (0.10.2) & libv8 (3.3.10.4)

    First of all:

    • brew install apple-gcc42
    • you must link all the binary files of the compilers (gcc, cpp, g++) to /usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/<compiler>

    After, you could try this:

    • brew install v8
    • gem install libv8 -v '3.3.10.4' -- --with-system-v8
    • gem install therubyracer -v 'therubyracer' or bundle install into the directory of the rails project.
    0 讨论(0)
  • 2020-11-28 18:10

    I found a workaround that worked without installing apple-gcc42.

    This will work if the error message you're getting looks like this:

    clang: error: no such file or directory: '/Users/mscottford/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/libv8-3.3.10.4/lib/libv8/build/v8/libv8.a'
    

    Then you should be able to do the following:

    brew install v8
    bundle install 
    # after failing create link from brew installed v8 to error location
    ln -s /usr/local/Cellar/v8/3.21.17/lib/libv8_base.x64.a /Users/mscottford/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/libv8-3.3.10.4/lib/libv8/build/v8/libv8.a
    bundle install
    

    Source: https://github.com/cowboyd/therubyracer/issues/277#issuecomment-27734348

    0 讨论(0)
  • 2020-11-28 18:10

    I had a nearly identical error when trying to install therubyracer 0.12.0 to get it to work with libv8. This worked for me:

    $ brew upgrade gcc
    
    $ gem uninstall therubyracer
    
    $ gem uninstall libv8
    
    $ gem install therubyracer -v '0.12.0'
    Fetching: therubyracer-0.12.0.gem (100%)
    Building native extensions.  This could take a while...
    Successfully installed therubyracer-0.12.0
    1 gem installed
    
    $ gem install libv8 -v '3.16.14.3' -- --with-system-v8
    Fetching: libv8-3.16.14.3.gem (100%)
    Building native extensions with: '--with-system-v8'
    This could take a while...
    Successfully installed libv8-3.16.14.3
    1 gem installed
    
    0 讨论(0)
  • 2020-11-28 18:15

    So I finally got it working after some struggling... thanks to Simon and Alvaro.

    I have one thing to add though, using the flag --with-system-v8 did not work for me... So i removed my system v8 with

    brew uninstall v8

    And the run

    gem install libv8

    If you have already run gem install libv8 with the system v8 flag be sure to uninstall that gem version (do it by running gem uninstall libv8). The important thing is that you shouldn't use the one provided by brew, it does not seem to work in Mavericks (it gets installed well and bundler will report that your bundle is complete, but your app will fail when it tries to use v8).

    To summarize the answer, doing the following worked for me:

    brew install apple-gcc42
    sudo ln -s /usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2 /usr/bin/gcc
    sudo ln -s /usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/g++-4.2 /usr/bin/g++
    sudo ln -s /usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/cpp-4.2 /usr/bin/cpp
    
    brew uninstall v8
    gem install libv8
    gem install therubyracer
    
    0 讨论(0)
  • 2020-11-28 18:15

    I manage to install therubyracer 0.12 and libv8 3.16.14.3 on ruby 2.0.0p353 and os x 10.9

    libv8 requires gcc42

    brew install v8
    brew install apple-gcc42
    sudo ln -sf /usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2 /usr/bin/gcc
    sudo ln -sf /usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/g++-4.2 /usr/bin/g++
    sudo ln -sf /usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/cpp-4.2 /usr/bin/cpp
    gem install libv8
    

    therubyracer requires later gcc

    brew install gcc49
    sudo ln -sf /usr/local/Cellar/gcc49/4.9-20131110/bin/gcc-4.9 /usr/bin/gcc
    sudo ln -sf /usr/local/Cellar/gcc49/4.9-20131110/bin/g++-4.9 /usr/bin/g++
    sudo ln -sf /usr/local/Cellar/gcc49/4.9-20131110/bin/cpp-4.9 /usr/bin/cpp
    

    Gemfile

    gem 'therubyracer', :require => 'v8', :platforms => :ruby
    

    use bundle instead of gem install therubyracer

    0 讨论(0)
  • 2020-11-28 18:19

    I just had the same problem and one solution is currently to use apple-gcc42 instead of clang to compile both gems :

    brew install apple-gcc42
    

    And then you have the choice between doing some symlinks in /usr/bin for {gcc,g++,c++} binaries :

    sudo ln -s /usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2 /usr/bin/gcc
    sudo ln -s /usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/g++-4.2 /usr/bin/g++
    sudo ln -s /usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/cpp-4.2 /usr/bin/cpp
    

    In fact g++ should be enough.

    Or...you could export CC/CXX/CPP environment variables with paths corresponding to the binaries created by homebrew. That's surely a cleaner workaround.

    A third solution is to download Xcode 4.6.3 and install it in the Applications folder. Then, enter in the terminal:

    sudo xcode-select --switch /Applications/Xcode4.6.3.app/Contents/Developer
    gem install therubyracer
    

    Once the gem has been installed you can switch back to Xcode 5.0 :

    sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
    
    0 讨论(0)
提交回复
热议问题