Connecting to Oracle (Solaris Sparc 10)

My company’s System-admin installed Ruby and Gems (using Sun Coolstack
package) and I have sudo access to ruby, gem etc. Now I need to get my
app to talk to oracle db (through network).
From what I understand, it requires three steps:
Step 1: Install oracle instant client ( I installed it in my ~/oracle/
instantclient_11_1)
Step2: Install OCI8 libraries (this is where I am stuck). Here is the
error message:
ERROR MESSAGE****

bash-3.00$ sudo gem install ruby-oci8
Building native extensions. This could take a while…
ERROR: Error installing ruby-oci8:
ERROR: Failed to build gem native extension.

/opt/coolstack/bin/ruby extconf.rb
checking for load library path…
LD_LIBRARY_PATH_32 is not set.
LD_LIBRARY_PATH is not set.
checking for cc… *** 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/coolstack/bin/ruby
–with-instant-client
–without-instant-client
./oraconf.rb:557:in check_cc': RuntimeError (RuntimeError) from ./oraconf.rb:544:in init’
from ./oraconf.rb:674:in initialize' from ./oraconf.rb:345:in new’
from ./oraconf.rb:345:in `get’
from extconf.rb:17
ng

error messages:
C compiler doesn’t work correctly.

See:

Gem files will remain installed in /opt/coolstack/lib/ruby/gems/1.8/
gems/ruby-oci8-2.0.2 for inspection.
Results logged to /opt/coolstack/lib/ruby/gems/1.8/gems/ruby-
oci8-2.0.2/ext/oci8/gem_make.out
END ERROR MESSAGE****
I already have gcc on the system. Here is my PATH:

bash-3.00$ echo $PATH
/export/home/roradmin1/bin:/usr/local/bin:/usr/bin:/etc:/opt/EMCpower/
bin/sparcv9:/etc/emc/bin:/usr/local/bin/:/opt/coolstack/bin:/usr/sfw/
bin:/usr/ucb:/usr/local/bin/:/opt/coolstack/bin:/usr/sfw/bin:/usr/ucb:/
opt/coolstack/lib/ruby:/opt/coolstack/lib:/export/home/roradmin1/.gem/
ruby/1.8/bin

bash-3.00$ echo $LD_LIBRARY_PATH
/usr/local/ssl/lib/:/usr/local/lib/:/export/home/roradmin1/oracle/
instantclient_11_1
bash-3.00$

bash-3.00$ echo $LD_LIBRARY_PATH_32
/usr/local/ssl/lib/:/usr/local/lib/:/export/home/roradmin1/oracle/
instantclient_11_1

Can you please help? I am new to UNIX and don’t have full root access
so I am pulling my hair out right now.

Thanks.

On Sep 16, 2:05 pm, catel1 [email protected] wrote:

bash-3.00$ sudo gem install ruby-oci8
necessary libraries and/or headers. Check the mkmf.log file for more
–without-make-prog
–srcdir=.
–curdir
–ruby=/opt/coolstack/bin/ruby
–with-instant-client
–without-instant-client

Does it work if you try “sudo gem install ruby-oci – --with-instant-
client” ?

If not, try setting $ORACLE_HOME to wherever you installed the instant
client and try again.

If that still doesn’t work, this blog post may be of interest:

http://ktulu.com.ar/blog/2009/01/30/installing-ruby-oci8-with-oracle-instant-client-11g/

(In short, it looks like the directory layout changed in 11g)

Regards,

Dan

On Wed, Sep 16, 2009 at 3:05 PM, catel1 [email protected] wrote:

bash-3.00$ sudo gem install ruby-oci8
Building native extensions. This could take a while…
checking for cc… *** extconf.rb failed ***

This is because you’re missing Ruby dev libraries.

In my setup I have these set:

LD_LIBRARY_PATH=/usr/local/lib
ORACLE_HOME=/home/oracle

C compiler doesn’t work correctly.

Looks like you need a compiler too.


Greg D.
http://destiney.com/

Sorry, what did you mean by this?
**
Does it work if you try “sudo gem install ruby-oci – --with-instant-
client” ?
**

sudo gem install ruby-oci – --with-instant-client
(Is the syntax correct? I get error when I paste it as it is)
Also, I think when I do “sudo”, the path information is not passed.

Thanks
Catel

On Wed, Sep 16, 2009 at 6:30 PM, catel1 [email protected] wrote:

Sorry, what did you mean by this?
**
Does it work if you try “sudo gem install ruby-oci – --with-instant-
client” ?
**

sudo gem install ruby-oci – --with-instant-client
(Is the syntax correct? I get error when I paste it as it is)
Also, I think when I do “sudo”, the path information is not passed.

Can you become root using sudo su - ?

Failing that you can augment your PATH by doing:

export PATH=“/path/to/new/stuff:$PATH”


Greg D.
http://destiney.com/

No, I can’t become su - root. If it’s something very critical, I can
request SA (root) for his time. But I don’t know when he’d be free.

So, my questions:

  1. Do you think it’s a compiler (cc) issue ? It does say “C compiler
    doesn’t work correctly”. I already have gcc in path. I also created a
    symbolic link cc -> gcc
  2. It does find Oracle Instant Client in the directory
    bash-3.00$ echo $LD_LIBRARY_PATH
    /usr/local/ssl/lib/:/usr/local/lib/:/export/home/roradmin1/oracle/
    instantclient_11_1
    bash-3.00$

bash-3.00$ echo $LD_LIBRARY_PATH_32
/usr/local/ssl/lib/:/usr/local/lib/:/export/home/roradmin1/oracle/
instantclient_11_1

Thanks.,

There is no CC enviornment variable.
I have cc-> gcc in /export/home/roradmin1/bin
and /export/home/roradmin1/bin is in PATH environment variable.

There is no CC enviornment variable.
I have cc-> gcc in /export/home/roradmin1/bin
and /export/home/roradmin1/bin is in PATH environment variable.

On Wed, Sep 16, 2009 at 7:58 PM, catel1 [email protected] wrote:

  1. Do you think it’s a compiler (cc) issue ? It does say "C compiler

What’s your CC environment variable set to? Does it point to your gcc?


Greg D.
http://destiney.com/

On Wed, Sep 16, 2009 at 8:15 PM, catel1 [email protected] wrote:

There is no CC enviornment variable.

Export one then.

I have cc-> gcc in /export/home/roradmin1/bin
and /export/home/roradmin1/bin is in PATH environment variable.

Does gcc actually work?


Greg D.
http://destiney.com/

Thanks for your reply. I installed Sun Studio 12 and put it in path.
But I still get the same error message


bash-3.00$ pwd
/export/home/roradmin1/ruby-oci8-1.0.6
bash-3.00$ ruby setup.rb config
—> lib
—> lib/dbd
<— lib/dbd
<— lib
—> ext
—> ext/oci8
/opt/coolstack/bin/ruby /export/home/roradmin1/ruby-oci8-1.0.6/ext/
oci8/extconf.rb
setup.rb:476: warning: Insecure world writable dir /opt/coolstack/lib/
ruby in PATH, mode 040777
checking for load library path…
LD_LIBRARY_PATH_32…
checking /usr/local/ssl/lib/… no
checking /usr/local/lib/… no
checking /export/home/roradmin1/oracle/instantclient_11_1… yes
/export/home/roradmin1/oracle/instantclient_11_1/libclntsh.so.11.1
looks like an instant client.
checking for cc… ng

error messages:
C compiler doesn’t work correctly.

See:

*** /export/home/roradmin1/ruby-oci8-1.0.6/ext/oci8/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=/export/home/roradmin1/ruby-oci8-1.0.6/ext/oci8
–curdir
–ruby=/opt/coolstack/bin/ruby
–with-instant-client
–without-instant-client
/export/home/roradmin1/ruby-oci8-1.0.6/ext/oci8/oraconf.rb:557:in
check_cc': RuntimeError (RuntimeError) from /export/home/roradmin1/ruby-oci8-1.0.6/ext/oci8/ oraconf.rb:544:in init’
from /export/home/roradmin1/ruby-oci8-1.0.6/ext/oci8/
oraconf.rb:972:in initialize' from /export/home/roradmin1/ruby-oci8-1.0.6/ext/oci8/ oraconf.rb:343:in new’
from /export/home/roradmin1/ruby-oci8-1.0.6/ext/oci8/
oraconf.rb:343:in `get’
from /export/home/roradmin1/ruby-oci8-1.0.6/ext/oci8/
extconf.rb:24
'system /opt/coolstack/bin/ruby /export/home/roradmin1/ruby-oci8-1.0.6/
ext/oci8/extconf.rb ’ failed
Try ‘ruby setup.rb --help’ for detailed usage.
bash-3.00$
END ERROR MESSAGE***********

So,

  1. it does find oracle instant client in export/home/roradmin1/oracle/
    instantclient_11_1
  2. it still complains about cc compiler (I have tried gcc as well)

I am close to committing suicide! Can anyone help me with this?

Thanks

There is no CC enviornment variable. cc is in path
cc (pointing to gcc) is located at /export/home/roradmin1/bin
and it is in PATH.

Just to let everyone know. This problem has been FIXED. Here is what I
did:

  1. install Sun Studio 12.1
  2. edited rbconfig.rb and included path of sun’s “cc” compiler that
    came with Sun Studio.
    and then it started working fine.