首先,为了安装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
发布于 2022-07-04 09:19:33
对于linux,基于Ubuntu 20。和linux 21
$ 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
对我起作用了。
发布于 2022-10-05 10:11:40
运行以下命令$ bundle安装-路径供应商/包
对我起作用了。
https://stackoverflow.com/questions/66811115
复制相似问题