Wednesday, April 21, 2010

Install ruby-oci8 on Ubuntu

gzip -dc ruby-oci8-2.0.4.tar.gz | tar xvf -
cd ruby-oci8-2.0.4
make
make install

* When I issue command: sudo make install

luan@luan-laptop:/opt/download/ruby-oci8-2.0.4$ sudo make install
ruby -w setup.rb install
make: ruby: Command not found
make: *** [install] Error 127
luan@luan-laptop:/opt/download/ruby-oci8-2.0.4$ ruby -w setup.rb install
---> lib
mkdir -p /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/
install oci8.rb /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/
Permission denied - /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/oci8.rb
Try 'ruby setup.rb --help' for detailed usage.
luan@luan-laptop:/opt/download/ruby-oci8-2.0.4$ sudo ruby -w setup.rb install
sudo: ruby: command not found
luan@luan-laptop:/opt/download/ruby-oci8-2.0.4$ sudo /opt/ruby/bin/ruby -w setup.rb install
---> lib
mkdir -p /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/
install oci8.rb /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/
---> lib/dbd
mkdir -p /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/dbd
install OCI8.rb /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/dbd
<--- lib/dbd
---> lib/oci8
mkdir -p /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/oci8
install oci8.rb /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/oci8
install encoding.yml /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/oci8
install encoding-init.rb /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/oci8
install object.rb /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/oci8
install bindtype.rb /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/oci8
install datetime.rb /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/oci8
install metadata.rb /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/oci8
install compat.rb /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/oci8
install oracle_version.rb /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/oci8
<--- lib/oci8
<--- lib
---> ext
---> ext/oci8
mkdir -p /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/x86_64-linux/.
install oci8lib_191.so /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/x86_64-linux/.
<--- ext/oci8
<--- ext

----------------------------------------------------------------------------------


I can't install ruby-oci8 on Ubuntu 104 using:

sudo gem install ruby-oci8

luan@luan-laptop:~/app/software/ruby/dev$ sudo /opt/ruby/bin/gem install ruby-oci8
[sudo] password for luan:
Building native extensions. This could take a while...
ERROR: Error installing ruby-oci8:
ERROR: Failed to build gem native extension.

/opt/ruby-1.9.1-p376/bin/ruby extconf.rb
checking for load library path...
LD_LIBRARY_PATH is not set.
checking ld.so.conf... no
checking for cc... ok
checking for gcc... yes
checking for LP64... yes
checking for ruby header... ok
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/opt/ruby-1.9.1-p376/bin/ruby
--with-instant-client
--without-instant-client
/opt/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.0.4/ext/oci8/oraconf.rb:895:in `get_home': RuntimeError (RuntimeError)
from /opt/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.0.4/ext/oci8/oraconf.rb:682:in `initialize'
from /opt/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.0.4/ext/oci8/oraconf.rb:345:in `new'
from /opt/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.0.4/ext/oci8/oraconf.rb:345:in `get'
from extconf.rb:18:in `
'
---------------------------------------------------
Error Message:
Set the environment variable ORACLE_HOME if Oracle Full Client.
Append the path of Oracle client libraries to LD_LIBRARY_PATH if Oracle Instant Client.

The 'sudo' command unset some environment variables for security reasons.
Pass required varialbes as follows
sudo env LD_LIBRARY_PATH=$LD_LIBRARY_PATH /opt/ruby/bin/gem install ruby-oci8
or
sudo env ORACLE_HOME=$ORACLE_HOME /opt/ruby/bin/gem install ruby-oci8

Backtrace:
/opt/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.0.4/ext/oci8/oraconf.rb:895:in `get_home'
/opt/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.0.4/ext/oci8/oraconf.rb:682:in `initialize'
/opt/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.0.4/ext/oci8/oraconf.rb:345:in `new'
/opt/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.0.4/ext/oci8/oraconf.rb:345:in `get'
extconf.rb:18:in `
'
---------------------------------------------------
See:
* http://ruby-oci8.rubyforge.org/en/HowToInstall.html
* http://ruby-oci8.rubyforge.org/en/ReportInstallProblem.html



Gem files will remain installed in /opt/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.0.4 for inspection.
Results logged to /opt/ruby-1.9.1-p376/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.0.4/ext/oci8/gem_make.out

1 comment:

  1. I have installed oracle database (linux64_11gR2_database) ... after running the cmd ./runInstaller i m getting this error ..
    /home/vuserver/neworacle/database/install/.oui: 2: Syntax error: ")" unexpected

    ple help me out ....

    ReplyDelete