Find Out Which Gems Require Native C Extensions from a Gemfile

Find out which gems require native c extensions from a Gemfile?

You can use JRuby Lint for that. It will will check for some gems requiring C extension and even list alternative (based on this list).

Gem::Ext::BuildError: ERROR: Failed to build gem native extension on macOS Monterey

It turns out the problem was that in the Gemfile.lock file, it was locked to using an older version of bundler. We simply deleted the Gemfile.lock, and re-ran bundle to regenerate Gemfile.lock. That solved it. It now says this at the bottom of the Gemfile.lock file, so it liked this version of bundler:

BUNDLED WITH
2.3.9

How to find where gem files are installed

Use gem environment to find out about your gem environment:

RubyGems Environment:
- RUBYGEMS VERSION: 2.1.5
- RUBY VERSION: 2.0.0 (2013-06-27 patchlevel 247) [x86_64-darwin12.4.0]
- INSTALLATION DIRECTORY: /Users/ttm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0
- RUBY EXECUTABLE: /Users/ttm/.rbenv/versions/2.0.0-p247/bin/ruby
- EXECUTABLE DIRECTORY: /Users/ttm/.rbenv/versions/2.0.0-p247/bin
- SPEC CACHE DIRECTORY: /Users/ttm/.gem/specs
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-12
- GEM PATHS:
- /Users/ttm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0
- /Users/ttm/.gem/ruby/2.0.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/ttm/.rbenv/versions/2.0.0-p247/bin
- /Users/ttm/.rbenv/libexec
- /Users/ttm/.rbenv/plugins/ruby-build/bin
- /Users/ttm/perl5/perlbrew/bin
- /Users/ttm/perl5/perlbrew/perls/perl-5.18.1/bin
- /Users/ttm/.pyenv/shims
- /Users/ttm/.pyenv/bin
- /Users/ttm/.rbenv/shims
- /Users/ttm/.rbenv/bin
- /Users/ttm/bin
- /usr/local/mysql-5.6.12-osx10.7-x86_64/bin
- /Users/ttm/libsmi/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /usr/local/bin

Notice the two sections for:

  • INSTALLATION DIRECTORY
  • GEM PATHS

How to change bundle install from default to my project gemfile?

It's not installing "default" packages. It is installing the packages in your Gemfile and the dependencies of those packages. If you see that it's installing packages that you didn't specify in your Gemfile, it's because those packages are dependencies of one or more of the packages in your Gemfile.

From the bundle install documentation:

Install the dependencies specified in your Gemfile

...Bundler will fetch all remote sources, resolve dependencies and
install all needed gems.

You can use the gem dependency command with the --reverse-dependencies flag to see why a gem was installed. In your case use, for example, gem dependency CFPropertyList --reverse-dependencies to see why the CFPropertyList gem was installed. At the very bottom of the output of the command it will tell you which package required it as a dependency.

You can also check your Gemfile.lock file after you've run bundle install to see the list of packages you have installed and their dependencies. Under the specs header you'll see a list of all the packages that was installed. Some of the packages have a list of indented packages underneath them. Those are the dependencies of the package.

For example, let's see why the to_boolean package was installed:

specs:
android-adb-extension (0.1.2)
to_boolean (~> 1.0)

You had the android-adb-extension as a dependency in your Gemfile and if we check the android-adb-extension page on rubygems, we see that to_boolean it's (only) run-time dependency.



Related Topics



Leave a reply



Submit