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

Plans for arm (Mac M1 to be exact)? #257

Open
Physium opened this issue Dec 4, 2023 · 18 comments
Open

Plans for arm (Mac M1 to be exact)? #257

Physium opened this issue Dec 4, 2023 · 18 comments

Comments

@Physium
Copy link

Physium commented Dec 4, 2023

Curious, are there plans for this gem to support arm? oracle db is now supporting images running on arm architectures already is there still a need for us to toggle between intel vs arm when installing ruby?

@kubo
Copy link
Owner

kubo commented Dec 5, 2023

Ruby-oci8 doesn't support macOS Arm while Oracle instant client for macOS Arm isn't released. You need to use intel ruby for a while. As for Oracle Database on macOS, it runs on Linux Arm containers. Oracle client in the container isn't available outside of it.

Linux Arm (aarch64) will be supported at the next release. Probably it is at the end of this month.
Ruby-oci8 works on Linux arm64.

@Physium
Copy link
Author

Physium commented Dec 5, 2023

thanks for your response! Am I able to run ruby-oci8 while using arm based oracle db container?

@kubo
Copy link
Owner

kubo commented Dec 6, 2023

Yes, you are enable to run Oracle database container as a server and ruby-oci8 for intel macOS as a client on one macOS Arm machine.

@kubo
Copy link
Owner

kubo commented Jun 23, 2024

Oracle Instant Client for macOS arm64 is out.
https://www.oracle.com/database/technologies/instant-client/macos-arm64-downloads.html

I hope it works without ruby-oci8 code change.

@matthewtusker
Copy link

matthewtusker commented Jun 24, 2024

I've just installed ruby-oci8 on Mac ARM64! 🎉

EDIT: On Ruby 3.2.2, Ruby 3.1.2 fails calling OCIEnvCreate() The x86_64 client was still being picked up. Removed it completely and ruby-oci8 installed successfully!

@matthewtusker
Copy link

Hmm, looks like there may be an issue:

RuntimeError: Hook error: Could not replace function read in /Users/xxx/instantclient_23_3/libclntsh.dylib.23.1
from /Users/xxx/.local/share/mise/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/ruby-oci8-2.2.11/lib/oci8/properties.rb:74:in `__set_prop'

@kubo
Copy link
Owner

kubo commented Jun 24, 2024

Thanks for running on macOS!

I updated plthook. Could you try to use the latest revision in the master branch?

Replace ruby-oci8 entry in Gemfile with the following line and run bundle update ruby-oci8 if you use bundler.

gem 'ruby-oci8', :git => 'https://github.com/kubo/ruby-oci8.git', :branch => 'master'

@pasha
Copy link

pasha commented Jun 24, 2024

Hi, I was able to install it from the master branch but running it generates following error

dyld[19245]: missing symbol called

@matthewtusker
Copy link

Yeah, I get an error too:

RuntimeError: Hook error: unknown imports format 0
from /Users/xxx/.local/share/mise/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/bundler/gems/ruby-oci8-a2ababbc655a/lib/oci8/properties.rb:74:in `__set_prop'

@Szemethym
Copy link

Yeah, I get an error too:

RuntimeError: Hook error: unknown imports format 0
from /Users/xxx/.local/share/mise/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/bundler/gems/ruby-oci8-a2ababbc655a/lib/oci8/properties.rb:74:in `__set_prop'

Same here, but commenting out that line makes it work as expected. Only caveat I can see is that you won't have your tcp keepalive time set to 10 minutes as per this doc.

@Szemethym
Copy link

I may have spoken too soon...

.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/ruby-oci8-2.2.12/lib/oci8/metadata.rb:2038: [BUG] Segmentation fault at 0x0000000001990028
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin23]

@matthewtusker
Copy link

#255 and #236 should probably follow along here.

kubo added a commit that referenced this issue Jun 25, 2024
@kubo
Copy link
Owner

kubo commented Jun 25, 2024

Thanks you all.

I removed OCI8.properties[:tcp_keepalive_time] feature on macOS arm64 by 8e67b9b.
After that, it raises NotImplementedError.

Oracle enhanced adapter ignores the exception.
https://github.com/rsim/oracle-enhanced/blob/v7.0.3/lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb#L336-L339

@pasha
Copy link

pasha commented Jun 25, 2024

hi, I tried the update and still able to install it but getting the same error as before

bundle exec rake -T
dyld[64294]: missing symbol called

@kubo
Copy link
Owner

kubo commented Jun 25, 2024

dyld[64294]: missing symbol called

The message was displayed by dyld (dynamic loader).
This issue is different with others RuntimeError: Hook error.

After googling, I found https://www.rubyonmac.dev/how-to-fix-missing-symbol-called-when-running-rails-commands.

@kubo
Copy link
Owner

kubo commented Jun 25, 2024

@Szemethym

.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/ruby-oci8-2.2.12/lib/oci8/metadata.rb:2038: [BUG] Segmentation fault at 0x0000000001990028
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin23]

Could you make a minimal reproducible example?
If it reproduces SEGV on Linux, I'll make an effort to resolve it. If not, it may be specific to apple silicon and I may not be able to help you.

@Szemethym
Copy link

@kubo I have tried to reproduce the issue, but to no avail... Read: Issue fixed, possibly because of system restart and/or messing around with exports in my terminal source file. Thank you for your assistance, I currently have no issues with arm64 ruby, arm64 macOS Oracle instant client and ruby-oci8 gem on latest master.

Just an FYI: When I was seeing an issue, it was happening only at runtime for a Rails server and I wasn't able to reproduce it in a Rails console, with the same queries. (So, possibly something else was messing around with those memory locations, I'm not sure...)

@pilaf
Copy link

pilaf commented Jul 5, 2024

I'm also getting a "Hook error", although with a different error message:

(…)/ruby-oci8-2.2.12/lib/oci8/properties.rb:74:in `__set_prop': Hook error: Could not replace function read in /Users/pilaf/Downloads/instantclient_23_3/libclntsh.dylib.23.1 (RuntimeError)
	from (…)/ruby-oci8-2.2.12/lib/oci8/properties.rb:74:in `[]='
        from (…)/activerecord-oracle_enhanced-adapter-6.1.6/lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb:337:in `new_connection'

I get this when trying to use ruby-oci8 through activerecord 6.x with activerecord-oracle_enhanced-adapter:

irb(main):002:0> MyOracleBackedActiveRecordModel.connection
💥 

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

6 participants