2016-01-22 48 views
0

首先,我嘗試: gem install railsRubyGems的建築原生擴展Fedora的失敗23

它產生:使用sudo dnf install ruby-devel還與rvm requirements試過

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

    /usr/bin/ruby extconf.rb 
checking if the C compiler accepts ... *** 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) 
    --help 
    --clean 
/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:571:in `block in try_compile' 
    from /usr/share/ruby/mkmf.rb:522:in `with_werror' 
    from /usr/share/ruby/mkmf.rb:571:in `try_compile' 
    from extconf.rb:80:in `nokogiri_try_compile' 
    from extconf.rb:87:in `block in add_cflags' 
    from /usr/share/ruby/mkmf.rb:619:in `with_cflags' 
    from extconf.rb:86:in `add_cflags' 
    from extconf.rb:336:in `<main>' 


Gem files will remain installed in /home/hagoth/.gem/ruby/gems/nokogiri-1.6.7.2 for inspection. 
Results logged to /home/hagoth/.gem/ruby/gems/nokogiri-1.6.7.2/ext/nokogiri/gem_make.out 

我已經安裝了開發工具和我花了過去五個小時左右在線嘗試其他晦澀難懂的解決方案。他們似乎都沒有工作。有一些簡單明顯的解決方案,我錯過了嗎?我很確定依賴關係在那裏。雖然我可能是錯的。

運行32位版本的Fedora 23如果這意味着什麼。

更新:

/home/username/.gem/ruby/gems/nokogiri-1.6.7.2/ext/nokogiri/mkmf.log內容是:

"gcc -o conftest -I/usr/include -I/usr/include/ruby/backward -I/usr/include -I. -D_FILE_OFFSET_BITS=64 -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 -march=i686 -mtune=atom -fasynchronous-unwind-tables -fPIC conftest.c -L. -L/usr/lib -L. -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fstack-protector -rdynamic -Wl,-export-dynamic -m32 -lruby -lpthread -ldl -lcrypt -lm -lc " 
gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory 
checked program was: 
/* begin */ 
1: #include "ruby.h" 
2: 
3: int main(int argc, char **argv) 
4: { 
5: return 0; 
6: } 
/* end */ 
+0

我知道在Stackoverflow上有很多這種性質的問題。我見過的大多數人都沒有解決我的問題,並與解決依賴關係有關。 – 0112

+0

說'檢查mkmf.log文件以獲得更多細節。「_that_說什麼? – mattdm

+0

@mattdm加入問題 – 0112

回答

5

我不是很肯定爲什麼包的構建腳本正在尋找特定文件無法找到,但它是由redhat-rpm-config包提供的。我很確定這應該在Fedora Workstation上默認。在任何情況下,因爲你是你的系統上開發軟件,我建議確保以下組安裝:

sudo dnf groupinstall development-tools rpm-development-tools c-development 

,將解決這方面的問題,並確保你有其他的基本的「原生」建立安裝的基礎設施工具。

+1

我其實剛剛解決了它。使用此鏈接的信息:https://developer.fedoraproject.org/tech/languages/ruby/gems-installation.html – 0112

+0

它有一種效果。我會把它交給你。 – 0112

-1

我除了@mattdm的答案,它解決了失敗的:

vagrant plugin install vagrant-livbirt

原因有一些包的依賴問題。所以使用上述命令將解決這個問題!