作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我一直在尝试安装 therubyracer 并尝试了几乎所有我在 stackoverflow 上能找到的东西,但它似乎仍然给我同样的错误。我也是 ruby on rails 的新手,所以我无法准确浏览错误消息。以下是错误信息:
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
current directory: /Users/zoepa/.rvm/gems/ruby-2.7.0/gems/libv8-3.16.14.19/ext/libv8
/Users/zoepa/.rvm/rubies/ruby-2.7.0/bin/ruby -I /Users/zoepa/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0 -r ./siteconf20200616-2984-xp1oct.rb extconf.rb --with-v8-dir\=/usr/local/opt/v8@3.15
creating Makefile
Applying /Users/zoepa/.rvm/gems/ruby-2.7.0/gems/libv8-3.16.14.19/patches/disable-building-tests.patch
Applying /Users/zoepa/.rvm/gems/ruby-2.7.0/gems/libv8-3.16.14.19/patches/disable-werror-on-osx.patch
Applying /Users/zoepa/.rvm/gems/ruby-2.7.0/gems/libv8-3.16.14.19/patches/disable-xcode-debugging.patch
Applying /Users/zoepa/.rvm/gems/ruby-2.7.0/gems/libv8-3.16.14.19/patches/do-not-imply-vfp3-and-armv7.patch
Applying /Users/zoepa/.rvm/gems/ruby-2.7.0/gems/libv8-3.16.14.19/patches/do-not-use-MAP_NORESERVE-on-freebsd.patch
Applying /Users/zoepa/.rvm/gems/ruby-2.7.0/gems/libv8-3.16.14.19/patches/do-not-use-vfp2.patch
Applying /Users/zoepa/.rvm/gems/ruby-2.7.0/gems/libv8-3.16.14.19/patches/fPIC-for-static.patch
Compiling v8 for x64
Using python 2.7.16
Using compiler: c++ (clang version 11.0.0)
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=c++ LINK=c++ /usr/bin/make 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 -Dv8_enable_backtrace=1 -Dv8_can_use_vfp2_instructions=true -Darm_fpu=vfpv2 -Dv8_can_use_vfp3_instructions=true -Darm_fpu=vfpv3 -Dwerror=''
CXX(target) /Users/zoepa/.rvm/gems/ruby-2.7.0/gems/libv8-3.16.14.19/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o
warning: include path for stdlibc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
In file included from ../src/allocation.cc:33:
../src/utils.h:33:10: fatal error: 'climits' file not found
#include <climits>
^~~~~~~~~
1 warning and 1 error generated.
make[1]: *** [/Users/zoepa/.rvm/gems/ruby-2.7.0/gems/libv8-3.16.14.19/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o] Error 1
make: *** [x64.release] Error 2
/Users/zoepa/.rvm/gems/ruby-2.7.0/gems/libv8-3.16.14.19/ext/libv8/location.rb:36:in `block in verify_installation!': libv8 did not install properly, expected binary v8 archive '/Users/zoepa/.rvm/gems/ruby-2.7.0/gems/libv8-3.16.14.19/vendor/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a'to exist, but it was not found (Libv8::Location::Vendor::ArchiveNotFound)
from /Users/zoepa/.rvm/gems/ruby-2.7.0/gems/libv8-3.16.14.19/ext/libv8/location.rb:35:in `each'
from /Users/zoepa/.rvm/gems/ruby-2.7.0/gems/libv8-3.16.14.19/ext/libv8/location.rb:35:in `verify_installation!'
from /Users/zoepa/.rvm/gems/ruby-2.7.0/gems/libv8-3.16.14.19/ext/libv8/location.rb:26:in `install!'
from extconf.rb:7:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/zoepa/.rvm/gems/ruby-2.7.0/gems/libv8-3.16.14.19 for inspection.
Results logged to /Users/zoepa/.rvm/gems/ruby-2.7.0/extensions/x86_64-darwin-19/2.7.0/libv8-3.16.14.19/gem_make.out
最佳答案
如错误消息所述,您使用的是 Clang,但您安装的 libv8 的过时版本仅支持 GCC。
请注意,therubyracer 的最新版本是从 2017 年 1 月开始的(看起来自 2013 年初以来就没有任何开发),它使用的 libv8 版本也是如此(当然,附带的 V8 版本使用该版本的 libv8)。它建议使用 2012 年的 GCC 4.4。
我怀疑您是否会得到对这样旧版本的 libv8、V8 或 GCC 的任何支持。另外请注意,当时还没有 Ruby 2.7,当前的 Ruby 版本在 2017 年初是 2.4,在 2013 年初是 2.0。
关于ruby-on-rails - 如何在 mac 上安装 therubyracer? "gem install therubyracer -v "不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62413064/
我是一名优秀的程序员,十分优秀!