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

Error during bundle install "Unable to find a spec ffi" #6079

Closed
goley opened this issue Oct 6, 2017 · 7 comments · Fixed by #6288
Closed

Error during bundle install "Unable to find a spec ffi" #6079

goley opened this issue Oct 6, 2017 · 7 comments · Fixed by #6288
Assignees

Comments

@goley
Copy link

goley commented Oct 6, 2017

The bundler command does not work in one of our teamcity agents (although its configuration is similar to other agents). It says that it can't find an ffi spec, but it's present in Gemfile.lock.

Error Report

  • What did you do?
    I ran the command C:/Ruby21-x64/bin/bundle install

  • What did you expect to happen?
    I expected Bundler to install the gems

  • What happened instead?
    Instead, what happened was that the bundler through an error saying can't find the spec for ffi, which is actually mentioned in the Gemfile. I can see the folder for the gem ffi (1.9.10-x86-mingw32) in the gems folder too. (C:\Ruby21-x64\lib\ruby\gems\2.1.0\gems\ffi-1.9.10-x64-mingw32)

Backtrace

RuntimeError: Unable to find a spec satisfying ffi (>= 0.5.0) in the set. Perhaps the lockfile is corrupted?
  C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.15.4/lib/bundler/spec_set.rb:39:in `block in for'
  C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.15.4/lib/bundler/spec_set.rb:24:in `loop'
  C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.15.4/lib/bundler/spec_set.rb:24:in `for'
  C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.15.4/lib/bundler/spec_set.rb:79:in `materialize'
  C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.15.4/lib/bundler/definition.rb:199:in `missing_dependencies'
  C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.15.4/lib/bundler/installer.rb:219:in `block in resolve_if_need'
  C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.15.4/lib/bundler/ui/shell.rb:127:in `with_level'
  C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.15.4/lib/bundler/ui/shell.rb:86:in `silence'
  C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.15.4/lib/bundler/installer.rb:216:in `resolve_if_need'
  C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.15.4/lib/bundler/installer.rb:78:in `run'
  C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.15.4/lib/bundler/installer.rb:24:in `install'
  C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.15.4/lib/bundler/cli/install.rb:68:in `run'
  C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.15.4/lib/bundler/cli.rb:188:in `block in install'
  C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.15.4/lib/bundler/settings.rb:92:in `temporary'
  C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.15.4/lib/bundler/cli.rb:187:in `install'
  C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.15.4/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
  C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.15.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
  C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.15.4/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
  C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.15.4/lib/bundler/cli.rb:22:in `dispatch'
  C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.15.4/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
  C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.15.4/lib/bundler/cli.rb:13:in `start'
  C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.15.4/exe/bundle:30:in `block in <top (required)>'
  C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.15.4/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
  C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.15.4/exe/bundle:22:in `<top (required)>'
  C:/Ruby21-x64/bin/bundle:23:in `load'
  C:/Ruby21-x64/bin/bundle:23:in `<main>'

Environment

Bundler   1.15.4
Rubygems  2.2.5
Ruby      2.1.9p490 (2016-03-30 revision 54437) [x64-mingw32]
GEM_HOME  C:/Ruby21-x64/lib/ruby/gems/2.1.0
GEM_PATH  C:/Ruby21-x64/lib/ruby/gems/2.1.0;c:/Go/.gem/ruby/2.1.0
Git       1.9.5.msysgit.0
Platform  x64-mingw32
OpenSSL   OpenSSL 1.0.1l 15 Jan 2015

Gemfile

Gemfile

source 'http://rubygems.org'

gem 'albacore' , '2.2.0'
gem 'version_bumper'
gem 'nokogiri'
gem 'compass', '1.0.3'
gem 'sass-css-importer', '1.0.0.beta.0'
gem 'scss-lint', '0.37.0'

Gemfile.lock

GEM
  remote: http://rubygems.org/
  specs:
    albacore (2.2.0)
      map (~> 6.5)
      nokogiri (~> 1.5)
      rake (~> 10)
      semver2 (~> 3.4)
    chunky_png (1.3.5)
    compass (1.0.3)
      chunky_png (~> 1.2)
      compass-core (~> 1.0.2)
      compass-import-once (~> 1.0.5)
      rb-fsevent (>= 0.9.3)
      rb-inotify (>= 0.9)
      sass (>= 3.3.13, < 3.5)
    compass-core (1.0.3)
      multi_json (~> 1.0)
      sass (>= 3.3.0, < 3.5)
    compass-import-once (1.0.5)
      sass (>= 3.2, < 3.5)
    ffi (1.9.10-x86-mingw32)
    map (6.6.0)
    mini_portile2 (2.0.0)
    multi_json (1.11.2)
    nokogiri (1.6.7.1-x64-mingw32)
      mini_portile2 (~> 2.0.0.rc2)
    nokogiri (1.6.7.1-x86-mingw32)
      mini_portile2 (~> 2.0.0.rc2)
    rainbow (2.1.0)
    rake (10.5.0)
    rb-fsevent (0.9.7)
    rb-inotify (0.9.7)
      ffi (>= 0.5.0)
    sass (3.4.21)
    sass-css-importer (1.0.0.beta.0)
      sass (>= 3.1)
    scss-lint (0.37.0)
      rainbow (~> 2.0)
      sass (~> 3.4.1)
    semver2 (3.4.2)
    version_bumper (0.3.0)

PLATFORMS
  x64-mingw32
  x86-mingw32

DEPENDENCIES
  albacore (= 2.2.0)
  compass (= 1.0.3)
  nokogiri
  sass-css-importer (= 1.0.0.beta.0)
  scss-lint (= 0.37.0)
  version_bumper
@segiddins
Copy link
Member

Yup, this looks like a bug (lockfile only has one of the platforms for ffi). Out of curiosity, can you check if 1.16.0.pre.3 fixes the issue?

@goley
Copy link
Author

goley commented Oct 9, 2017

Yes 1.16.0.pre.3 fixes this problem. But the folder of 1.16.0.pre.3 does not have a bin folder which is causing my build steps to fail. Looks like teamcity agent is attempting to look for that.

@goley
Copy link
Author

goley commented Oct 9, 2017

To temporarily resolve this, I tried copying the bin folder from 1.15.4 to 1.16.0.pre.3 and it worked.

Also, looks like the ffi dependency issue is not completely resolved. It started appearing again. So maybe it is intermittent.

@soundasleep
Copy link

soundasleep commented Jan 20, 2018

I am getting this error a lot on a Travis-ci build, intermittently but failing more often than not. Seems to be occurring with both Bundler 1.16.0 and 1.16.1 and 1.15.3.

'ffi' was listed in my Gemfile.lock with only a single w32 platform (I'm developing on Windows):

GEM
  remote: https://rubygems.org/
  specs:
    ffi (1.9.18-x64-mingw32)    

I tried bundle lock --add-platform ruby and bundle lock --add-platform x86_64-linux but that didn't do anything; they're already listed as platforms in the Gemfile.lock.

My solution was to manually edit the Gemfile.lock and add a non-w32 'ffi' gem manually. Yuck. But now it works.

GEM
  remote: https://rubygems.org/
  specs:
    ffi (1.9.18)
    ffi (1.9.18-x64-mingw32)

@segiddins
Copy link
Member

I wonder if this will fix itself if you remove the x64-mingw32 platform from your lockfile, and run bundle install again. Or alternatively if you run bundle update ffi? The issue seems to be that bundler does not think it needs to run the resolver again to pick up the ffi spec for the local platform

@segiddins
Copy link
Member

Reproduced this, just wondering how x64-mingw32 got into the lockfile without the entry for ffi...

@segiddins
Copy link
Member

Took a while to wrap my head around things, but I hope #6288 will fix this bug! Thanks for bearing with us 🤞

bundlerbot added a commit that referenced this issue Feb 3, 2018
…specs, r=indirect

Gracefully handle when the lockfile is missing spec entries for the current platform

### What was the end-user problem that led to this PR?

The problem was users could get `Unable to find a spec satisfying ... perhaps the lockfile is corrupted?` error messages, particularly when they use multiple platforms.

Fixes #6079.

### What was your diagnosis of the problem?

My diagnosis was the lockfile _was_ indeed corrupted, because it was missing `spec_name (version)` entries, but resolution could still be skipped (preventing those gems from being added back in).

### What is your fix for the problem, implemented in this PR?

My fix checks whether all specs are present _in the lockfile_ (e.g. not locally) for the current platform, and considers that a "change" that forces the resolver to run, allowing those missing specs to be added back to the bundle.

### Why did you choose this fix out of the possible options?

I chose this fix because it was a way to force re-resolution in a way that ties into our existing `#change_reason` infrastructure. Additionally, it shouldn't have much of a performance overhead, since the calculation is only made when we're converging locked specs anyways.
colby-swandale pushed a commit that referenced this issue Apr 11, 2018
…specs, r=indirect

