ruby / ruby/rubygems

Bundler is unable to require path/git gem during installation of other gems.

Open
#5,249 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bundler type: feature request
Dominant language
Ruby
Stars
4k
Forks
1.9k
Avg merge
1d 2h
Merged PRs (30d)
81

Description

Describe the problem as clearly as you can

For my current project I have a transitive dependency that needs patching.

explicitly specifying the transitive dependency through a git/file gem makes the installation process break.

I have included a minimal Gemfile that reproduces this issue.

If I do not include the gem that has the transitive dependency I can require it just fine after a bundle exec.

Did you try upgrading rubygems & bundler?
Post steps to reproduce the problem

Gemfile:

# frozen_string_literal: true

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '3.0.3'

# Multiple gems try installing system dependencies interactivly, patch their dependency to always fail
gem 'native-package-installer', git: 'https://github.com/Herdinger/native-package-installer'
gem 'pango', '~> 3.4'
Which command did you run?

bundle install

What were you expecting to happen?

glib2 to use my version of native-package-installe

What actually happened?
Fetching https://github.com/Herdinger/native-package-installer
Fetching gem metadata from https://rubygems.org/....
Resolving dependencies...
Using bundler 2.3.4
Fetching matrix 0.4.2
Fetching pkg-config 1.4.6
Using native-package-installer 1.1.2 from https://github.com/Herdinger/native-package-installer (at master@60cba8a)
Installing matrix 0.4.2
Installing pkg-config 1.4.6
Fetching red-colors 0.3.0
Fetching glib2 3.4.9
Installing red-colors 0.3.0
Installing glib2 3.4.9 with native extensions
Fetching cairo 1.17.5
Installing cairo 1.17.5 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/herdinger/projects/kindle_hacks/scheduler/testproj/vendor/bundle/ruby/3.0.0/gems/cairo-1.17.5/ext/cairo
/Users/herdinger/.rbenv/versions/3.0.3/bin/ruby -I /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0 -r ./siteconf20220103-24399-kbt28r.rb extconf.rb
*** 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=/Users/herdinger/.rbenv/versions/3.0.3/bin/$(RUBY_BASE_NAME)
<internal:/Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- native-package-installer (LoadError)
	from <internal:/Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from extconf.rb:10:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /Users/herdinger/projects/kindle_hacks/scheduler/testproj/vendor/bundle/ruby/3.0.0/gems/cairo-1.17.5 for inspection.
Results logged to /Users/herdinger/projects/kindle_hacks/scheduler/testproj/vendor/bundle/ruby/3.0.0/extensions/x86_64-darwin-21/3.0.0/cairo-1.17.5/gem_make.out

  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/rubygems/ext/builder.rb:95:in `run'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/rubygems/ext/ext_conf_builder.rb:47:in `block in build'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/3.0.0/tempfile.rb:317:in `open'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/rubygems/ext/ext_conf_builder.rb:26:in `build'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/rubygems/ext/builder.rb:161:in `build_extension'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/rubygems/ext/builder.rb:195:in `block in build_extensions'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/rubygems/ext/builder.rb:192:in `each'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/rubygems/ext/builder.rb:192:in `build_extensions'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/rubygems/installer.rb:847:in `build_extensions'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/bundler/rubygems_gem_installer.rb:71:in `build_extensions'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/bundler/rubygems_gem_installer.rb:28:in `install'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/bundler/source/rubygems.rb:204:in `install'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/bundler/installer/gem_installer.rb:54:in `install'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/bundler/installer/parallel_installer.rb:186:in `do_install'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/bundler/installer/parallel_installer.rb:177:in `block in worker_pool'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/bundler/worker.rb:62:in `apply_func'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/bundler/worker.rb:57:in `block in process_queue'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/bundler/worker.rb:54:in `loop'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/bundler/worker.rb:54:in `process_queue'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/bundler/worker.rb:91:in `block (2 levels) in create_threads'

An error occurred while installing cairo (1.17.5), and Bundler cannot continue.

