错误"无法构建gem原生扩展"在安装Jekyll时

时间:2018-04-20 21:02:04

标签: ruby jekyll fedora

我正在尝试使用命令gem install jekyll --user-install

在Fedora 26上安装Jekyll

但是我收到以下错误:

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

current directory: /my_user/.gem/ruby/2.4.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
/usr/bin/ruby -r ./siteconf20180420-21754-1k1q01a.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/share/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /my_user/.gem/ruby/2.4.0/gems/http_parser.rb-0.6.0 for inspection.
Results logged to /my_user/.gem/ruby/2.4.0/extensions/x86_64-linux/2.4.0/http_parser.rb-0.6.0/gem_make.out

我安装了Ruby:

ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-linux]

我还使用gem update --system更新了Ruby Gems。

我搜索了Stackoverflow,我发现MacOS已经解决了类似的问题。

gem env的输出如下:

RubyGems Environment:
RUBYGEMS VERSION: 2.7.6
RUBY VERSION: 2.4.3 (2017-12-14 patchlevel 205) [x86_64-linux]
INSTALLATION DIRECTORY: /my_user/.gem/ruby/2.4.0
USER INSTALLATION DIRECTORY: /my_user/.gem/ruby/2.4.0
RUBY EXECUTABLE: /usr/bin/ruby
EXECUTABLE DIRECTORY: /my_user/bin
SPEC CACHE DIRECTORY: /my_user/.gem/specs
SYSTEM CONFIGURATION DIRECTORY: /etc
RUBYGEMS PLATFORMS:
  ruby
  x86_64-linux
GEM PATHS:
   /my_user/.gem/ruby/2.4.0
   /usr/share/gems
  /usr/local/share/gems
GEM CONFIGURATION:
  :update_sources => true
  :verbose => true
  :backtrace => false
  :bulk_threshold => 1000
REMOTE SOURCES:
  https://rubygems.org/
SHELL PATH:
  /my_user/anaconda2/bin
  /my_user/anaconda2/bin
  /usr/libexec/python2-sphinx
  /usr/lib64/qt-3.3/bin
  /my_user/perl5/bin
  /usr/local/bin
  /usr/bin
  /bin
  /usr/local/sbin
  /usr/sbin
  /usr/libexec/sdcc
  /my_user/.local/bin
  /my_user/bin
  /usr/libexec/sdcc

1 个答案:

答案 0 :(得分:1)

还有一些关于Fedora和jekyll旧版本问题的其他帖子,其中一篇:https://ask.fedoraproject.org/en/question/91815/problem-installing-jekyll-in-fedora-24/

也许试试:

sudo dnf install ruby-devel
gem install jekyll

或根据https://linuxsuperuser.com/install-jekyll-on-fedora-23/

sudo dnf install ruby-devel  
sudo dnf install redhat-rpm-config
sudo gem install jekyll