Gracefully handle when the lockfile is missing spec entries for the current platform

### What was the end-user problem that led to this PR?

The problem was users could get `Unable to find a spec satisfying ... perhaps the lockfile is corrupted?` error messages, particularly when they use multiple platforms.

Fixes #6079.

### What was your diagnosis of the problem?

My diagnosis was the lockfile _was_ indeed corrupted, because it was missing `spec_name (version)` entries, but resolution could still be skipped (preventing those gems from being added back in).

### What is your fix for the problem, implemented in this PR?

My fix checks whether all specs are present _in the lockfile_ (e.g. not locally) for the current platform, and considers that a "change" that forces the resolver to run, allowing those missing specs to be added back to the bundle.

### Why did you choose this fix out of the possible options?

I chose this fix because it was a way to force re-resolution in a way that ties into our existing `#change_reason` infrastructure. Additionally, it shouldn't have much of a performance overhead, since the calculation is only made when we're converging locked specs anyways.

(cherry picked from commit 81854e0)
colby-swandale pushed a commit that referenced this issue Apr 20, 2018
…specs, r=indirect

Gracefully handle when the lockfile is missing spec entries for the current platform

### What was the end-user problem that led to this PR?

The problem was users could get `Unable to find a spec satisfying ... perhaps the lockfile is corrupted?` error messages, particularly when they use multiple platforms.

