oracle-enhanced icon indicating copy to clipboard operation
oracle-enhanced copied to clipboard

Installation of >=v7.0.1 fails with JRuby

Open hummeltech opened this issue 2 years ago • 6 comments

I believe this commit (first released with v7.0.1) is causing the installation of the activerecord-oracle_enhanced-adapter gem to fail when using JRuby.

Steps to reproduce

Passing (7.0.0):

$ cd $(mktemp --directory)
$ printf 'jruby-9.4.3.0\n' > .ruby-version
$ rbenv install --skip-existing
$ printf 'source "https://rubygems.org"\ngem "activerecord-oracle_enhanced-adapter", "7.0.0"\n' > Gemfile
$ bundle install
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies...
Using bundler 2.4.14
Using concurrent-ruby 1.2.2
Using ruby-plsql 0.8.0
Using i18n 1.14.1
Using tzinfo 2.0.6
Using minitest 5.19.0
Using activesupport 7.0.7
Using activemodel 7.0.7
Using activerecord 7.0.7
Using activerecord-oracle_enhanced-adapter 7.0.0
Bundle complete! 1 Gemfile dependency, 10 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

Failing (7.0.1):

$ cd $(mktemp --directory)
$ printf 'jruby-9.4.3.0\n' > .ruby-version
$ rbenv install --skip-existing
$ printf 'source "https://rubygems.org"\ngem "activerecord-oracle_enhanced-adapter", "7.0.1"\n' > Gemfile
$ bundle install
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies...
Using bundler 2.4.14
Using concurrent-ruby 1.2.2
Using ruby-plsql 0.8.0
Using minitest 5.19.0
Using i18n 1.14.1
Using tzinfo 2.0.6
Using activesupport 7.0.7
Using activemodel 7.0.7
Using activerecord 7.0.7
Installing ruby-oci8 2.2.12 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
...
An error occurred while installing ruby-oci8 (2.2.12), and Bundler
cannot continue.

In Gemfile:
  activerecord-oracle_enhanced-adapter was resolved to 7.0.1, which depends on
    ruby-oci8

Expected behavior

The activerecord-oracle_enhanced-adapter gem should install without requiring ruby-oci8

Actual behavior

The ruby-oci8 gem is being required.

System configuration

Rails version: N/A

Oracle enhanced adapter version: >= 7.0.1

Ruby version: JRuby 9.4.3.0

Oracle Database version: N/A

hummeltech avatar Aug 16 '23 15:08 hummeltech

Using the gem from source via the path option works fine.

I suspect that it's required to build two variants of the gem for each platform as the uploaded variant in rubygems.org was built using CRuby and thus requires ruby-oci8.

davue avatar Sep 19 '23 09:09 davue

Thanks, yes, that's basically what I have been doing as a work-around until a solution can be found, I.E.:

git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem "activerecord-oracle_enhanced-adapter", github: "rsim/oracle-enhanced"

hummeltech avatar Sep 28 '23 22:09 hummeltech

I have the same problem, but loading from github is not an option for me, because of corporate firewall rules.

Thus I cloned the repository, switched to the v7.0.3 tag and built the gem with jruby.

jruby -S bundle
jruby -S bundle exec rake build

I copied the resulting gem to vendor/cache and installed/updated with bundle update --local.

This gem then works. So the problem is, that no jruby version of the gem has been published.

iaddict avatar Oct 23 '23 17:10 iaddict

In fact there was never a Java version published for this gem as you can see here but this was no issue so far because all dependencies were cross-compatible.

Only the person(s) who publishes this gem can fix this.

davue avatar Dec 27 '23 14:12 davue

Thank you for pointing that out @davue, that explains it.

And thank you for the link, I can now show what I discovered in the commit mentioned in the issue report.

  • ruby-oci8 is not a dependency of v7.0.0:
    • https://rubygems.org/gems/activerecord-oracle_enhanced-adapter/versions/7.0.0/dependencies
  • ruby-oci8 is a dependency of v7.0.1:
    • https://rubygems.org/gems/activerecord-oracle_enhanced-adapter/versions/7.0.1/dependencies

hummeltech avatar Dec 27 '23 15:12 hummeltech