Jekyll在生成时崩溃:分割错误



当我像往常一样在我的jekyll项目目录中运行bundle exec jekyll serve --trace --port 4000时,我得到这个:

首先我得到一些关于路径的信息:

/usr/lib/ruby/3.0.0/pathname.rb:20: warning: already initialized constant Pathname::TO_PATH
/home/john/.gem/ruby/3.0.0/gems/pathname-0.2.0/lib/pathname.rb:20: warning: previous definition of TO_PATH was here
/usr/lib/ruby/3.0.0/pathname.rb:22: warning: already initialized constant Pathname::SAME_PATHS
/home/john/.gem/ruby/3.0.0/gems/pathname-0.2.0/lib/pathname.rb:22: warning: previous definition of SAME_PATHS was here
/usr/lib/ruby/3.0.0/pathname.rb:34: warning: already initialized constant Pathname::SEPARATOR_LIST
/home/john/.gem/ruby/3.0.0/gems/pathname-0.2.0/lib/pathname.rb:34: warning: previous definition of SEPARATOR_LIST was here
/usr/lib/ruby/3.0.0/pathname.rb:35: warning: already initialized constant Pathname::SEPARATOR_PAT
/home/john/.gem/ruby/3.0.0/gems/pathname-0.2.0/lib/pathname.rb:35: warning: previous definition of SEPARATOR_PAT was here
/usr/lib/ruby/3.0.0/pathname.rb:41: warning: already initialized constant Pathname::ABSOLUTE_PATH
/home/john/.gem/ruby/3.0.0/gems/pathname-0.2.0/lib/pathname.rb:41: warning: previous definition of ABSOLUTE_PATH was here

然后我得到错误信息:

bundler: failed to load command: jekyll (/home/john/.gem/ruby/3.0.0/bin/jekyll)
/home/john/.gem/ruby/3.0.0/gems/bundler-2.2.22/lib/bundler/shared_helpers.rb:58: [BUG] Segmentation fault at 0x0000000000000008
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux]

之后,我得到了这些日志块:

