Shahrzad
Shahrzad

Reputation: 207

Error in "bundle install"

I get this error when I run "bundle install"

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.

I get the same error after I run gem install linecache19 -v '0.5.12'!

I search for the error but non of the solutions worked!

when I run "chown -R jenkins /var/lib/jenkins/.rvm" I get this error:

chown: changing ownership of `/var/lib/jenkins/.rvm/src/rubygems-1.8.21/lib/rubygems/ext': Operation not permitted

chown: changing ownership of `/var/lib/jenkins/.rvm/src/rubygems-1.8.21/lib/rubygems/test_case.rb': Operation not permitted

chown: changing ownership of `/var/lib/jenkins/.rvm/src/rubygems-1.8.21/lib/rubygems/deprecate.rb': Operation not permitted

chown: changing ownership of `/var/lib/jenkins/.rvm/src/rubygems-1.8.21/lib/rubygems/commands/update_command.rb': Operation not permitted

chown: changing ownership of `/var/lib/jenkins/.rvm/src/rubygems-1.8.21/lib/rubygems/commands/outdated_command.rb': Operation not permitted

chown: changing ownership of `/var/lib/jenkins/.rvm/src/rubygems-1.8.21/lib/rubygems/commands/uninstall_command.rb': Operation not permitted

chown: changing ownership of `/var/lib/jenkins/.rvm/src/rubygems-1.8.21/lib/rubygems/commands/fetch_command.rb': Operation not permitted
.....

when I run the command with sudo nothing happens!

Upvotes: 1

Views: 3738

Answers (2)

Michael Slade
Michael Slade

Reputation: 13877

This is a case of the missing header files.

You need to find or download a copy of the ruby sources for your version of ruby, and then

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

The re-run bundle install.

Upvotes: 3

Holger Just
Holger Just

Reputation: 55888

The important line is this one:

/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)

Apparently, the user can not write to that directory. You should make sure that /var/lib/jenkins/.rvm and all child objects is owned by the jenkins user. Assuming it is jenkins you could run

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

Upvotes: 0

Related Questions