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'

我搜索错误,但没有解决方案有效!

当我运行“chown -R jenkins /var/lib/jenkins/.rvm”时,我收到此错误:

chown:更改“/var/lib/jenkins/.rvm/src/rubygems-1.8.21/lib/rubygems/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/rubygems-1.8.21/lib/rubygems/commands/uninstall_command.rb”的所有权:不允许操作

chown:更改“/var/lib/jenkins/.rvm/src/rubygems-1.8.21/lib/rubygems/commands/fetch_command.rb”的所有权:不允许操作
.....

当我用 sudo 运行命令时,什么也没有发生!

4

2 回答 2

3

这是缺少头文件的情况。

您需要为您的 ruby​​ 版本查找或下载 ruby​​ 源代码的副本,然后

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

重新运行bundle install

于 2012-04-11T23:13:37.840 回答
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 用户所有。假设它是jenkins你可以运行

chown -R jenkins /var/lib/jenkins/.rvm
chmod -R u+rX /var/lib/jenkins/.rvm
于 2012-04-11T22:02:56.513 回答