簡體   English   中英

無法在 Ubuntu 20.04 上安裝 rubyracer

[英]Cannot install therubyracer on Ubuntu 20.04

首先,為了安裝 therubyracer,我應該使用 Mac 用戶給出的以下說明進行安裝。

# !!! Below will not work !!!
linux brew install v8-315 # Segmentation Fault (core dumped) error
bundle config --local build.libv8 --with-system-v8

但是運行上面會導致分段錯誤,所以我決定運行下面。

# This works
gem install libv8 # This works
bundle set config --local build.libv8 --with-system-v8

然后我嘗試了:

bundle config set --local build.therubyracer --with-v8-dir=/var/lib/gems/2.7.0/gems/libv8-3.16.14.19 --with-system-v8 # Where libv8 gem is installed

但這在我運行時不起作用:

bundle install --path vendor/bundle

捆綁安裝中的錯誤是:

home/xxxx/Desktop/dsp-manage/vendor/bundle/ruby/2.7.0/gems/libv8-3.16.14.19/ext/libv8/location.rb:50:in `configure': By using --with-system-v8, you have chosen to use the version 
(Libv8::Location::System::NotFoundError)
of V8 found on your system and *not* the one that is bundled with 
the libv8 rubygem. 

However, your system version of v8 could not be located. 

Please make sure your system version of v8 that is compatible 
with 3.16.14.19 installed. You may need to use the 
--with-v8-dir option if it is installed in a non-standard location
        from /home/xxxx/Desktop/dsp-manage/vendor/bundle/ruby/2.7.0/gems/libv8-3.16.14.19/lib/libv8.rb:7:in `configure_makefile'
        from extconf.rb:32:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/xxxx/Desktop/dsp-manage/vendor/bundle/ruby/2.7.0/extensions/x86_64-linux/2.7.0/therubyracer-0.12.3/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/xxxx/Desktop/dsp-manage/vendor/bundle/ruby/2.7.0/gems/therubyracer-0.12.3 for inspection.
Results logged to /home/xxxx/Desktop/dsp-manage/vendor/bundle/ruby/2.7.0/extensions/x86_64-linux/2.7.0/therubyracer-0.12.3/gem_make.out

An error occurred while installing therubyracer (0.12.3), and Bundler cannot continue.
Make sure that `gem install therubyracer -v '0.12.3' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  therubyracer

gem_make.out 中的錯誤是:

current directory: /home/xxxx/Desktop/dsp-manage/vendor/bundle/ruby/2.7.0/gems/therubyracer-0.12.3/ext/v8
/usr/bin/ruby2.7 -I /usr/lib/ruby/2.7.0 -r ./siteconf20210326-38637-x0u0s3.rb extconf.rb --with-v8-dir\=/var/lib/gems/2.7.0/gems/libv8-3.16.14.19 --with-system-v8
checking for -lpthread... yes
checking for v8.h... no
*** 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
    --without-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=/usr/bin/$(RUBY_BASE_NAME)2.7
    --with-pthread-dir
    --without-pthread-dir
    --with-pthread-include
    --without-pthread-include=${pthread-dir}/include
    --with-pthread-lib
    --without-pthread-lib=${pthread-dir}/lib
    --with-pthreadlib
    --without-pthreadlib
    --enable-debug
    --disable-debug
    --with-v8-dir
    --with-v8-include
    --without-v8-include=${v8-dir}/include
    --with-v8-lib
    --without-v8-lib=${v8-dir}/lib
/home/xxxx/Desktop/dsp-manage/vendor/bundle/ruby/2.7.0/gems/libv8-3.16.14.19/ext/libv8/location.rb:50:in `configure': By using --with-system-v8, you have chosen to use the version  (Libv8::Location::System::NotFoundError)
of V8 found on your system and *not* the one that is bundled with 
the libv8 rubygem. 

However, your system version of v8 could not be located. 

Please make sure your system version of v8 that is compatible 
with 3.16.14.19 installed. You may need to use the 
--with-v8-dir option if it is installed in a non-standard location
    from /home/xxxx/Desktop/dsp-manage/vendor/bundle/ruby/2.7.0/gems/libv8-3.16.14.19/lib/libv8.rb:7:in `configure_makefile'
    from extconf.rb:32:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/xxxx/Desktop/dsp-manage/vendor/bundle/ruby/2.7.0/extensions/x86_64-linux/2.7.0/therubyracer-0.12.3/mkmf.log

extconf failed, exit code 1

對於基於 Ubuntu 20 的 linux 薄荷糖。

$ gem uninstall therubyracer 
$ gem uninstall libv8

$ gem install therubyracer -v '0.12.3' -- --with-system-v8
$ gem install libv8 -v '3.16.14.19' -- --with-system-v8
$ bundle config build.libv8 --with-system-v8

$ bundle

它對我有用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM