Programing

Mac OS X Lion에서`gem install therubyracer` 실패

lottogame 2020. 10. 28. 07:39
반응형

Mac OS X Lion에서`gem install therubyracer` 실패


gem install therubyracer일하는 데 도움을 주시면 감사하겠습니다 . 오류는 다음과 같습니다.

$ gem install therubyracer
Building native extensions.  This could take a while...
ERROR:  Error installing therubyracer:
    ERROR: Failed to build gem native extension.

        /Users/david/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for main() in -lobjc... yes
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/Users/david/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
    --with-objclib
    --without-objclib
extconf.rb:15:in `<main>': undefined method `include_path' for Libv8:Module (NoMethodError)

다음은 오류 전에 실행 한 몇 가지 주목할만한 단계입니다. 그들은 잘 작동했습니다.

$ gem install libv8
$ brew install v8

내 환경은 다음과 같습니다.

  • Mac OS X Lion 10.7.4
  • ruby 1.9.3p194 (2012-04-20 개정 35410) [x86_64-darwin11.4.0] (rvm 사용)
  • V8 버전 3.9.24 (homebrew를 통해)

이것은 나를 위해 일했습니다.

$ gem uninstall libv8
$ gem install therubyracer

( http://www.ruby-forum.com/topic/4306127에 감사드립니다 )


gem uninstall libv8
brew install v8
gem install therubyracer

그러나 이런 일이 발생 하는지 묻습니다. 그리고 제거 libv8하고 다시 설치 therubyracer하면 문제가 해결되는 이유는 무엇입니까?

대답은 오류 메시지 하단에 있습니다 (원래 게시물에서). 내용을 무시하십시오.

probably lack of necessary libraries and/or headers

이는 오류 메시지를 작성한 사람의 잘못된 가정입니다. 하단에는 Ruby가 이에 대해 말하는 내용이 있습니다.

undefined method `include_path' for Libv8:Module

내 경우에는, 내가 설치하려고했다 therubyracer-0.9.8와 함께 bundle install, 어떤 이유로, 그것은 내 복사본을 사용하려고했다 libv8-3.11.8.13아마 다른 보석의 종속성으로 일부 지점에 설치되었다.

therubyracer.gemspec포함 하고 있기 때문에 최신 버전을 사용하려는 이유를 모르겠습니다 s.add_dependency "libv8", "~> 3.3.10". 그리고 내가 Gemfile.lock사용 말한다 libv8 (3.3.10.2). 그러나 아아, 그것은 실제로 일어난 일입니다.

그리고 그 사실 Libv8:Module않습니다 하지 방법이 include_path에서를 libv8-3.11.8.13하지만, 하지libv8-3.3.10.2

그래서 모든 버전을 제거한 libv8다음 다시 설치하는 것이 therubyracer작동합니다. 모든 버전 때문에 libv8없는 방법이 include_path완전히 제거하고있는 libv8있는가 메소드 include당신이를 다시 설치할 때 경로가 다시 설치됩니다 therubyracer.


위의 내용이 100 % 효과가 있었다면 아무것도 고려하지 않았으므로 (rails 프로젝트의 일부로) 무엇을했는지 게시 할 것이라고 생각했습니다.

gem uninstall libv8
bundle update therubyracer

이것은 내가 therubyracer최신 버전과 최신 버전을 얻었는지 확인 libV8하고 libv8.a 파일 누락에서 정의되지 않은 메서드에 이르기까지 내가 부딪 쳤던 여러 문제를 해결하는 것 같습니다.


마침내 나는 therubyracer 0.11.0beta5를 해결책으로 사용합니다.

Rubyracer (0.11.0beta5) 사용

Gemfile에 다음을 추가하십시오.

gem 'therubyracer', '~> 0.11.0beta5'
group :libv8 do
  gem 'libv8', "~> 3.11.8"
end

그때 bundle install

Mac OSX 10.8 Moutain Lion


If you need 0.11.3 and it's failing give this a shot for Mac OS X 10.9...

gem uninstall libv8
brew install v8
gem install libv8 -- --with-system-v8
gem install therubyracer -v '0.11.3' -- --with-system-v8

See this issue for more details.

You probably don't need the -- --with-system-v8 on the last line but I did it just to be safe since I saw it start doing Fetching: libv8-3.11.8.17-x86_64-darwin-13.gem (1%) when I ran the command...

Anyhow, it worked for me when all the other things did not.


For anyone encountering this issue on Mac OSX 10.8 Mountain Lion when attempting to upgrade their Gemfile with gem 'therubyracer', '0.11.0', just upgrading the system libv8 gem worked for me (no uninstallation of any other gem necessary):

$ gem update libv8
$ bundle install

Edit

If you use Travis-CI (or other CI tools located on other servers, I assume), you will need to explicitly add the libv8 gem to your Gemfile as well:

Gemfile

gem 'libv8', '3.11.8.3'

then bundle install as usual. Just note that libv8 can take a significant amount of time to install and I've noticed that it may end up being the cause of going over Travis CI's timeout limits, causing your build to fail. You can mitigate this slightly be not including development environment gems in your builds:

.travis.yml

# ...
bundler_args: --binstubs=./bundler_stubs --without development

Update

Yep, pretty much all my Travis builds timeout and fail because of this. If anyone knows a way to solve this problem (I would hope "downgrade therubyracer" is a last resort), please leave a comment!

Update 2

This may not work for all apps, but it seems that my Rails 3.2.9 apps didn't actually need therubyracer or libv8 after all. After removing those gems from my Gemfile, I confirmed that my specs passed, pushed again to Travis and it built successfully. So, I guess getting rid of those gems (if you're not sure you actually need them) is at least worth a try.

Update 3

Thanks to Paul Annesley for confirming that if you're on Mac OS X 10.8 Mountain Lion, you don't need therubyracer gem at all since the OS already comes bundled with Apple JavaScriptCore, its own Javascript runner. At the time of the original answer, I was on Snow Leopard and hence needed it.


For me, removing the Gemfile.lock file and running bundle install worked it's magic.


OSX 10.8.2, ruby 1.9.3p125

None of the above worked for me... I got tired of trying to find the right gem for my environment, so I just soft linked to the g++ target this things was missing:

sudo ln -s `which g++` /usr/bin/g++-4.2

Not as helpfully for remote deployments, but get the job done on my workstation.


I got a similar issue, but it was also complaining about not finding g++-4.2. I did have XCode command line tools installed, but it was looking for /usr/bin/g++-4.2, I had g++ (which was a symbolic link pointing to llvm-g++-4.2). Anyway, I just created a symbolic link to g++ and tried the bundle install again... it worked!

$ cd /usr/bin

$ sudo ln -s g++ g++-4.2


Had the same error, this worked for me:

  1. From console: gem uninstall libv8

  2. In your Gemfile, add the following:

    gem 'therubyracer', :platforms => :ruby, :require => 'v8'
    gem 'libv8', '~> 3.11.8'  # Update version number as needed
    
  3. From console: bundle install

If you were in the middle of upgrading therubyracer gem, you may want to run bundle update therubyracer after that as well. (Consider specifying a version number)

This was on Mac 10.6 (Snow Leopard).

참고URL : https://stackoverflow.com/questions/10905820/gem-install-therubyracer-fails-on-mac-os-x-lion

반응형