Since ruby-2.7.0
Gem::Platform.local.to_s == 'x86_64-linux-musl'
. As such the extensions dir changes from /usr/local/bundle/extensions/x86_64-linux
to /usr/local/bundle/extensions/x86_64-linux-musl
.
As such if you switch from 2.7.x to 2.6.x or back you will see the following warning for gems with native extensions:
Ignoring byebug-11.1.3 because its extensions are not built. Try: gem pristine byebug --version 11.1.3
https://github.com/ruby/ruby/blob/v3_2_2/lib/rubygems/basic_specification.rb#L79-L80
https://github.com/ruby/ruby/blob/v3_2_2/lib/rubygems/specification.rb#L2181
https://github.com/ruby/ruby/blob/v3_2_2/lib/rubygems/stub_specification.rb#L146
https://github.com/ruby/ruby/blob/v3_2_2/lib/rubygems/basic_specification.rb#L50
https://github.com/ruby/ruby/blob/v3_2_2/lib/rubygems/basic_specification.rb#L98
https://github.com/ruby/ruby/blob/v3_2_2/lib/rubygems/basic_specification.rb#L106
https://github.com/ruby/ruby/blob/v3_2_2/lib/rubygems/platform.rb#L15-L17
https://github.com/ruby/ruby/blob/v3_2_2/lib/rubygems/platform.rb#L105
Gemfile
:
source 'https://rubygems.org'
gem 'byebug', '11.1.3'
a.sh
:
ruby_from=$1
ruby_to=$2
docker run --rm -it \
-v "$PWD:/app" \
-w /app \
-e GEM_HOME=/app/bundle \
"$ruby_from" \
sh -euxc '
ruby -e "p Gem::Platform.local.to_s"
rm -rf Gemfile.lock bundle
apk add build-base
if ruby -e "if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new(\"2.7.0\"); then exit(1); end"; then
gem install bundler -v "~> 2.0"
fi
bundle
bundle exec ruby -rbyebug -e ""
'
docker run --rm -it \
-v "$PWD:/app" \
-w /app \
-e GEM_HOME=/app/bundle \
"$ruby_to" \
sh -euxc '
ruby -e "p Gem::Platform.local.to_s"
if ruby -e "if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new(\"2.7.0\"); then exit(1); end"; then
gem install bundler -v "~> 2.0"
fi
bundle exec ruby -rbyebug -e ""
'
$ sh -eu a.sh ruby:2.6.10-alpine3.15 ruby:2.7.0-alpine3.10
...
+ bundle exec ruby -rbyebug -e
Ignoring byebug-11.1.3 because its extensions are not built. Try: gem pristine byebug --version 11.1.3
Traceback (most recent call last):
1: from /usr/local/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/usr/local/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require': cannot load such file -- byebug (LoadError)
$ sh -eu a.sh ruby:2.7.0-alpine3.10 ruby:2.6.10-alpine3.15
...
+ bundle exec ruby -rbyebug -e
Your RubyGems version (3.0.3.1) has a bug that prevents `required_ruby_version` from working for Bundler. Any scripts that use `gem install bundler` will break as soon as Bundler drops support for your Ruby version. Please upgrade RubyGems to avoid future breakage and silence this warning by running `gem update --system 3.2.3`
Ignoring byebug-11.1.3 because its extensions are not built. Try: gem pristine byebug --version 11.1.3
/usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- byebug (LoadError)
from /usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'