简体   繁体   English

安装jekyll会返回错误(无法构建gem本机扩展。)

[英]installing jekyll gives returns error (Failed to build gem native extension.)

I have a fresh install of fedora. 我重新安装了fedora。 I installed ruby , ruby-devel and gone through jekyll troubleshooting on their website but i still get the same error. 我安装了rubyruby-devel并在其网站上进行了kykyll故障排除,但是我仍然遇到相同的错误。 I tried installing another gem which is Sass , just to make sure its not a ruby issue and it successfully installed. 我尝试安装另一个Sass宝石,以确保它不是ruby问题,并且安装成功。

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

    current directory: /usr/local/share/gems/gems/ffi-1.9.10/ext/ffi_c
/usr/bin/ruby -r ./siteconf20160620-3296-7ascyu.rb extconf.rb
checking for ffi.h... *** 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}/lib64
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/bin/$(RUBY_BASE_NAME)
    --with-ffi_c-dir
    --without-ffi_c-dir
    --with-ffi_c-include
    --without-ffi_c-include=${ffi_c-dir}/include
    --with-ffi_c-lib
    --without-ffi_c-lib=${ffi_c-dir}/lib64
    --with-libffi-config
    --without-libffi-config
    --with-pkg-config
    --without-pkg-config
/usr/share/ruby/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /usr/share/ruby/mkmf.rb:587:in `try_cpp'
    from /usr/share/ruby/mkmf.rb:1060:in `block in have_header'
    from /usr/share/ruby/mkmf.rb:911:in `block in checking_for'
    from /usr/share/ruby/mkmf.rb:351:in `block (2 levels) in postpone'
    from /usr/share/ruby/mkmf.rb:321:in `open'
    from /usr/share/ruby/mkmf.rb:351:in `block in postpone'
    from /usr/share/ruby/mkmf.rb:321:in `open'
    from /usr/share/ruby/mkmf.rb:347:in `postpone'
    from /usr/share/ruby/mkmf.rb:910:in `checking_for'
    from /usr/share/ruby/mkmf.rb:1059:in `have_header'
    from extconf.rb:16:in `<main>'

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

  /usr/local/lib64/gems/ruby/ffi-1.9.10/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/share/gems/gems/ffi-1.9.10 for inspection.
Results logged to /usr/local/lib64/gems/ruby/ffi-1.9.10/gem_make.out

info from mkmf.log : 来自mkmf.log信息:

package configuration for libffi is not found
"gcc -o conftest -I/usr/include -I/usr/include/ruby/backward -I/usr/include -I.    -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -mtune=generic -fPIC conftest.c  -L. -L/usr/lib64 -L. -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fstack-protector -rdynamic -Wl,-export-dynamic  -m64   -lruby  -lpthread -ldl -lcrypt -lm   -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

PS: I have ruby 2.2.5p319 (2016-04-26 revision 54774) [x86_64-linux] and gem 2.6.4 and ruby-devel-2.2.5-48.fc23.x86_64 PS:我有ruby 2.2.5p319 (2016-04-26 revision 54774) [x86_64-linux]gem 2.6.4ruby-devel-2.2.5-48.fc23.x86_64

With CentOS 6 & 7 you can encounter the same issue, even if you have installed ruby && ruby-devel. 使用CentOS 6和7,即使安装了ruby && ruby​​-devel,也可能遇到相同的问题。

To solve this, install gcc & make. 要解决此问题,请安装gcc&make。

I solved the issue by installing RVM. 我通过安装RVM解决了该问题。 it automatically installed Ruby 2.3.0 and then i tried gem install jekyll, and it installed successfully. 它自动安装了Ruby 2.3.0,然后我尝试了gem install jekyll,并且安装成功。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 "<i>&quot;ERROR: Failed to build gem native extension.&quot;<\/i> “错误:无法构建 gem 原生扩展。”<\/b> <i>while installing Rails<\/i>在安装 Rails 时<\/b>" - "ERROR: Failed to build gem native extension." while installing Rails 安装gem给出“无法构建gem原生扩展”。 - Install gem gives “Failed to build gem native extension.” 错误:安装jekyll时出错:错误:无法构建gem原生扩展 - ERROR: Error installing jekyll: ERROR: Failed to build gem native extension 安装 jekyll 时出错:错误:无法构建 gem 原生扩展 - Error installing jekyll: ERROR: Failed to build gem native extension 尝试在Mac OSX上安装ruby gem时出现错误:“无法构建gem本机扩展。” - Trying to install a ruby gem on Mac OSX gives me an error: “Failed to build gem native extension.” nokogiri gem - 错误:无法构建 gem 本机扩展。 - nokogiri gem - ERROR: Failed to build gem native extension. 错误:安装json时出错:错误:无法构建gem本机扩展。 Windows 10 - ERROR: Error installing json: ERROR: Failed to build gem native extension. Windows 10 错误:安装mysql2时出错:错误:无法构建gem原生扩展。 在Mac 10.12上 - ERROR: Error installing mysql2: ERROR: Failed to build gem native extension. on Mac 10.12 错误:安装 nokogiri 时出错:错误:无法构建 gem 原生扩展。 苹果系统 - ERROR: Error installing nokogiri: ERROR: Failed to build gem native extension. MacOS 如何修复“错误:无法构建 gem 本机扩展。” 安装 cocoapods 时出错? - How do I fix the “ERROR: Failed to build gem native extension.” error when installing cocoapods?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM