kubo / ruby-oci8

Ruby-oci8 - Oracle interface for ruby
Other
169 stars 75 forks source link

Error installing ruby-oci8 on ubuntu 14.04 x64 #65

Closed rafaeldl closed 9 years ago

rafaeldl commented 9 years ago

Hi,

I'm using ubuntu 14.04 x64 with the following environment variables:

export ORACLE_HOME=/usr/lib/oracle/12.1/client64
export LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib
export PATH=$ORACLE_HOME/bin:$PATH

The Sqlplus works fine!

But when i try install the ruby-oci8 gem, the system returns me the error below:

bundle exec gem install ruby-oci8 --backtrace
Building native extensions.  This could take a while...
ERROR:  Error installing ruby-oci8:
    ERROR: Failed to build gem native extension.

    /opt/rbenv/versions/2.1.2/bin/ruby extconf.rb
/opt/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/spec_set.rb:92:in `block in materialize': Could not find ruby-oci8-2.1.7 in any of the sources (Bundler::GemNotFound)
    from /opt/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/spec_set.rb:85:in `map!'
    from /opt/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/spec_set.rb:85:in `materialize'
    from /opt/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/definition.rb:132:in `specs'
    from /opt/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/definition.rb:177:in `specs_for'
    from /opt/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/definition.rb:166:in `requested_specs'
    from /opt/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/environment.rb:18:in `requested_specs'
    from /opt/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/runtime.rb:13:in `setup'
    from /opt/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler.rb:121:in `setup'
    from /opt/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/setup.rb:17:in `<top (required)>'
    from /opt/rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /opt/rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'

extconf failed, exit code 1

Gem files will remain installed in /u/apps/poseidon_kco_production/shared/bundle/ruby/2.1.0/gems/ruby-oci8-2.1.7 for inspection.
Results logged to /u/apps/poseidon_kco_production/shared/bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0/ruby-oci8-2.1.7/gem_make.out

Anyone know what could be happening?

kubo commented 9 years ago

Did you install the Oracle instant client SDK package in addition to sqlplus? If you cannot compile ruby-oci8 with the SDK package, look at the following link and report again. http://www.rubydoc.info/gems/ruby-oci8/file/docs/report-installation-issue.md

rafaeldl commented 9 years ago

$ file `which ruby`
/opt/rbenv/shims/ruby: Pascal source, ASCII text

$  ruby --version
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]

$  ruby -r rbconfig -e "p Config::CONFIG['host']"
-e:1:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
-e:1:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
"x86_64-unknown-linux-gnu"

$  ruby -r rbconfig -e "p Config::CONFIG['CC']"
-e:1:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
-e:1:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
"gcc"
$  ruby -r rbconfig -e "p Config::CONFIG['CFLAGS']"
-e:1:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
-e:1:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
" -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration  -fPIC"

$  ruby -r rbconfig -e "p Config::CONFIG['LDSHARED']"
-e:1:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
-e:1:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
"gcc -shared"

$  ruby -r rbconfig -e "p Config::CONFIG['LDFLAGS']"
-e:1:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
-e:1:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
"-L. -L/tmp/2.1.2/lib  -fstack-protector -rdynamic -Wl,-export-dynamic"

$  ruby -r rbconfig -e "p Config::CONFIG['DLDLAGS']"
-e:1:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
-e:1:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
nil

$  ruby -r rbconfig -e "p Config::CONFIG['LIBS']"
-e:1:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
-e:1:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
"-lpthread -ldl -lcrypt -lm "

$  ruby -r rbconfig -e "p Config::CONFIG['GNU_LD']"
-e:1:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
-e:1:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
"yes"

$  gcc --print-prog-name=ld
ld

$  gcc --print-prog-name=as
as

