Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bigdecimal dependency breaks installation on JRuby #2076

Closed
headius opened this issue Sep 4, 2023 · 12 comments
Closed

bigdecimal dependency breaks installation on JRuby #2076

headius opened this issue Sep 4, 2023 · 12 comments

Comments

@headius
Copy link
Contributor

headius commented Sep 4, 2023

Complete Description of Issue

Version 5.72.0 added a gem dependency on bigdecimal. There's no bigdecimal gem for JRuby, currently, so this prevents sequel from installing.

Reported to JRuby as rubygems/gemstash#358

I don't believe there's anything to fix on the sequel end but I am opening this bug to track the issue. I believe the correct fix would be to get the bigdecimal gem to release a stub -java version, so dependencies on bigdecimal will not prevent installation.

This was also originally reported to the bigdecimal gem in ruby/bigdecimal#169 and fixed in ruby/bigdecimal#250 but no -java gem has been released for bigdecimal yet.

cc @hsbt and @mrkn

Simplest Possible Self-Contained Example Showing the Bug

Just try to install latest sequel on JRuby. It will depend on bigdecimal, and try to build the CRuby extension.

Full Backtrace of Exception (if any)

No response

SQL Log (if any)

No response

Ruby Version

No response

Sequel Version

5.72.0

@hsbt
Copy link

hsbt commented Sep 4, 2023

@headius Should we release java version of bigdecimal-3.1.4?

@jeremyevans
Copy link
Owner

@headius Thanks for the heads up. If it is possible to release a java version of bigdecimal quickly, that seems like the best approach. If not, I can push out a new version of Sequel that drops the bigdecimal dependency, but this definitely would need to be addressed before the release of Ruby 3.3.

@headius
Copy link
Contributor Author

headius commented Sep 4, 2023

@hsbt that would be great! The work was all completed in February so I think we just need to get the stub gems released. See the linked issue and PR.

@headius
Copy link
Contributor Author

headius commented Sep 4, 2023

@jeremyevans Why 3.3 particularly?

@jeremyevans
Copy link
Owner

@headius If you are using bundler, CRuby 3.3 will start warning if you require 'bigdecimal' without bigdecimal being in the Gemfile. This will turn into an error in CRuby 3.4. This is the reason that Sequel started requiring bigdecimal, so that applications created with Sequel 5.72 will not start warning in CRuby 3.3 or failing in CRuby 3.4.

jsvd added a commit to logstash-plugins/logstash-integration-jdbc that referenced this issue Sep 4, 2023
Sequel 5.72.0 explicitly depends on the bigdecimal gem, causing JRuby to attempt to use the gem, install native extensions and fail.
Pinning to < 5.72.0 until ruby/bigdecimal#169 is solved.

Also related: jeremyevans/sequel#2076
jsvd added a commit to logstash-plugins/logstash-integration-jdbc that referenced this issue Sep 4, 2023
Sequel 5.72.0 explicitly depends on the bigdecimal gem, causing JRuby to attempt to use the gem, install native extensions and fail.
Pinning to < 5.72.0 until ruby/bigdecimal#169 is solved.

Also related: jeremyevans/sequel#2076
@headius
Copy link
Contributor Author

headius commented Sep 4, 2023

@jeremyevans Ahh, so bigdecimal is finally getting unbundled?

I was just concerned there was some new feature you started using, but this seems reasonable. Hopefully I can work with @hsbt and @mrkn to get the -java stub versions released soon.

@jeremyevans
Copy link
Owner

You could say it is getting bundled, since it is moving from a default gem to a bundled gem :)

There are no features in BigDecimal used by Sequel, Sequel still works with Ruby 1.9's BigDecimal library.

If the bigdecimal java gem is going to take more than a few days, please let me know and I can put out a new version of Sequel without the dependency. Sorry I didn't test this earlier, I guess I assumed that if bigdecimal was a standard gem on CRuby, it was also a standard gem on JRuby, but that is apparently not true. Wasn't caught by CI because CI doesn't use the gemspec (due to problems with using it and supporting versions of bundler back to Ruby 1.9). I should have added it to .ci.gemfile, that would have caught the issue before the release.

@headius
Copy link
Contributor Author

headius commented Sep 4, 2023

Unfortunately bigdecimal is a very large C extension, and since the JDK provides a built-in BigDecimal implementation it made more sense for us to just ship our thin wrapper around that API. We have considered moving that wrapper into the gem, but @mrkn has had concerns about maintaining that code or having CI failures when only the C code gets updated.

It's an unfortunate fact of Ruby gems that there's no way to publish a separate library that will be seen as equivalent, so our only choice is to work with gem authors to publish -java versions either with Java code or as a stub.

@jeremyevans
Copy link
Owner

For CRuby default gems, they remain in the standard library, but CRuby ships with a gemspec for them. You cannot uninstall them, but they still show up in gem list. You can install newer versions of the gems, and use the gem method to pick a specific version (as long as the standard library version has not already been loaded). Not sure if JRuby wants to take that approach or not. Having bigdecimal as a default gem in JRuby would fix this, but since JRuby doesn't already have it, it would only fix it going forward. Since Sequel wants to support already released versions of JRuby, it looks like a bigdecimal java gem release is the only long term solution, because CRuby is moving bigdecimal from a default gem to a bundled gem.

@hsbt
Copy link

hsbt commented Sep 5, 2023

@headius I've published Java version of bigdecimal at https://rubygems.org/gems/bigdecimal/versions/3.1.4-java

@jeremyevans
Copy link
Owner

@hsbt Thanks, that fixes the issue!:

$ jruby -S gem install sequel
Fetching bigdecimal-3.1.4-java.gem
Fetching sequel-5.72.0.gem
Successfully installed bigdecimal-3.1.4-java
Successfully installed sequel-5.72.0
Parsing documentation for bigdecimal-3.1.4-java
Installing ri documentation for bigdecimal-3.1.4-java
Parsing documentation for sequel-5.72.0
Installing ri documentation for sequel-5.72.0
Done installing documentation for bigdecimal, sequel after 45 seconds
2 gems installed

@headius
Copy link
Contributor Author

headius commented Sep 5, 2023

@hsbt Thank you, that's great! I will update JRuby 9.4 to also source files from the gem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants