2016-12-10 44 views
0

安裝傑奇我安裝Ruby和Ruby寶石,更新他們兩個,嘗試使用命令無法在薄荷

sudo gem install jekyll bundler 

安裝傑基爾它給了我這個

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

    current directory: /var/lib/gems/2.3.0/gems/ffi-1.9.14/ext/ffi_c 
/usr/bin/ruby2.3 -r ./siteconf20161209-4826-wdshax.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}/lib 
    --with-make-prog 
    --without-make-prog 
    --srcdir=. 
    --curdir 
    --ruby=/usr/bin/$(RUBY_BASE_NAME)2.3 
    --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}/lib 
    --with-libffi-config 
    --without-libffi-config 
    --with-pkg-config 
    --without-pkg-config 
/usr/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError) 
You have to install development tools first. 
    from /usr/lib/ruby/2.3.0/mkmf.rb:587:in `try_cpp' 
    from /usr/lib/ruby/2.3.0/mkmf.rb:1091:in `block in have_header' 
    from /usr/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for' 
    from /usr/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in postpone' 
    from /usr/lib/ruby/2.3.0/mkmf.rb:320:in `open' 
    from /usr/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone' 
    from /usr/lib/ruby/2.3.0/mkmf.rb:320:in `open' 
    from /usr/lib/ruby/2.3.0/mkmf.rb:346:in `postpone' 
    from /usr/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for' 
    from /usr/lib/ruby/2.3.0/mkmf.rb:1090: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: 

    /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/ffi-1.9.14/mkmf.log 

extconf failed, exit code 1 

Gem files will remain installed in /var/lib/gems/2.3.0/gems/ffi-1.9.14 for inspection. 
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/ffi-1.9.14/gem_make.out 
Successfully installed bundler-1.13.6 
Parsing documentation for bundler-1.13.6 
Done installing documentation for bundler after 7 seconds 
1 gem installed 

這裏是什麼它在日誌文件中說:

package configuration for libffi is not found 
"gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.3.0 -I/usr/include/ruby-2.3.0/ruby/backward -I/usr/include/ruby-2.3.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC conftest.c -L. -L/usr/lib/x86_64-linux-gnu -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic  -lruby-2.3 -lpthread -lgmp -ldl -lcrypt -lm -lc" 
In file included from /usr/include/ruby-2.3.0/ruby/ruby.h:36:0, 
       from /usr/include/ruby-2.3.0/ruby.h:33, 
       from conftest.c:1: 
/usr/include/ruby-2.3.0/ruby/defines.h:26:19: fatal error: stdio.h: No such file or directory 
compilation terminated. 
checked program was: 
/* begin */ 
1: #include "ruby.h" 
2: 
3: int main(int argc, char **argv) 
4: { 
5: return 0; 
6: } 
/* end */ 

我正在運行Linux Mint,但我找不到任何東西來解決此問題。 jekyll的一個gem已經安裝好了,我可以創建jekyll項目,但只能部分完成,我不能在我的本地主機上運行它並進行編輯。

還有其他問題讓我知道,我會盡我所能幫助提供詳細信息。

+1

** 1)**你不應該需要使用'sudo'安裝寶石。 Ruby gems安裝在用戶空間中。 ** 2nd)**運行'apt-get install build-essential'來安裝在Mint框中生成程序所需的所有軟件包。 –

+1

我不能使用簡單的寶石,我需要安裝sudo gem,否則會給我一個權限錯誤。 –

+0

發生這種情況的可能原因是,您正在使用Linux發行版提供的Ruby包。這根本不好。您應該使用** rvm **或** rbenv **在用戶空間安裝Ruby。這是最好的程序。 –

回答

0

我對Linux Mint的同樣的問題18.安裝建立必要的解決了這個問題:

sudo apt-get install build-essential