$ file $ORACLE_HOME/libclntsh.*
/opt/oracle/instantclient_12_1/libclntsh.so:      symbolic link to `libclntsh.so.12.1' 
/opt/oracle/instantclient_12_1/libclntsh.so.12.1: ELF 32-bit LSB  shared object, Intel 80386, version 1 (SYSV), dynamically linked, not stripped

$ echo $LD_LIBRARY_PATH
/opt/oracle/instantclient_12_1
rafaeldl commented 9 years ago

build error:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /opt/rbenv/versions/2.1.2/bin/ruby extconf.rb 
checking for load library path... 
  LD_LIBRARY_PATH... 
    checking /opt/oracle/instantclient_12_1...   skip: /opt/oracle/instantclient_12_1/libclntsh.so.12.1 is for i386 cpu.
  checking ld.so.conf... no
checking for cc... ok
checking for gcc... yes
checking for LP64... yes
checking for sys/types.h... yes
checking for ruby header... ok
Get the version of Oracle from SQL*Plus... *** 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/rbenv/versions/2.1.2/bin/ruby
    --with-instant-client
    --without-instant-client
/u/apps/poseidon_kco_production/shared/bundle/ruby/2.1.0/gems/ruby-oci8-2.1.7/ext/oci8/oraconf.rb:762:in `get_version': RuntimeError (RuntimeError)
    from /u/apps/poseidon_kco_production/shared/bundle/ruby/2.1.0/gems/ruby-oci8-2.1.7/ext/oci8/oraconf.rb:711:in `initialize'
    from /u/apps/poseidon_kco_production/shared/bundle/ruby/2.1.0/gems/ruby-oci8-2.1.7/ext/oci8/oraconf.rb:320:in `new'
    from /u/apps/poseidon_kco_production/shared/bundle/ruby/2.1.0/gems/ruby-oci8-2.1.7/ext/oci8/oraconf.rb:320:in `get'
    from extconf.rb:18:in `<main>'
---------------------------------------------------
Error Message:
  cannot get Oracle version from sqlplus
Backtrace:
  /u/apps/poseidon_kco_production/shared/bundle/ruby/2.1.0/gems/ruby-oci8-2.1.7/ext/oci8/oraconf.rb:762:in `get_version'
  /u/apps/poseidon_kco_production/shared/bundle/ruby/2.1.0/gems/ruby-oci8-2.1.7/ext/oci8/oraconf.rb:711:in `initialize'
  /u/apps/poseidon_kco_production/shared/bundle/ruby/2.1.0/gems/ruby-oci8-2.1.7/ext/oci8/oraconf.rb:320:in `new'
  /u/apps/poseidon_kco_production/shared/bundle/ruby/2.1.0/gems/ruby-oci8-2.1.7/ext/oci8/oraconf.rb:320:in `get'
  extconf.rb:18:in `<main>'
---------------------------------------------------
See:
 * http://rubydoc.info/gems/ruby-oci8/file/docs/install-full-client.md for Oracle full client
 * http://rubydoc.info/gems/ruby-oci8/file/docs/install-instant-client.md for Oracle instant client
 * http://ruby-oci8.rubyforge.org/en/file.report-installation-issue.html to report an issue.

extconf failed, exit code 1

Gem files will remain installed in /u/apps/poseidon_kco_production/shared/bundle/ruby/2.1.0/gems/ruby-oci8-2.1.7 for inspection.
Results logged to /u/apps/poseidon_kco_production/shared/bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0/ruby-oci8-2.1.7/gem_make.out
An error occurred while installing ruby-oci8 (2.1.7), and Bundler cannot
continue.
Make sure that `gem install ruby-oci8 -v '2.1.7'` succeeds before
bundling.
rafaeldl commented 9 years ago

Oracle dir:

ti@SRV-PORTAL:/opt/oracle/instantclient_12_1$ ls
BASIC_README    libclntsh.so.12.1      libons.so         sdk
SQLPLUS_README  libclntshcore.so.12.1  liboramysql12.so  sqlplus
adrci           libnnz12.so            libsqlplus.so     uidrvci
genezi          libocci.so.12.1        libsqlplusic.so   xstreams.jar
glogin.sql      libociei.so            ojdbc6.jar
libclntsh.so    libocijdbc12.so        ojdbc7.jar
kubo commented 9 years ago
$  ruby --version
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]

The ruby is x86_64-linux.

$ file $ORACLE_HOME/libclntsh.*
/opt/oracle/instantclient_12_1/libclntsh.so:      symbolic link to `libclntsh.so.12.1' 
/opt/oracle/instantclient_12_1/libclntsh.so.12.1: ELF 32-bit LSB  shared object, Intel 80386, version 1 (SYSV), dynamically linked, not stripped

