Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

Error installing gems with native extensions #966

Closed
coderanger opened this issue Aug 9, 2016 · 6 comments
Closed

Error installing gems with native extensions #966

coderanger opened this issue Aug 9, 2016 · 6 comments

Comments

@coderanger
Copy link
Contributor

Trying to use ChefDK's gem to install something with a native extension (e.g. unf_ext, a dependency of kitchen-openstack) will currently fail. I'm still debugging but wanted to checkpoint my brain to a ticket.

The error is some variation on Permission denied @ dir_s_mkdir - /opt/chefdk/embedded/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0/gemname-version. This is happening because the Rubygems is not recognizing the non-ext gem files installed to the user dir and so falls back to the default GEM_HOME for the extension install. This does not happen with a vanilla gem install --user so it has to be something related to our customizations.

To repro: install ChefDK, create a non-root user, switch to the user, run /opt/chefdk/embedded/bin/gem install --user native-gem.

@coderanger
Copy link
Contributor Author

From ChefDK's gem:

WARNING:  You don't have /home/testing/.chefdk/gem/ruby/2.1.0/bin in your PATH,
      gem executables will not run.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$ full_name = native-gem-0.0.1
$ loaded_from =
$ default_gem? = nil
$ Gem.dir = /opt/chefdk/embedded/lib/ruby/gems/2.1.0

From vanilla ruby:

WARNING:  You don't have /home/testing/.gem/ruby/2.3.0/bin in your PATH,
      gem executables will not run.
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$ loaded_from = /home/testing/.gem/ruby/2.3.0/specifications/native-gem-0.0.1.gemspec
$ default_gem? = false
$ Gem.dir = /var/lib/gems/2.3.0

That's debug logging added to Gem::Specification#base_dir.

@coderanger
Copy link
Contributor Author

I am derp, my "vanilla rubygems" test was using 2.5.1 instead of 2.6.6, can confirm this is broken upstream in 2.6.6.

@coderanger
Copy link
Contributor Author

Okay, so upon more detailed testing I can say this broke between Rubygems 2.6.4 and 2.6.5.

@coderanger
Copy link
Contributor Author

Already submitted upstream as rubygems/rubygems#1680

jkeiser added a commit that referenced this issue Aug 17, 2016
@jhenry82
Copy link

jhenry82 commented Aug 29, 2016

Is this fix present in chefdk 0.17.17? I need to install a gem with native extensions (eventmachine) and am not able to do so due to this issue.

If it's not released yet, is there a workaround I can use to get the gem installed?

$ chef gem install eventmachine
WARNING:  You don't have /Users/jhenry/.chefdk/gem/ruby/2.1.0/bin in your PATH,
          gem executables will not run.
Building native extensions.  This could take a while...
ERROR:  While executing gem ... (Errno::EACCES)
    Permission denied @ rb_sysopen - /opt/chefdk/embedded/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-13/2.1.0/eventmachine-1.2.0.1/gem_make.out

edit: downgrading to chefdk 0.15.15 worked around the problem for now

@troyready
Copy link

Works for me now in my chef shell-init bash shell with just gem install foo (but not chef gem install foo) -- I assume this is expected.

openstack-gerrit pushed a commit to openstack-archive/cookbook-openstack-ops-database that referenced this issue Sep 29, 2016
- Bump mysql to 7.2
- Bump mysql2_chef_gem to 1.1.0
- Work around chef-boneyard/chef-dk#966
- fixes minor bug in postgres-server_spec and server_spec

Change-Id: I6e906c5fad0360a7d9718fc5d5cda2983c3b768e
Depends-On: I07ad79a93642d0f0c934a864fcb9bcd7b764e35f
Implements: blueprint newton-xenial
openstack-gerrit pushed a commit to openstack-archive/cookbook-openstack-ops-database that referenced this issue Dec 20, 2016
Change-Id: I0717e97c3effaffebb19e63ec6a78f2e1b7aa80d
@chef-boneyard chef-boneyard locked and limited conversation to collaborators Feb 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants