Installing libv8 gem on OS X 10.9+

后端 未结 20 1052
旧时难觅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: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!

提交回复
热议问题