The Oracle instant client is i386.

checking for load library path... 
  LD_LIBRARY_PATH... 
    checking /opt/oracle/instantclient_12_1...   skip: /opt/oracle/instantclient_12_1/libclntsh.so.12.1 is for i386 cpu.

Therefore the build script skipped the Oracle instant client.

You need to use x86_64 Oracle instant client.

rafaeldl commented 9 years ago

Hello Kubo,

I installed the Oracle 64 bits and now when i execute bundle or make and make install, its works with Deploy user. But when i deploy the project or i execute bundle exec, its show me the below error.

$ bundle exec 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/rbenv/versions/2.1.5/bin/ruby extconf.rb
/opt/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/spec_set.rb:92:in `block in materialize': Could not find ruby-oci8-2.1.7 in any of the sources (Bundler::GemNotFound)
    from /opt/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/spec_set.rb:85:in `map!'
    from /opt/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/spec_set.rb:85:in `materialize'
    from /opt/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/definition.rb:132:in `specs'
    from /opt/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/definition.rb:177:in `specs_for'
    from /opt/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/definition.rb:166:in `requested_specs'
    from /opt/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/environment.rb:18:in `requested_specs'
    from /opt/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/runtime.rb:13:in `setup'
    from /opt/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler.rb:121:in `setup'
    from /opt/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/lib/bundler/setup.rb:17:in `<top (required)>'
    from /opt/rbenv/versions/2.1.5/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /opt/rbenv/versions/2.1.5/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'

extconf failed, exit code 1

Gem files will remain installed in /u/apps/poseidon_kco_production/shared/bundle/ruby/2.1.0/gems/ruby-oci8-2.1.7 for inspection.
Results logged to /u/apps/poseidon_kco_production/shared/bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0-static/ruby-oci8-2.1.7/gem_make.out
$ file $ORACLE_HOME/libclntsh.*
/opt/oracle/instantclient_12_1//libclntsh.so:      symbolic link to `libclntsh.so.12.1' 
/opt/oracle/instantclient_12_1//libclntsh.so.12.1: ELF 64-bit LSB  shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped
$ make
ruby -w setup.rb config
setup.rb:280: warning: assigned but unused variable - vname
setup.rb:280: warning: assigned but unused variable - desc
setup.rb:280: warning: assigned but unused variable - default2
---> lib
---> lib/dbd
<--- lib/dbd
---> lib/oci8
<--- lib/oci8
<--- lib
---> ext
---> ext/oci8
/opt/rbenv/versions/2.1.2/bin/ruby /u/apps/poseidon_kco_production/shared/bundle/ruby/2.1.0/gems/ruby-oci8-2.1.7/ext/oci8/extconf.rb 
checking for load library path... 
  LD_LIBRARY_PATH... 
    checking /opt/oracle/instantclient_12_1/... yes
  /opt/oracle/instantclient_12_1/libclntsh.so.12.1 looks like an instant client.
