rsim / oracle-enhanced

Oracle enhaced adapter for ActiveRecord
MIT License
544 stars 308 forks source link

Installation of >=v7.0.1 fails with JRuby #2350

Open hummeltech opened 10 months ago

hummeltech commented 10 months ago

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

davue commented 9 months ago

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.

hummeltech commented 9 months ago

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"
iaddict commented 8 months ago

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.

davue commented 6 months ago

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.

hummeltech commented 6 months ago

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.