2012-04-11 182 views
1

我得到這個錯誤,當我運行「捆綁安裝」錯誤「捆綁安裝」

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. 

     /var/lib/jenkins/.rvm/rubies/ruby-1.9.2-p318/bin/ruby extconf.rb 
checking for vm_core.h... no 

checking for vm_core.h... no 

*** 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 
    --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=/var/lib/jenkins/.rvm/rubies/ruby-1.9.2-p318/bin/ruby 
    --with-ruby-dir 
    --without-ruby-dir 
    --with-ruby-include 
    --without-ruby-include=${ruby-dir}/include 
    --with-ruby-lib 
    --without-ruby-lib=${ruby-dir}/lib 
/var/lib/jenkins/.rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/fileutils.rb:243:in `mkdir': Permission denied - /var/lib/jenkins/.rvm/rubies/ruby-1.9.2-p318/include/ruby-1.9.1/ruby-1.9.2-p318 (Errno::EACCES) 
    from /var/lib/jenkins/.rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/fileutils.rb:243:in `fu_mkdir' 
    from /var/lib/jenkins/.rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/fileutils.rb:217:in `block (2 levels) in mkdir_p' 
    from /var/lib/jenkins/.rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/fileutils.rb:215:in `reverse_each' 
    from /var/lib/jenkins/.rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/fileutils.rb:215:in `block in mkdir_p' 
    from /var/lib/jenkins/.rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/fileutils.rb:201:in `each' 
    from /var/lib/jenkins/.rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/fileutils.rb:201:in `mkdir_p' 
    from /var/lib/jenkins/.rvm/gems/ruby-1.9.2-p318/gems/ruby_core_source-0.1.5/lib/ruby_core_source.rb:59:in `block in create_makefile_with_core' 
    from /var/lib/jenkins/.rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/tempfile.rb:320:in `open' 
    from /var/lib/jenkins/.rvm/gems/ruby-1.9.2-p318/gems/ruby_core_source-0.1.5/lib/ruby_core_source.rb:51:in `create_makefile_with_core' 
    from extconf.rb:19:in `<main>' 
Requesting http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p318.tar.gz 
Downloading http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p318.tar.gz 


Gem files will remain installed in /var/lib/jenkins/.bundler/tmp/19915/gems/linecache19-0.5.12 for inspection. 
Results logged to /var/lib/jenkins/.bundler/tmp/19915/gems/linecache19-0.5.12/ext/trace_nums/gem_make.out 
An error occured while installing linecache19 (0.5.12), and Bundler cannot continue. 
Make sure that `gem install linecache19 -v '0.5.12'` succeeds before bundling. 

我得到同樣的錯誤我跑gem install linecache19 -v '0.5.12'後!

我搜索錯誤,但沒有解決方案的工作!

我跑的時候

「喬敦 - R的詹金斯/var/lib/jenkins/.rvm」 我得到這個錯誤:

CHOWN:改變`/var/lib/jenkins/.rvm/src/rubygems的所有權-1.8.21/lib/ruby​​gems/ext':不允許操作

chown:更改`/var/lib/jenkins/.rvm/src/rubygems-1.8.21/lib/rubygems/test_case.rb的所有權':操作不允許

CHOWN:`/var/lib/jenkins/.rvm/src/rubygems-1.8.21/lib/rubygems/deprecate.rb的改變所有權':操作不允許

CHOWN:改變`/var/lib/jenkins/.rvm/src/rubygems-1.8.21/lib/rubygems/commands/update_command.rb'的所有權:操作不允許

CHOWN:改變`所有權/var/lib/jenkins/.rvm/src/rubygems-1.8.21/lib/rubygems/commands/outdated_command.rb':不允許操作

chown:更改`/ var/lib/jenkins /的所有權。 rvm/src/ruby​​gems-1.8.21/lib/ruby​​gems/commands/uninstall_command.rb':不允許操作

chown:改變`/var/lib/jenkins/.rvm/src/rubygems-1.8的所有權。 21/lib/ruby​​gems/commands/fetch_command.rb':不允許操作
.....

當我用sudo運行命令什麼也沒有發生!

回答

0

重要的線是這個:

/var/lib/jenkins/.rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/fileutils.rb:243:in `mkdir': Permission denied - /var/lib/jenkins/.rvm/rubies/ruby-1.9.2-p318/include/ruby-1.9.1/ruby-1.9.2-p318 (Errno::EACCES) 

顯然,用戶無法寫入該目錄。您應該確保/var/lib/jenkins/.rvm和所有子對象都歸詹金斯用戶所有。假設它是jenkins你可以運行

chown -R jenkins /var/lib/jenkins/.rvm 
chmod -R u+rX /var/lib/jenkins/.rvm 
+0

感謝您的回答。我在我的問題中添加了運行chown -R jenkins /var/lib/jenkins/.rvm的結果!我仍然有問題! :( – Shahrzad 2012-04-11 22:46:32

+0

@Sherry - 你可能需要在命令前面加上「sudo」,比如「sudo chown -R jenkins /var/lib/jenkins/.rvm」 – 2012-04-11 23:46:14

+0

我沒有輸出! – Shahrzad 2012-04-11 23:57:47

3

這是缺少頭文件的情況。

你需要找到或下載的紅寶石源副本的紅寶石版本,然後

gem install ruby-debug19 -- --with-ruby-include=path/to/ruby/source/ 

重新運行bundle install

+0

感謝Micheal!:)它幫了我很多:) – Shahrzad 2012-04-11 23:53:11