Fixes #6079.

### What was your diagnosis of the problem?

My diagnosis was the lockfile _was_ indeed corrupted, because it was missing `spec_name (version)` entries, but resolution could still be skipped (preventing those gems from being added back in).

### What is your fix for the problem, implemented in this PR?

My fix checks whether all specs are present _in the lockfile_ (e.g. not locally) for the current platform, and considers that a "change" that forces the resolver to run, allowing those missing specs to be added back to the bundle.

### Why did you choose this fix out of the possible options?

I chose this fix because it was a way to force re-resolution in a way that ties into our existing `#change_reason` infrastructure. Additionally, it shouldn't have much of a performance overhead, since the calculation is only made when we're converging locked specs anyways.

(cherry picked from commit 81854e0)
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Sep 23, 2018
## 1.16.5 (2018-09-18)

Changes:

  - Add support for TruffleRuby (@eregon)

Bugfixes:

  - Avoid printing git errors when checking the version on incorrectly packaged versions of Bundler ([#6453](rubygems/bundler#6453), @greysteil)
  - Fix issue where Bundler does not check the given class when comparing equality in DepProxy (@ChrisBr)
  - Handle `RangeNotSatisfiable` error in Compact Index (@MaxLap)
  - Check for initialized `search` variable in `LazySpecification` (@voxik)
  - Fix LoadError occurring in nested bundle exec calls ([#6537](rubygems/bundler#6537), @colby-swandale)
  - Check that Bundler::Deprecate is not an autoload constant ([#6163](rubygems/bundler#6163), @eregon)
  - Prefer non-pre-release versions when performing a `bundle update --patch` ([#6684](rubygems/bundler#6684), @segiddins)

## 1.16.4 (2017-08-17)

Changes:

  - Welcome new members to the Bundler core team (@indirect)
  - Don't mutate original error trees when determining version_conflict_message (@greysteil)
  - Update vendored Molinillo to 0.6.6 (@segiddins)

Bugfixes:

  - Reword bundle update regression message to be more clear to the user when a gem's version is downgraded ([#6584](rubygems/bundler#6584), @ralphbolo)
  - Respect --conservative flag when updating a dependency group ([#6560](rubygems/bundler#6560), @greysteil)
  - Fix issue where a pre-release version was not being selected when it's specified in the Gemfile ([#6449](rubygems/bundler#6449), @akihiro17)
  - Fix issue where `Etc` was not loaded when getting the user's home dir ([#6640](rubygems/bundler#6640), @colby-swandale)
  - Use UTF-8 for reading files including Gemfile ([#6660](rubygems/bundler#6660), @eregon)
  - Remove unnecessary `while` loop in path resolver helper (@ojab)

Documentation:

  - Document that `bundle show [--paths]` sorts results by name (@kemitchell)

## 1.16.3 (2018-07-17)

Features:

  - Support URI::File of Ruby 2.6 (@hsbt)

Bugfixes:

  - Expand symlinks during setup to allow Bundler to load correctly when using symlinks in $GEM_HOME ([#6465](rubygems/bundler#6465), @ojab, @indirect)
  - Dont let Bundler create temporary folders for gem installs which are owned by root ([#6258](rubygems/bundler#6258), @colby-swandale)
  - Don't fallback to using temporary directories when needed directories already exist ([#6546](rubygems/bundler#6546), @brodock)
  - Use SharedHelpers.filesystem_access when reading a Gemfile so friendly error messages can be given to the user ([#6541](rubygems/bundler#6541), @segiddins)
  - Check if source responds to `#remotes` before printing gem install error message ([#6211](rubygems/bundler#6211), @colby-swandale)
  - Handle Errno::ENOTSUP in the Bundler Process Lock to prevent exceptions when using NFS mounts ([#6566](rubygems/bundler#6566), @colby-swandale)
  - Respect encodings when reading gemspecs ([#6598](rubygems/bundler#6598), @deivid-rodriguez)

Documentation:

  - Fix links between manual pages (@BanzaiMan)
  - Add warning to Gemfile documentation for the use of the `source` option when declaring gems ([#6280](rubygems/bundler#6280), @forestgagnon)

## 1.16.2 (2018-04-20)

Changes:

  - Include the gem's source in the gem install error message when available (@papanikge)
  - Remove unnecessary executable bit from gem template (@voxik)
  - Dont add the timestamp comment with gems added to the Gemfile via `bundle add` ([#6193](rubygems/bundler#6193), @cpgo)
  - Improve yanked gem error message (@alyssais)
  - Use `Bundler.rubygems.inflate` instead of the Gem::Util method directly (@segiddins)
  - Remove unused instance variable (@segiddins)

Bugfixes:

  - Only trap INT signal and have Ruby's signal default handler be invoked (@shayonj)
  - Fix warning about the use of `__FILE__` in RubyGems integration testing (@MSP-Greg)
  - Skip the outdated bundler check when MD5 is not available ([#6032](rubygems/bundler#6032), @segiddins)
  - Fallback to the original error if the friendly message raises (@segiddins)
  - Rename Bundler.frozen? to avoid Object method conflict ([#6252](rubygems/bundler#6252), @segiddins)
  - Ensure the bindir exists before installing gems (@segiddins)
  - Handle gzip corruption errors in the compact index client ([#6261](rubygems/bundler#6261), @colby-swandale)
  - Check if the current directory is writeable when writing files in `bundle gem` ([#6219](rubygems/bundler#6219), @nilsding)
  - Fix hang when gemspec has incompatible encoding (@deivid-rodriguez)
  - Gracefully handle when the lockfile is missing spec entries for the current platform ([#6079](rubygems/bundler#6079), @segiddins)
  - Use Gem::Util.inflate instead of Gem.inflate (@hsbt)
  - Update binstub generator to use new ERB.new arity in Ruby 2.6 (@koic)
  - Fix `source_location` call in rubygems integration (@MSP-Greg)
  - Use `filesystem_access` when copying files in Compact Index Updater ([#6289](rubygems/bundler#6289), @segiddins)
  - Fail gracefully when resetting git gems to the given revision fails ([#6324](rubygems/bundler#6324), @segiddins)
  - Handle exceptions that do not have a backtrace ([#6342](rubygems/bundler#6342), @nesaulov)
  - Check if stderr was closed before writing to it (@shime)
  - Handle updating a specific gem for a non-local platform ([#6350](rubygems/bundler#6350), @greysteil)
  - Bump the `bundle_binstub` check-length to 300 characters (@tduffield)
  - Fix specifying alterntive Lockfile with `bundle lock` when default gemfile is present  ([#6460](rubygems/bundler#6460), @agrim123)
  - Allow installing dependencies when the path is set to `.`  ([#6475](rubygems/bundler#6475), @segiddins)
  - Support Bundler installing on a readonly filesystem without a home directory ([#6461](rubygems/bundler#6461), @grosser)
  - Filter git uri credentials in source description (@segiddins)

Documentation:

  - Correct typos in `bundle binstubs` man page (@erikj, @samueloph)
  - Update links in `bundle gem` command documentation to use https (@KrauseFx)
  - Fix broken links between bundler man pages (@segiddins)
  - Add man page for the `bundle doctor` command ([#6243](rubygems/bundler#6243), @nholden)
  - Document `# frozen_string_literal` in `bundle init` Gemfile (@315tky)
  - Explain the gemspec files attribute in `bundle gem` template and print a link to bundler.io guides when running `bundle gem` ([#6246](rubygems/bundler#6246), @nesaulov)
  - Small copy tweaks & removed redundant phrasing in the bundler man page (@rubymorillo)
  - Improve the documentation of the settings load order in Bundler (@rubymorillo)
  - Added license info to main README (@rubymorillo)
  - Document parameters and return value of Injector#inject (@tobias-grasse)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants