RubyからOracleにちょっかいを出すためにruby-oci8をmake install
何故かsudo gem install ruby-oci8では上手く行かなかったので、RubyForgeからファイル一式をダウンロードしてmakeからやることにします。
ruby setup.rb config checking for load library path... DYLD_LIBRARY_PATH... checking /u01/app/oracle/product/10.2.0/client_1/lib... yes /u01/app/oracle/product/10.2.0/client_1/lib/libclntsh.dylib.10.1 looks like a full client. checking for cc... ok checking for gcc... yes checking for LP64... no checking for ruby header... ok Get the version of Oracle from SQL*Plus... 1020 try -I/u01/app/oracle/product/10.2.0/client_1/rdbms/public checking for oci.h... yes checking for OCIInitialize() in oci.h... no Running make for $ORACLE_HOME/rdbms/demo/demo_rdbms.mk (build) ...OK checking for OCIInitialize() in oci.h... no --------------------------------------------------- error messages: cannot compile OCI --------------------------------------------------- See: * http://ruby-oci8.rubyforge.org/ja/HowToInstall.html * http://ruby-oci8.rubyforge.org/ja/ReportInstallProblem.html
しかし初回は上手くいかず。どうやら-arch i386オプションが必要らしい。オプションを加えてやると上手くいった。
pasta:ruby-oci8-1.0.4 mahm$ export ARCHFLAGS="-arch i386" pasta:ruby-oci8-1.0.4 mahm$ make ruby setup.rb config checking for load library path... DYLD_LIBRARY_PATH... checking /u01/app/oracle/product/10.2.0/client_1/lib... yes /u01/app/oracle/product/10.2.0/client_1/lib/libclntsh.dylib.10.1 looks like a full client. checking for cc... ok checking for gcc... yes checking for LP64... no checking for ruby header... ok Get the version of Oracle from SQL*Plus... 1020 try -I/u01/app/oracle/product/10.2.0/client_1/rdbms/public checking for oci.h... yes checking for OCIInitialize() in oci.h... yes checking for OCIEnvCreate()... yes checking for OCITerminate()... yes checking for OCILobOpen()... yes checking for OCILobClose()... yes checking for OCILobCreateTemporary()... yes checking for OCILobGetChunkSize()... yes checking for OCILobLocatorAssign()... yes checking for OCIRowidToChar()... yes creating ../../lib/oci8.rb from /Users/mahm/Downloads/ruby-oci8-1.0.4/ext/oci8/../../lib/oci8.rb.in (以下略)
pasta:ruby-oci8-1.0.4 mahm$ irb >> require 'oci8' => true >> OCI8.new('apxe','******','xe').exec('select SYSDATE from dual'){|out| puts out} 2009/03/06 17:39:13 => 1 >>
これで土台が整ったことに。今から用事があって外出するので、続きはまた後で。。