Installing libv8 gem on OS X 10.9+

后端 未结 20 915
旧时难觅i
旧时难觅i 2020-11-29 14:41

I\'m trying to install libv8 3.16.14.3 but getting an error on OSX Mavericks using latest stable rvm and ruby-1.9.3-p125.

This is the output of running the command \

相关标签:
20条回答
  • 2020-11-29 15:07

    I was using a beta version of Xcode for another project and had forgotten. Switch back with xcode-select. Something like:

    sudo xcode-select --switch /Applications/Xcode.app/
    
    0 讨论(0)
  • 2020-11-29 15:11

    Try with what I summarized in this question: "gem install therubyracer -v '0.10.2'" on osx mavericks not installing

    It worked for me (OS X Mavericks)

    0 讨论(0)
  • 2020-11-29 15:11

    None of this helped me... no matter what I did, my gem install of therubyracer kept complaining with this error:

    Unable to find a compiler officially supported by v8.
    It is recommended to use GCC v4.4 or higher
    Beginning compilation. This will take some time.
    Building v8 with env CXX=clang++ LINK=clang++  /usr/local/bin/gmake x64.release ARFLAGS.target=crs werror=no
    GYP_GENERATORS=make \
    build/gyp/gyp --generator-output="out" build/all.gyp \
                  -Ibuild/standalone.gypi --depth=. \
                  -Dv8_target_arch=x64 \
                  -S.x64 -Dmac_deployment_target=10.15 -Dv8_enable_backtrace=1 -Dv8_can_use_vfp2_instructions=true -Darm_fpu=vfpv2 -Dv8_can_use_vfp3_instructions=true -Darm_fpu=vfpv3 -Dwerror=''
      File "build/gyp/gyp", line 12
        except ImportError, e:
                          ^
    SyntaxError: invalid syntax
    gmake: *** [Makefile:268: out/Makefile.x64] Error 1
    

    What ultimately helped me was this other forum I stumbled upon at https://www.bountysource.com/issues/82833405-libv8-fails-to-build-on-catalina-10-15

    The final solution that worked for me:

    I had to add these lines to my .zshrc file:

    export CXX=clang++
    export GYPFLAGS=-Dmac_deployment_target=10.15
    

    Then I had to run these commands:

    source ~/.zshrc
    brew tap homebrew/homebrew-core
    brew install v8@3.15
    gem uninstall therubyracer
    gem uninstall libv8
    gem install libv8 -v '3.16.14.19' -- --with-system-v8
    gem install therubyracer -v '0.12.3' -- --with-v8-dir=/usr/local/opt/v8@3.15
    bundle install
    

    I hope someone else finds this useful!

    0 讨论(0)
  • 2020-11-29 15:13

    In MAC-Yosemite with RVM environment and ruby-2.1.1 version

    gem install libv8 -v 3.16.14.3 -- --with-v8-lib gem install therubyracer

    It works with the help of above command, can confirm this.

    0 讨论(0)
  • 2020-11-29 15:15

    My issue is since therubyracer, when update to macOS 10.15 and ruby-2.6.5

    And the following works for me:

    brew install v8@3.15
    
    gem install libv8 -v 3.16.14.19 -- --with-system-v8
    
    gem install therubyracer -- --with-v8-dir=/usr/local/opt/v8@3.15
    
    0 讨论(0)
  • 2020-11-29 15:16

    El Capitan Solution for me:

    $ brew install v8
    $ gem install libv8 -v REQUIRED_LIBV8_VERSION -- --with-system-v8
    

    Where REQUIRED_LIBV8_VERSION for me was 3.16.14.7, but you need to check which is the one you need in your bundle (this was the one for rails 4.2.5)

    You may also need to run the commands above as the superuser (if your gems and system libraries are global)

    0 讨论(0)
提交回复
热议问题