checking for cc... ok
checking for gcc... yes
checking for LP64... yes
checking for sys/types.h... yes
checking for ruby header... ok
checking for OCIInitialize() in oci.h... yes
checking for Oracle 8.1.0 API - start
checking for OCIEnvCreate()... yes
checking for OCILobClose()... yes
checking for OCILobCreateTemporary()... yes
checking for OCILobFreeTemporary()... yes
checking for OCILobGetChunkSize()... yes
checking for OCILobIsTemporary()... yes
checking for OCILobLocatorAssign()... yes
checking for OCILobOpen()... yes
checking for OCIMessageGet()... yes
checking for OCIMessageOpen()... yes
checking for OCINumberIsInt()... yes
checking for OCINumberPrec()... yes
checking for OCINumberSetPi()... yes
checking for OCINumberShift()... yes
checking for OCINumberSign()... yes
checking for OCIReset()... yes
checking for Oracle 8.1.0 API - pass
checking for Oracle 9.0.0 API - start
checking for OCIConnectionPoolCreate()... yes
checking for OCIConnectionPoolDestroy()... yes
checking for OCIDateTimeConstruct()... yes
checking for OCIDateTimeGetDate()... yes
checking for OCIDateTimeGetTime()... yes
checking for OCIDateTimeGetTimeZoneOffset()... yes
checking for OCIIntervalFromText()... yes
checking for OCIIntervalGetDaySecond()... yes
checking for OCIIntervalGetYearMonth()... yes
checking for OCIIntervalSetDaySecond()... yes
checking for OCIIntervalSetYearMonth()... yes
checking for OCILogon2()... yes
checking for OCIRowidToChar()... yes
checking for OCIServerRelease()... yes
checking for Oracle 9.0.0 API - pass
checking for Oracle 9.2.0 API - start
checking for OCINlsCharSetIdToName()... yes
checking for OCINlsCharSetNameToId()... yes
checking for OCIStmtPrepare2()... yes
checking for OCIStmtRelease()... yes
checking for Oracle 9.2.0 API - pass
checking for Oracle 10.1.0 API - start
checking for OCILobGetLength2()... yes
checking for OCILobRead2()... yes
checking for OCILobTrim2()... yes
checking for OCILobWrite2()... yes
checking for Oracle 10.1.0 API - pass
checking for Oracle 10.2.0 API - start
checking for OCIClientVersion()... yes
checking for OCIDBShutdown()... yes
checking for OCIDBStartup()... yes
checking for OCIPing()... yes
checking for Oracle 10.2.0 API - pass
checking for Oracle 11.1.0 API - start
checking for OCIArrayDescriptorAlloc()... yes
checking for OCIArrayDescriptorFree()... yes
checking for Oracle 11.1.0 API - pass
checking for oratext in ociap.h... yes
checking for OCIDateTime* in ociap.h... yes
checking for OCIInterval* in ociap.h... yes
checking for OCICallbackLobRead2 in ociap.h... yes
checking for OCICallbackLobWrite2 in ociap.h... yes
checking for OCIAdmin* in ociap.h... yes
checking for OCIAuthInfo* in ociap.h... yes
checking for OCIMsg* in ociap.h... yes
checking for OCICPool* in ociap.h... yes
checking for localtime_r()... yes
checking for dladdr()... yes
checking for intern.h... no
checking for util.h... yes
checking for ruby/util.h... yes
checking for rb_encoding in ruby/ruby.h,ruby/encoding.h... yes
checking for ruby/thread.h... yes
checking for ruby_errinfo in ruby.h... no
checking for rb_errinfo() in ruby.h... yes
checking for rb_set_end_proc() in ruby.h... yes
checking for rb_class_superclass() in ruby.h... yes
checking for rb_thread_blocking_region() in ruby.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
creating ../../lib/oci8.rb from /u/apps/poseidon_kco_production/shared/bundle/ruby/2.1.0/gems/ruby-oci8-2.1.7/ext/oci8/../../lib/oci8.rb.in
creating extconf.h
creating Makefile
<--- ext/oci8
<--- ext
ruby -w setup.rb setup
setup.rb:280: warning: assigned but unused variable - vname
setup.rb:280: warning: assigned but unused variable - desc
setup.rb:280: warning: assigned but unused variable - default2
---> lib
---> lib/dbd
<--- lib/dbd
---> lib/oci8
<--- lib/oci8
<--- lib
---> ext
---> ext/oci8
make 
make[1]: Entering directory `/u/apps/poseidon_kco_production/shared/bundle/ruby/2.1.0/gems/ruby-oci8-2.1.7/ext/oci8'
compiling oci8lib.c
compiling env.c
compiling error.c
compiling oci8.c
compiling ocihandle.c
compiling connection_pool.c
compiling stmt.c
compiling bind.c
compiling metadata.c
compiling attr.c
compiling lob.c
compiling oradate.c
compiling ocinumber.c
compiling ocidatetime.c
compiling object.c
compiling apiwrap.c
compiling encoding.c
compiling oranumber_util.c
compiling thread_util.c
linking shared-object oci8lib_210.so
make[1]: Leaving directory `/u/apps/poseidon_kco_production/shared/bundle/ruby/2.1.0/gems/ruby-oci8-2.1.7/ext/oci8'
<--- ext/oci8
<--- ext

Any idea?

Thanks.

kubo commented 9 years ago

Could you post /u/apps/poseidon_kco_production/shared/bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0-static/ruby-oci8-2.1.7/gem_make.out?

kubo commented 9 years ago

Close because of no reply for a long time.