In Gemfile:
  pango was resolved to 3.4.9, which depends on
    cairo-gobject was resolved to 3.4.9, which depends on
      cairo


Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/herdinger/projects/kindle_hacks/scheduler/testproj/vendor/bundle/ruby/3.0.0/gems/glib2-3.4.9/ext/glib2
/Users/herdinger/.rbenv/versions/3.0.3/bin/ruby -I /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0 -r ./siteconf20220103-24399-u9oynq.rb extconf.rb
*** 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=/Users/herdinger/.rbenv/versions/3.0.3/bin/$(RUBY_BASE_NAME)
<internal:/Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- native-package-installer (LoadError)
	from <internal:/Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /Users/herdinger/projects/kindle_hacks/scheduler/testproj/vendor/bundle/ruby/3.0.0/gems/glib2-3.4.9/lib/mkmf-gnome.rb:21:in `<top (required)>'
	from <internal:/Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from extconf.rb:27:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /Users/herdinger/projects/kindle_hacks/scheduler/testproj/vendor/bundle/ruby/3.0.0/gems/glib2-3.4.9 for inspection.
Results logged to /Users/herdinger/projects/kindle_hacks/scheduler/testproj/vendor/bundle/ruby/3.0.0/extensions/x86_64-darwin-21/3.0.0/glib2-3.4.9/gem_make.out

  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/rubygems/ext/builder.rb:95:in `run'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/rubygems/ext/ext_conf_builder.rb:47:in `block in build'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/3.0.0/tempfile.rb:317:in `open'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/rubygems/ext/ext_conf_builder.rb:26:in `build'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/rubygems/ext/builder.rb:161:in `build_extension'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/rubygems/ext/builder.rb:195:in `block in build_extensions'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/rubygems/ext/builder.rb:192:in `each'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/rubygems/ext/builder.rb:192:in `build_extensions'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/rubygems/installer.rb:847:in `build_extensions'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/bundler/rubygems_gem_installer.rb:71:in `build_extensions'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/bundler/rubygems_gem_installer.rb:28:in `install'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/bundler/source/rubygems.rb:204:in `install'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/bundler/installer/gem_installer.rb:54:in `install'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/bundler/installer/parallel_installer.rb:186:in `do_install'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/bundler/installer/parallel_installer.rb:177:in `block in worker_pool'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/bundler/worker.rb:62:in `apply_func'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/bundler/worker.rb:57:in `block in process_queue'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/bundler/worker.rb:54:in `loop'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/bundler/worker.rb:54:in `process_queue'
  /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/site_ruby/3.0.0/bundler/worker.rb:91:in `block (2 levels) in create_threads'

An error occurred while installing glib2 (3.4.9), and Bundler cannot continue.

In Gemfile:
  pango was resolved to 3.4.9, which depends on
    cairo-gobject was resolved to 3.4.9, which depends on
      glib2
If not included with the output of your command, run bundle env and paste the output below

Environment

Bundler       2.3.4
  Platforms   ruby, x86_64-darwin-21
Ruby          3.0.3p157 (2021-11-24 revision 3fb7d2cadc18472ec107b14234933b017a33c14d) [x86_64-darwin21]
  Full Path   /Users/herdinger/.rbenv/versions/3.0.3/bin/ruby
  Config Dir  /Users/herdinger/.rbenv/versions/3.0.3/etc
RubyGems      3.3.4
  Gem Home    /Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0
  Gem Path    /Users/herdinger/.gem/ruby/3.0.0:/Users/herdinger/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0
  User Home   /Users/herdinger
  User Path   /Users/herdinger/.gem/ruby/3.0.0
  Bin Dir     /Users/herdinger/.rbenv/versions/3.0.3/bin
Tools
  Git         2.34.1
  RVM         not installed
  rbenv       rbenv 1.2.0
  chruby      not installed

Bundler Build Metadata

Built At          2021-12-29
Git SHA           2296a0d6cc
Released Version  true

Bundler settings

gem.changelog
  Set for the current user (/Users/herdinger/.bundle/config): false
gem.ci
  Set for the current user (/Users/herdinger/.bundle/config): false
gem.coc
  Set for the current user (/Users/herdinger/.bundle/config): false
gem.linter
  Set for the current user (/Users/herdinger/.bundle/config): false
gem.mit
  Set for the current user (/Users/herdinger/.bundle/config): true
gem.test
  Set for the current user (/Users/herdinger/.bundle/config): false
path
  Set for your local app (/Users/herdinger/projects/kindle_hacks/scheduler/testproj/.bundle/config): "vendor/bundle"

Gemfile

Gemfile
# frozen_string_literal: true

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '3.0.3'

# Multiple gems try installing system dependencies interactivly, patch their dependency to always fail
gem 'native-package-installer', git: 'https://github.com/Herdinger/native-package-installer'
gem 'pango', '~> 3.4'
Gemfile.lock
GEM
  remote: https://rubygems.org/
  specs:

PLATFORMS
  x86_64-darwin-21

DEPENDENCIES

RUBY VERSION
   ruby 3.0.3p157

BUNDLED WITH
   2.3.4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied Gemfile and reproduce the failure using bundle install. Trace the require failure through Bundler's parallel installer and gem installer entries shown in the stack trace, then verify that installation completes and glib2 uses the explicitly selected native-package-installer dependency.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.