2016-06-20 106 views
0

我有一個全新安裝的fedora。我安裝了ruby,ruby-devel,並在他們的網站上經歷了jekyll故障排除,但我仍然得到相同的錯誤。我嘗試安裝另一個寶石,這是Sass,只是爲了確保它不是ruby問題,併成功安裝。從mkmf.log安裝jekyll給出了返回錯誤(無法構建gem原生擴展。)

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 

信息:

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:我有ruby 2.2.5p319 (2016-04-26 revision 54774) [x86_64-linux]gem 2.6.4ruby-devel-2.2.5-48.fc23.x86_64

+0

您是否嘗試過先安裝開發工具? 'xcode-select --install' – etagwerker

+0

@etagwerker我沒有使用OSX。 –

+0

好吧,然後我會嘗試一次安裝一個必需的庫,或者使用autolibs安裝RVM:https://rvm.io/rvm/autolibs – etagwerker

回答

0

我通過安裝RVM解決的問題。它會自動安裝Ruby 2.3.0,然後我嘗試gem install jekyll,併成功安裝。

1

在CentOS 6 & 7可能會遇到同樣的問題,即使你已經安裝了Ruby & &紅寶石devel的。

要解決這個問題,請安裝gcc & make。

相關問題