Brent Miller
2007-Nov-14 17:08 UTC
Connecting to Oracle from an Intel Mac -- arch. conflicts
Hi all, I''ve got a rather complex problem on my hands. I''m using Leopard (OSX 10.5) on an Intel Mac, with the standard Ruby and Rails installations. In order to get Rails to talk to Oracle, I upgraded the Rails gems to the latest release candidate (1.99), and installed the oracle adapter gem. So far so good. But the Oracle InstantClient is a PPC-only library. You can''t get the default Ruby install to talk to it, since on the Intel Mac it always runs in native mode, not in Rosetta. So to get around that I used ditto to extract the PPC version of the Ruby binary. In /usr/bin I''ve now got "ruby_ppc" and "ruby_fat" with a ln from "ruby" to "ruby_ppc" -- so from anywhere in the system, if you call "ruby" you get the PPC version. Believe it or not, this is sufficient to get Rails to talk to Oracle: my apps connect to the Oracle database, and it''s all good. Until I use the console. Running script/console brings up the console just fine, and I can use the model classes in my app that aren''t pulling from Oracle, but if I try to use one that needs Oracle, I get the following error: LoadError: Oracle/OCI libraries could not be loaded: dlopen(/Library/Ruby/Site/1.8/universal-darwin9.0/oci8lib.bundle, 9): no suitable image found. Did find: /Library/Ruby/Site/1.8/universal-darwin9.0/oci8lib.bundle: mach-o, but wrong architecture - /Library/Ruby/Site/1.8/universal-darwin9.0/oci8lib.bundle from /Library/Ruby/Gems/1.8/gems/activerecord-oracle-adapter-1.0.0/lib/active_record/connection_adapters/oracle_adapter.rb:713:in `oracle_connection'' from /Library/Ruby/Gems/1.8/gems/activerecord-1.99.0/lib/active_record/connection_adapters/abstract/connection_specification.rb:291:in `send'' from /Library/Ruby/Gems/1.8/gems/activerecord-1.99.0/lib/active_record/connection_adapters/abstract/connection_specification.rb:291:in `connection='' from /Library/Ruby/Gems/1.8/gems/activerecord-1.99.0/lib/active_record/connection_adapters/abstract/connection_specification.rb:259:in `retrieve_connection'' from /Library/Ruby/Gems/1.8/gems/activerecord-1.99.0/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:in `connection'' from /Library/Ruby/Gems/1.8/gems/activerecord-1.99.0/lib/active_record/base.rb:2222:in `quoted_table_name'' from /Library/Ruby/Gems/1.8/gems/activerecord-1.99.0/lib/active_record/base.rb:1155:in `construct_finder_sql'' from /Library/Ruby/Gems/1.8/gems/activerecord-1.99.0/lib/active_record/base.rb:1035:in `find_every'' from /Library/Ruby/Gems/1.8/gems/activerecord-1.99.0/lib/active_record/base.rb:1029:in `find_initial'' from /Library/Ruby/Gems/1.8/gems/activerecord-1.99.0/lib/active_record/base.rb:437:in `find'' from (irb):3 The bundle in question, /Library/Ruby/Site/1.8/universal-darwin9.0/oci8lib.bundle, shows as Mach-O ppc, which is what it should be. The ruby binary is also Mach-O ppc. They match. Why is it that the console isn''t working, but my Rails apps are? Please help! Thanks. Brent -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Izidor Jerebic
2007-Nov-18 09:29 UTC
Re: Connecting to Oracle from an Intel Mac -- arch. conflicts
On 14.11.2007, at 18:08, Brent Miller wrote:> The bundle in question, > /Library/Ruby/Site/1.8/universal-darwin9.0/oci8lib.bundle, shows as > Mach-O ppc, which is what it should be. The ruby binary is also > Mach-O > ppc. They match. > > Why is it that the console isn''t working, but my Rails apps are?console is running inside irb, not ruby. You probably need to perform the same trick with irb executable as you did with ruby. izidor P.S. It is a useful trick to know... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Brent Miller
2007-Nov-19 17:23 UTC
Re: Connecting to Oracle from an Intel Mac -- arch. conflict
Thanks Izidor. :+) You put me on the right track. It seems that in Leopard, there are 2 ruby binaries -- one lives in the Ruby Framework in /Library/blahblahblah. If I extract a ppc only version of that binary, everything works great. thanks again! Brent> console is running inside irb, not ruby. You probably need to perform > the same trick with irb executable as you did with ruby. > > izidor > > P.S. It is a useful trick to know...-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Izidor Jerebic
2007-Nov-20 08:06 UTC
Re: Connecting to Oracle from an Intel Mac -- arch. conflict
Happy to see your problems are solved. But for the archives: By default there is only one ruby binary in Leopard - the one that lives in /System/Library/Frameworks/Ruby.framework/Versions/Current/ usr/bin/ruby. The file /usr/bin/ruby is only a symlink to the canonical executable: g5:~> ls -l `which ruby` lrwxr-xr-x 1 root wheel 76 26 okt 23:15 /usr/bin/ruby -> ../../ System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby The canonical file in /System/Library is the executable which needs to be manipulated. It seems that on your system you had some other ruby installed besides the original Leopard version. And about irb: irb is a symlink to /System/Library script which is executed by the canonical ruby directly (not via the /usr/bin/ruby, but hardcoded /System/Library/blabla), so if you have some custom version of ruby in /usr/bin, you also need to provide the corresponding irb (and others, probably)... izidor On 19.11.2007, at 18:23, Brent Miller wrote:> > Thanks Izidor. :+) You put me on the right track. It seems that in > Leopard, there are 2 ruby binaries -- one lives in the Ruby > Framework in > /Library/blahblahblah. If I extract a ppc only version of that > binary, > everything works great. > > thanks again! > > Brent > > >> console is running inside irb, not ruby. You probably need to perform >> the same trick with irb executable as you did with ruby. >> >> izidor >> >> P.S. It is a useful trick to know... > > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---