protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

Ruby 4.0 support - just needs a new gem release

Open seuros opened this issue 2 months ago • 5 comments

Hey,

Ruby 4.0.0 was released on Christmas and the current google-protobuf gem (4.33.2) has required_ruby_version set to < 3.5.dev, >= 3.1.

This constraint is baked in at build time for the prebuilt platform gems. The actual code works fine on Ruby 4.0 - the next release pipeline will automatically pick up the correct Ruby version, no code changes needed.

Just waiting on the next release to unblock Ruby 4.0 users.

Thanks!

seuros avatar Jan 05 '26 12:01 seuros

Any chance for a quick release? 👀 The change looks minor and this would really help

khasinski avatar Jan 06 '26 16:01 khasinski

I am currently working on the internal test infrastructure changes needed to support Ruby 4.0. Without it, no tests will actually run under the new version.

JasonLunn avatar Jan 07 '26 20:01 JasonLunn

Thank you .

Could you add support to ruby-head while you are on it ?

This will allow us (gems maintainers) to test future versions and to not have this gem as a choke point)

seuros avatar Jan 08 '26 07:01 seuros

Asking to understand: how would a ruby-head test configuration for protobuf be helpful to other gem maintainers? I'm not actually clear how useful it would be to the Protobuf team, given it is inherently non-hermetic, so I'm having a hard time seeing how it helps anyone that has a protobuf dependency... If it breaks, how will we know it's a problem with protobuf vs unreleased changes in ruby?

JasonLunn avatar Jan 08 '26 16:01 JasonLunn

The issue is that we cannot run ruby-head if the dependent gems are not tested without being in the dark.

If i see that this gem has a red test suite in ruby 4.1.dev, i'm not going to spend time trying to debug on my side.

seuros avatar Jan 08 '26 18:01 seuros

@seuros - I'm working through some Ruby 4 specific issues, but one that I haven't yet encountered is an upper bound on the Ruby language version. https://rubygems.org/gems/google-protobuf shows only the lower bound (e.g. >= 3.1) is set.

Can you confirm that < 3.5.dev is coming from something outside of the protobuf gem itself?

JasonLunn avatar Jan 09 '26 19:01 JasonLunn

Note: Ruby 4.0 support is also being tracked in #25051

JasonLunn avatar Jan 09 '26 19:01 JasonLunn

Yes the lock is not this gem, but from rake-compiler-dock

However the upper lock happen at compile time and gem release.

rake-compiler-dock did add ruby 4.0 support in 1.11.0 / 2025-12-25

The solution is to bump the version and rerelease! The new version of RCD will be fetched and the lock relaxed.

seuros avatar Jan 09 '26 19:01 seuros

rake-compiler-dock is only a development dependency, and the existing version constraints should allow it float up to 1.11 without changes. On my local, gem install google-protobuf --development results in picking up rake-compiler-dock with version 1.11.1 released on December 27th. Do you get the same?

JasonLunn avatar Jan 13 '26 18:01 JasonLunn

Yes, that case.

seuros avatar Jan 13 '26 19:01 seuros

This should be fixed via 93f4eba2585a84ed26c29c6120a6d2ae37b68b60.

ashkulz avatar Jan 21 '26 06:01 ashkulz

The workflow changes appear to be included in 34.0rc1 but it unfortunately does not work and still has an upper bound of < 3.5: https://rubygems.org/gems/google-protobuf/versions/4.34.0.rc.1-arm64-darwin.

Bo98 avatar Jan 23 '26 04:01 Bo98

I’ll look into what’s going on with binary gems. The source gem does not have an upper bound.

JasonLunn avatar Jan 23 '26 06:01 JasonLunn

On my local, gem install google-protobuf --development results in picking up rake-compiler-dock with version 1.11.1 released on December 27th.

This is true but the build invokes bundle which will install the specific version referenced in the lockfile:

https://github.com/protocolbuffers/protobuf/blob/bb51fee7eb8f31924bae11029a766af0d772ca6c/ruby/Gemfile.lock#L16

tt avatar Jan 23 '26 09:01 tt

The solution is extremely simple.

bundle update rake-compiler-dock

commit&push and release a patch version.

seuros avatar Jan 23 '26 09:01 seuros

I used the following, and it works for us

gem 'google-protobuf', force_ruby_platform: true

kapso avatar Jan 26 '26 20:01 kapso