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:insend’
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:inretrieve_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:inquoted_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:infind_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:infind’
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