OS X 10.9 이상에 libv8 gem 설치 /Users/me/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb creating

libv8 3.16.14.3을 설치하려고하지만 최신 안정 rvm 및 ruby-1.9.3-p125를 사용하여 OSX Mavericks에서 오류가 발생합니다.

다음은 ‘gem install libv8’명령을 실행 한 결과입니다.

~/src(branch:master) » gem install libv8
Fetching: libv8-3.16.14.3.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing therubyracer:
  ERROR: Failed to build gem native extension.

    /Users/me/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb
creating Makefile
Compiling v8 for x64
Using python 2.7.5
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Unable to find a compiler officially supported by v8.
It is recommended to use GCC v4.4 or higher
Using compiler: g++
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Unable to find a compiler officially supported by v8.
It is recommended to use GCC v4.4 or higher
libtool: unrecognized option `-static'
libtool: Try `libtool --help' for more information.
make[1]: *** [/Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/libpreparser_lib.a] Error 1
make: *** [x64.release] Error 2
/Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/ext/libv8/location.rb:36:in `block in verify_installation!': libv8 did not install properly, expected binary v8 archive '/Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/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/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/ext/libv8/location.rb:35:in `each'
  from /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/ext/libv8/location.rb:35:in `verify_installation!'
  from /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/ext/libv8/location.rb:26:in `install!'
  from extconf.rb:7:in `<main>'
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
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/atomicops_internals_x86_gcc.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum-dtoa.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/cached-powers.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/conversions.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/diy-fp.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/dtoa.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/fast-dtoa.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/fixed-dtoa.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/once.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/preparse-data.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/preparser.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/preparser-api.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/scanner.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/strtod.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/token.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/unicode.o
  CXX(target) /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/obj.target/preparser_lib/src/utils.o
  LIBTOOL-STATIC /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/vendor/v8/out/x64.release/libpreparser_lib.a


Gem files will remain installed in /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3 for inspection.
Results logged to /Users/me/.rvm/gems/ruby-1.9.3-p125@proj-rails3-ruby19/gems/libv8-3.16.14.3/ext/libv8/gem_make.out



답변

이는 OS X 10.9 이상이 GCC 버전 4.8을 사용하고 있기 때문입니다. 풀 요청 ( https://github.com/cowboyd/libv8/pull/95 )에 언급 된대로 이전 버전의 libv8에서는 공식적으로 지원되지 않습니다 . Gemfile (또는)에서 libv8 버전을 향상 시키십시오 bundle update. 도움이 되었기를 바랍니다.

libv8 README에서

자신의 V8을 가져와

libv8은 Rubyracer에서 사용하는 V8 엔진의 인터페이스이므로 V8이 이미 설치되어 있어도 libv8을 사용해야합니다. V8 설치를 사용하지 않고 직접 설치하려면 –with-system-v8 옵션을 사용하십시오.

RubyGems 사용하기 :

gem install libv8 [-v YOUR_VERSION]—with-system-v8

번 들러 사용 (Gemfile에서) :

bundle config build.libv8 –with-system-v8

자신의 V8을 실행하려면 V8과 헤더 (데비안 배포판 용 libv8-dev에 있음)를 모두 설치해야합니다.

자신의 컴파일러 가져 오기

컴파일 전에 CXX 환경 변수를 설정하거나 번들 구성에 –with-cxx = 옵션을 추가하여 원하는 컴파일러를 지정할 수 있습니다.

번들 설정 build.libv8 –with-cxx = clang ++

편집하다:

이 문제가 발생한 경우 rider_on_rails 에서therubyracer 제안한대로 다음을 시도 하십시오 .

gem 제거 libv8

gem 설치 Rubyracer -v YOUR_RUBY_RACER_VERSION

gem install libv8 -v YOUR_VERSION—with-system-v8


답변

Mavericks에 해당 버전을 실제로 설치할 수 있습니다.

gem install libv8 -v 3.11.8.17 -- --with-system-v8

rbenv 및 ruby ​​1.9.3p448에서 작동하는지 확인할 수 있습니다.


답변

나를위한 엘 캐피 탄 솔루션 :

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

REQUIRED_LIBV8_VERSION내가 어디에 3.16.14.7있었지만 번들에 필요한 것이 무엇인지 확인해야합니다 (레일에 대한 것이 었습니다 4.2.5)

gem과 시스템 라이브러리가 전역 인 경우 수퍼 유저 권한으로 위의 명령을 실행해야 할 수도 있습니다.


답변

허용 된 답변을 시도했을 때 libv8은와 함께 성공적으로 설치 gem install libv8되지만 bundle installlibv8에서는 실패합니다. bundle install다른 버전의 libv8을 설치하려고 한다고 생각합니다 . 나는 나를 위해 일한 해결책을 찾을 수있었습니다.

Rubyracer가 의존하기 때문에 libv8이 필요했습니다. 그것을 설치하기 위해, gem_make.outRubyracer 의 로그에 설치에 실패한 버전을 기록했습니다. ( gem_make.out로그 경로 는 실패 메시지에 있습니다.) 제 경우에는 3.16.14.7이었습니다. (이 버전은 지금부터 3 년 동안 읽고있는 경우를 대비하여 시간이 지남에 따라 변경 될 수 있습니다.) 그런 다음이 작업을 수행했습니다.

gem install libv8 -v 3.16.14.7 -- --with-v8-lib <-허용 된 답변과 다른 플래그를 적어 둡니다.

이것이 작동하게했습니다 :

gem install therubyracer

내가 내 완료 할 수 bundle install있습니다.

이것은 OSX Yosemite에서 나를 위해 일했습니다.


답변

https://github.com/cowboyd/therubyracer/issues/339

해당 링크에서 찾은 jasonlynes의 솔루션이 나를 속였습니다. 다른 것이 작동하지 않았습니다.

brew install homebrew/versions/v8-315
brew link --overwrite v8-315 --force
gem install libv8 -v '3.16.14.13' -- --with-system-v8
gem install therubyracer -v '0.12.2' -- --with-system-v8


답변

각 버전을 알 필요없이 번 들러를 구성 할 수 있습니다. @ 3.15는 다른 버전으로 대체 될 수 있습니다.

$ brew install v8@3.15
$ bundle config build.libv8 --with-system-v8
$ bundle config build.therubyracer --with-v8-dir=$(brew --prefix v8@3.15)
$ bundle install


답변

macOS Catalina @ 10.15 및로 업데이트했습니다 ruby 2.6.5. 가지고있는 동안은 후 libv8therubyracer나는 아직 업데이트 맥 OS에하지 않는 것이 좋습니다 것입니다 있지만, 다시 설치 (I이 들어 ruby괜찮을 것).

먼저 XCode를 업데이트해야했습니다.

  1. xcode-select --install

예전 rbenv에는 업데이트 ruby하고 ruby버전을 수동으로 설정 /Users/<username>/.rbenv/version했습니다 2.6.5. 프로젝트에 .ruby-version파일이 포함되어 있는지는 중요하지 않습니다 .

그리고 나는 이리저리 설치된 버전을 청소 libv8(일반적으로 /usr/local/opt/) brew uninstall v8,brew uninstall libv8@3.15

  1. brew install v8@3.15

이제 https://github.com/cowboyd/libv8#do-i-get-a-binary 다음에 설치했습니다.

  1. gem install libv8 -v '3.16.14.19' -- --with-system-v8

그런 다음 bundle install오류없이 실행될 수 있습니다.