-- Control frame information -----------------------------------------------
c:0014 p:---- s:0068 e:000067 CFUNC  :pwd
c:0013 p:0012 s:0064 e:000063 BLOCK  /home/john/.gem/ruby/3.0.0/gems/bundler-2.2.22/lib/bundler/shared_helpers.rb:58 [FINISH]
c:0012 p:---- s:0061 e:000060 CFUNC  :synchronize
c:0011 p:0016 s:0057 e:000056 METHOD /home/john/.gem/ruby/3.0.0/gems/bundler-2.2.22/lib/bundler/shared_helpers.rb:57
c:0010 p:0023 s:0053 e:000051 METHOD /home/john/.gem/ruby/3.0.0/gems/bundler-2.2.22/lib/bundler/shared_helpers.rb:253
c:0009 p:0006 s:0044 e:000043 METHOD /home/john/.gem/ruby/3.0.0/gems/bundler-2.2.22/lib/bundler/shared_helpers.rb:144
c:0008 p:0015 s:0038 e:000037 RESCUE /home/john/.gem/ruby/3.0.0/gems/bundler-2.2.22/lib/bundler/cli.rb:26
c:0007 p:0024 s:0034 e:000032 METHOD /home/john/.gem/ruby/3.0.0/gems/bundler-2.2.22/lib/bundler/cli.rb:26
c:0006 p:0109 s:0028 e:000027 BLOCK  /home/john/.gem/ruby/3.0.0/gems/bundler-2.2.22/exe/bundle:49
c:0005 p:0014 s:0022 e:000021 METHOD /home/john/.gem/ruby/3.0.0/gems/bundler-2.2.22/lib/bundler/friendly_errors.rb:128
c:0004 p:0162 s:0017 E:000eb8 TOP    /home/john/.gem/ruby/3.0.0/gems/bundler-2.2.22/exe/bundle:37 [FINISH]
c:0003 p:---- s:0013 e:000012 CFUNC  :load
c:0002 p:0112 s:0008 E:0004b0 EVAL   /home/john/.gem/ruby/3.0.0/bin/bundle:23 [FINISH]
c:0001 p:0000 s:0003 E:002070 (none) [FINISH]
-- Ruby level backtrace information ----------------------------------------
/home/john/.gem/ruby/3.0.0/bin/bundle:23:in `<main>'
/home/john/.gem/ruby/3.0.0/bin/bundle:23:in `load'
/home/john/.gem/ruby/3.0.0/gems/bundler-2.2.22/exe/bundle:37:in `<top (required)>'
/home/john/.gem/ruby/3.0.0/gems/bundler-2.2.22/lib/bundler/friendly_errors.rb:128:in `with_friendly_errors'
/home/john/.gem/ruby/3.0.0/gems/bundler-2.2.22/exe/bundle:49:in `block in <top (required)>'
/home/john/.gem/ruby/3.0.0/gems/bundler-2.2.22/lib/bundler/cli.rb:26:in `start'
/home/john/.gem/ruby/3.0.0/gems/bundler-2.2.22/lib/bundler/cli.rb:26:in `ensure in start'
/home/john/.gem/ruby/3.0.0/gems/bundler-2.2.22/lib/bundler/shared_helpers.rb:144:in `print_major_deprecations!'
/home/john/.gem/ruby/3.0.0/gems/bundler-2.2.22/lib/bundler/shared_helpers.rb:253:in `search_up'
/home/john/.gem/ruby/3.0.0/gems/bundler-2.2.22/lib/bundler/shared_helpers.rb:57:in `pwd'
/home/john/.gem/ruby/3.0.0/gems/bundler-2.2.22/lib/bundler/shared_helpers.rb:57:in `synchronize'
/home/john/.gem/ruby/3.0.0/gems/bundler-2.2.22/lib/bundler/shared_helpers.rb:58:in `block in pwd'
/home/john/.gem/ruby/3.0.0/gems/bundler-2.2.22/lib/bundler/shared_helpers.rb:58:in `pwd'
-- Machine register context ------------------------------------------------
RIP: 0x00007f364880b478 RBP: 0x00005571417f9b78 RSP: 0x00007fff0c21e780
RAX: 0x0000000000000001 RBX: 0x0000000000000000 RCX: 0x0000000000000000
RDX: 0x0000000000000000 RDI: 0x0000000000000000 RSI: 0x0000000000000000
R8: 0x000000000000000f  R9: 0x00007fff0c21e7a0 R10: 0x0000000055550083
R11: 0x0000000000000000 R12: 0x00005571418b9ab0 R13: 0x00007fff0c21e7a0
R14: 0x0000000000000000 R15: 0x0000000000000000 EFL: 0x0000000000010202
-- C level backtrace information -------------------------------------------
/usr/lib/libruby.so.3.0(0x7f36488297c4) [0x7f36488297c4]
/usr/lib/libruby.so.3.0(0x7f364867c5f2) [0x7f364867c5f2]
/usr/lib/libruby.so.3.0(0x7f364879e7da) [0x7f364879e7da]
/usr/lib/libc.so.6(__restore_rt+0x0) [0x7f3648447da0]
/usr/lib/libruby.so.3.0(0x7f364880b478) [0x7f364880b478]
/usr/lib/libruby.so.3.0(0x7f364880ba3a) [0x7f364880ba3a]
/usr/lib/libruby.so.3.0(rb_funcallv+0x20b) [0x7f364882112b]
/usr/lib/ruby/3.0.0/x86_64-linux/pathname.so(0x7f36489772f4) [0x7f36489772f4]
/usr/lib/libruby.so.3.0(0x7f36488080cf) [0x7f36488080cf]
/usr/lib/libruby.so.3.0(0x7f3648810f96) [0x7f3648810f96]
/usr/lib/libruby.so.3.0(0x7f3648813bd4) [0x7f3648813bd4]
/usr/lib/libruby.so.3.0(rb_vm_exec+0x1e2) [0x7f3648818da2]
/usr/lib/libruby.so.3.0(rb_yield_values2+0x64) [0x7f364881cee4]
/usr/lib/libruby.so.3.0(rb_ensure+0x113) [0x7f3648683c23]
/usr/lib/libruby.so.3.0(0x7f36488080cf) [0x7f36488080cf]
/usr/lib/libruby.so.3.0(0x7f3648810f96) [0x7f3648810f96]
/usr/lib/libruby.so.3.0(0x7f3648813c31) [0x7f3648813c31]
/usr/lib/libruby.so.3.0(rb_vm_exec+0x1e2) [0x7f3648818da2]
/usr/lib/libruby.so.3.0(0x7f36486ceef6) [0x7f36486ceef6]
/usr/lib/libruby.so.3.0(0x7f36486cff17) [0x7f36486cff17]
/usr/lib/libruby.so.3.0(0x7f36488080cf) [0x7f36488080cf]
/usr/lib/libruby.so.3.0(0x7f3648810f96) [0x7f3648810f96]
/usr/lib/libruby.so.3.0(0x7f3648813bd4) [0x7f3648813bd4]
/usr/lib/libruby.so.3.0(rb_vm_exec+0x1e2) [0x7f3648818da2]
/usr/lib/libruby.so.3.0(0x7f3648682422) [0x7f3648682422]
/usr/lib/libruby.so.3.0(ruby_run_node+0x58) [0x7f3648685e08]
/home/john/.gem/ruby/3.0.0/bin/jekyll serve --trace --port 4000(0x55713f865081) [0x55713f865081]
/usr/lib/libc.so.6(__libc_start_main+0xd5) [0x7f3648432b25]
/home/john/.gem/ruby/3.0.0/bin/jekyll serve --trace --port 4000(_start+0x2e) [0x55713f8650ce]

之后是ruby使用的巨大的库和模块列表(因为它超过300行而被删减):

-- Other runtime information -----------------------------------------------
* Loaded script: /home/john/.gem/ruby/3.0.0/bin/jekyll
* Loaded features:
0 enumerator.so
1 thread.rb
2 rational.so
3 complex.so
4 ruby2_keywords.rb
5 /usr/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
6 /usr/lib/ruby/3.0.0/x86_64-linux/enc/trans/transdb.so
7 /usr/lib/ruby/3.0.0/x86_64-linux/rbconfig.rb
8 /usr/lib/ruby/3.0.0/rubygems/compatibility.rb
9 /usr/lib/ruby/3.0.0/rubygems/defaults.rb
10 /usr/lib/ruby/3.0.0/rubygems/deprecate.rb
11 /usr/lib/ruby/3.0.0/rubygems/errors.rb
...

作为最后一件事,我得到内存映射(剪辑):

* Process memory map:
55713f864000-55713f865000 r--p 00000000 103:04 15469920                  /usr/bin/ruby
55713f865000-55713f866000 r-xp 00001000 103:04 15469920                  /usr/bin/ruby
55713f866000-55713f867000 r--p 00002000 103:04 15469920                  /usr/bin/ruby
55713f867000-55713f868000 r--p 00002000 103:04 15469920                  /usr/bin/ruby
55713f868000-55713f869000 rw-p 00003000 103:04 15469920                  /usr/bin/ruby
557141771000-557142b5f000 rw-p 00000000 00:00 0                          [heap]
7f3643ff2000-7f3644200000 r--s 00000000 103:04 15469989                  /usr/lib/libc-2.33.so
7f3644200000-7f364456e000 r--s 00000000 103:04 15469941                  /usr/lib/libruby.so.3.0.2
7f364456e000-7f3644570000 r--p 00000000 103:04 15496948                  /usr/lib/libyaml-0.so.2.0.9
7f3644570000-7f364458a000 r-xp 00002000 103:04 15496948                  /usr/lib/libyaml-0.so.2.0.9
7f364458a000-7f364458e000 r--p 0001c000 103:04 15496948                  /usr/lib/libyaml-0.so.2.0.9
7f364458e000-7f364458f000 r--p 0001f000 103:04 15496948                  /usr/lib/libyaml-0.so.2.0.9
...

最后一行是终止信息:

fish: Job 1, 'bundle exec jekyll serve --trac…' terminated by signal SIGABRT (Abort)

所以…发生什么事了?什么会导致这个错误?我该如何诊断?如何解决这个问题?

谢谢你的帮助

解决方案

  1. 到你的主目录并删除gem目录:
rm -rf ~/.gem
  1. 然后安装bundler
gem install bundle
  1. 进入jekyll项目目录并安装gems:
bundle install

可选部分
  1. 现在当你运行bundle exec jekyll serve --trace时,你会得到这个错误

bundler: failed to load command: jekyll (/usr/bin/jekyll)
/usr/lib/ruby/珠宝//ffi-1.15.4/lib/ffi 3.0.0/宝石。在' require': libffi.so。-/usr/lib/ruby/gems/3.0.0/extensions/x86_64-linux/3.0.0/ffi-1.15.4/ffi_c. conf . conf . conf . conf . conf . conf . conf . conf . conf . conf所以(LoadError)

  1. 然后安装libffi
gem install ffi
  1. 现在当你运行bundle exec jekyll serve --trace时,你的jekyll应该能够生成站点并运行本地服务器。

最新更新