Giter Club home page Giter Club logo

Comments (11)

toy avatar toy commented on June 12, 2024

I think I saw this message some decent time ago.

And the message is pretty accurate, here is the spec for this case: https://github.com/rubygems/rubygems/blob/8bff4a99ac4bd8cecd3345369c231bca92215386/bundler/spec/install/gemfile/platform_spec.rb#L233-L257
image_optim_pack shouldn't fit the case as platform versions have exactly same dependencies as "ruby" version.
To confirm that nothing is wrong I downloaded all platform versions for latest gem and compared metadata, the difference is only in platform and list of files.

I'm wondering if it is something that was fixed in latest bundler version, but as I remember the version of bundler is fixed on Heroku, right?
Is it possible to somehow debug the resolution process?

from image_optim_pack.

brian-kephart avatar brian-kephart commented on June 12, 2024

The inner workings of bundler are a mystery to me. I was hoping this would make more sense to you.

That said, it might be worth noting that my local version of bundler is 2.1.4, so Heroku uses a different version when compiling (2.0.2). It could very well be an issue that is fixed in newer releases of bundler.

from image_optim_pack.

toy avatar toy commented on June 12, 2024

To experiment I've updated https://iopack.herokuapp.com/ to ruby 2.7.1 and it is using bundler 2.0.2, but deployment went without problems. Could you try to create and share some minimal reproducible example of heroku app that fails?

from image_optim_pack.

brian-kephart avatar brian-kephart commented on June 12, 2024

I think that I saw this when deploying to Heroku because I tend to watch the output, but I've discovered this isn't a deployment error.

$ rails new my_new_app -M -O -C -S -J -T -B
$ cd my_new_app
# Gemfile
gem 'image_optim_pack'
$ bundle
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64 -mingw32 java`.
Fetching gem metadata from https://rubygems.org/............
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Unable to use the platform-specific (x86_64-darwin) version of image_optim_pack (0.6.0.20200215) because it has different dependencies from the ruby version. To use the platform-specific version of the gem, run `bundle config set specific_platform true` and install again.
Using rake 13.0.1
# all the other gems...

I'm seeing this locally under the following conditions:

  • Bundler 2.1.4
  • Ruby 2.7.1
  • MacOS

from image_optim_pack.

toy avatar toy commented on June 12, 2024

Something else is affecting as for same version I don't see the warning, maybe some bundler and/or rubygems config? Can you try reproducing it in a Dockerfile?

from image_optim_pack.

brian-kephart avatar brian-kephart commented on June 12, 2024

I'm not a Docker user, so that's a hefty project for me that I'm unlikely to complete. I realized that I left out the RubyGems version though. I'm on 3.1.4 locally (not sure about Heroku).

from image_optim_pack.

toy avatar toy commented on June 12, 2024

Sure, just wrong assumption that docker is everywhere :)
Still can't reproduce on mac with same versions. Can you try to reduce the Gemfile for heroku app to bare minimum triggering the warning and share it?

from image_optim_pack.

brian-kephart avatar brian-kephart commented on June 12, 2024

I suspect this issue has its roots locally, rather than with Heroku.

I ran the command from the warning message:
bundle config set specific_platform true

After that, the local install ran without the warning.

To reproduce the warning after it's gone

$ gem uninstall image_optim_pack
$ bundle config unset specific_platform
$ rails new my_new_app2 -M -O -C -S -J -T -B -d postgresql # this must be a different app than before. Not sure why.
$ bundle add image_optim_pack

Deploying this to Heroku yields the error from the OP.

Complete these steps...

$ bundle config set specific_platform true
$ bundle
# commit & deploy

... and the warning message no longer appears during deployment.

Before running bundle config set specific_platform true

Gemfile.lock:

PLATFORMS
  ruby

Output of bundle:

Unable to use the platform-specific (x86_64-darwin) version of image_optim_pack (0.6.0.20200215) because it has different dependencies from the ruby version. To use the platform-specific version of the gem, run `bundle config set specific_platform true` and install again.
...
Using image_optim_pack 0.6.0.20200215

Output during deployment

Unable to use the platform-specific (x86_64-linux) version of image_optim_pack (0.6.0.20200215) because it has different dependencies from the ruby version. To use the platform-specific version of the gem, run `bundle config set specific_platform true` and install again.
...
remote:        Using image_optim_pack 0.6.0.20200215

After running bundle config set specific_platform true

Gemfile.lock:

PLATFORMS
  ruby
  x86_64-darwin-19

Output of bundle:

# no warning
Using image_optim_pack 0.6.0.20200215 (x86_64-darwin)

Output during deployment

# no warning
remote:        Using image_optim_pack 0.6.0.20200215

Notice the lack of platform-specific installation, even though the warning message is gone.

Heroku weirdness

In the output above, Heroku never installs a platform-specific gem like it does locally, even when the warning is not issued.

If you've deployed with the platform specified...

$ heroku run bash
$ cat Gemfile.lock

... yields the following:

PLATFORMS
  ruby
  x86_64-darwin-19

So, it appears that Heroku doesn't alter Gemfile.lock to correct the platform, and doesn't install the platform-specific version of the gem, even though it complains when Gemfile.lock doesn't specify the platform.

None of this makes it obvious to me why I started seeing these warnings recently, when I hadn't seen them before.

from image_optim_pack.

toy avatar toy commented on June 12, 2024

Sorry for long reply time.
Yesterday I was finally able to reproduce and pinpoint it:

gem uninstall image_optim_pack --all

gem install image_optim_pack --platform ruby

cat <<GEMFILE > Gemfile
source 'https://rubygems.org'
gem 'image_optim'
GEMFILE
bundle

cat <<GEMFILE > Gemfile
source 'https://rubygems.org'
gem 'image_optim'
gem 'image_optim_pack'
GEMFILE
bundle

The problem comes from comparing dependency requirements. Inside Bundler::LazySpecification#__materialize__ there is a comparison of dependencies taking place which fails when comparing following two due to different order of requirements:

<Gem::Dependency type=:runtime name="fspath" requirements="< 4, >= 2.1">
<Gem::Dependency type=:runtime name="fspath" requirements=">= 2.1, < 4">

If sorting is added in Gem::Requirement, then the warning disappears, and the platform specific version is installed and used.
I'll try to create a PR to rubygems.

from image_optim_pack.

toy avatar toy commented on June 12, 2024

Problem should be fixed starting with bundler 2.2.0.rc.2 (or stable 2.2.0), but as I know Heroku doesn't allow configuring bundler version.

from image_optim_pack.

brian-kephart avatar brian-kephart commented on June 12, 2024

That's ok, they'll catch up eventually. Thanks for following up!

from image_optim_pack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.