kubo / ruby-oci8

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

unable to install oci-8 on mac #163

Closed nitashah closed 5 years ago

nitashah commented 7 years ago

Get this error have checked all environment variables

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

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb

checking for load library path... 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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby --with-instant-client --without-instant-client /Library/Ruby/Gems/2.0.0/gems/ruby-oci8-2.2.3/ext/oci8/oraconf.rb:575:in check_ic_dir': RuntimeError (RuntimeError) from /Library/Ruby/Gems/2.0.0/gems/ruby-oci8-2.2.3/ext/oci8/oraconf.rb:316:inget' from extconf.rb:22:in `
' DYLD_LIBRARY_PATH is not set. DYLD_FALLBACK_LIBRARY_PATH is not set. checking OCI_DIR... checking the default value of DYLD_FALLBACK_LIBRARY_PATH... checking /Users/nitshah/lib... no checking /usr/local/lib... no checking /lib... no checking /usr/lib... no

Error Message: Set the environment variable DYLD_LIBRARY_PATH, DYLD_FALLBACK_LIBRARY_PATH or OCI_DIR to point to the Instant client directory.

If DYLD_LIBRARY_PATH or DYLD_FALLBACK_LIBRARY_PATH is set, the environment variable must be set at runtime also.

If OCI_DIR is set, dependent shared library paths are checked. If the checking is passed, ruby-oci8 works without DYLD_LIBRARY_PATH or DYLD_FALLBACK_LIBRARY_PATH.

Note: OCIDIR should be absolute path. Note: DYLD* environment variables are unavailable for security reasons on OS X 10.11 El Capitan.

Backtrace: /Library/Ruby/Gems/2.0.0/gems/ruby-oci8-2.2.3/ext/oci8/oraconf.rb:575:in check_ic_dir' /Library/Ruby/Gems/2.0.0/gems/ruby-oci8-2.2.3/ext/oci8/oraconf.rb:316:inget' extconf.rb:22:in `
'

See:

Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/ruby-oci8-2.2.3 for inspection. Results logged to /Library/Ruby/Gems/2.0.0/gems/ruby-oci8-2.2.3/ext/oci8/gem_make.out

kubo commented 7 years ago

udo gem install ruby-oci8

If this line is sudo gem install ruby-oci8, you need to set OCI_DIR and use sudo env OCI_DIR=$OCI_DIR gem install ruby-oci8 because sudo on mac unsets environment variables.

nitashah commented 7 years ago

Tried that still getting same error as above.

nitashah commented 7 years ago

actually this is the error I get now

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

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb

checking for load library path... DYLD_LIBRARY_PATH is not set. DYLD_FALLBACK_LIBRARY_PATH is not set. checking OCI_DIR... checking /opt/oracle/instantclient_11_2... yes checking dependent shared libraries in /opt/oracle/instantclient_11_2/libclntsh.dylib.11.1... /opt/oracle/instantclient_11_2/libclntsh.dylib.11.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 OCIEnvCreate() in oci.h... no 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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby --with-instant-client --without-instant-client /Library/Ruby/Gems/2.0.0/gems/ruby-oci8-2.2.3/ext/oci8/oraconf.rb:1160:in block in initialize': RuntimeError (RuntimeError) from /Library/Ruby/Gems/2.0.0/gems/ruby-oci8-2.2.3/ext/oci8/oraconf.rb:1128:inopen' from /Library/Ruby/Gems/2.0.0/gems/ruby-oci8-2.2.3/ext/oci8/oraconf.rb:1128:in initialize' from /Library/Ruby/Gems/2.0.0/gems/ruby-oci8-2.2.3/ext/oci8/oraconf.rb:318:innew' from /Library/Ruby/Gems/2.0.0/gems/ruby-oci8-2.2.3/ext/oci8/oraconf.rb:318:in get' from extconf.rb:22:in
'

Error Message: Could not compile with Oracle instant client. You may need to set the environment variable RC_ARCHS or ARCHFLAGS as follows:

  RC_ARCHS=x86_64
  export RC_ARCHS

or ARCHFLAGS='-arch x86_64' export RC_ARCHS

If it does not fix the problem, delete all '-arch i386' in '/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin15/rbconfig.rb'.

Backtrace: /Library/Ruby/Gems/2.0.0/gems/ruby-oci8-2.2.3/ext/oci8/oraconf.rb:1160:in block in initialize' /Library/Ruby/Gems/2.0.0/gems/ruby-oci8-2.2.3/ext/oci8/oraconf.rb:1128:inopen' /Library/Ruby/Gems/2.0.0/gems/ruby-oci8-2.2.3/ext/oci8/oraconf.rb:1128:in initialize' /Library/Ruby/Gems/2.0.0/gems/ruby-oci8-2.2.3/ext/oci8/oraconf.rb:318:innew' /Library/Ruby/Gems/2.0.0/gems/ruby-oci8-2.2.3/ext/oci8/oraconf.rb:318:in get' extconf.rb:22:in
'

See:

Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/ruby-oci8-2.2.3 for inspection. Results logged to /Library/Ruby/Gems/2.0.0/gems/ruby-oci8-2.2.3/ext/oci8/gem_make.out

kubo commented 7 years ago

What version of OS do you use? What version of ruby do you use? What version of Oracle instant client do you use?

checking for OCIEnvCreate() in oci.h... no

Have you installed Oracle instant client SDK package?.

nitashah commented 7 years ago

Hi now its working but I get this error when i run code which requires oci8

/Users/nitshah/.rvm/gems/ruby-2.3.0/gems/sequel-4.33.0/lib/sequel/adapters/oracle.rb:3:in require': LoadError: cannot load such file -- oci8 (Sequel::AdapterNotFound) from /Users/nitshah/.rvm/gems/ruby-2.3.0/gems/sequel-4.33.0/lib/sequel/adapters/oracle.rb:3:in<top (required)>' from /Users/nitshah/.rvm/gems/ruby-2.3.0/gems/sequel-4.33.0/lib/sequel/database/connecting.rb:98:in require' from /Users/nitshah/.rvm/gems/ruby-2.3.0/gems/sequel-4.33.0/lib/sequel/database/connecting.rb:98:inload_adapter' from /Users/nitshah/.rvm/gems/ruby-2.3.0/gems/sequel-4.33.0/lib/sequel/database/connecting.rb:28:in adapter_class' from /Users/nitshah/.rvm/gems/ruby-2.3.0/gems/sequel-4.33.0/lib/sequel/database/connecting.rb:47:inconnect' from /Users/nitshah/.rvm/gems/ruby-2.3.0/gems/sequel-4.33.0/lib/sequel/core.rb:108:in connect' from /Users/nitshah/msmonitor/helper/common/db_sql_helper.rb:9:ininitialize'

kubo commented 7 years ago

What version of OS do you use? What version of ruby do you use? What version of Oracle instant client do you use?

In your first post, you used the ruby bundled in mac because the back trace includes /Library/Ruby/Gems/. In the last post, you used a ruby installed by rvm because the back trace includes /Users/nitshah/.rvm/gems/. I guess that ruby-oci8 was installed to the bundled ruby. You need to install ruby-oci8 to the rvm ruby.

nitashah commented 7 years ago

Mac os x el caption 10.11.6 Yes how do I do that? install ruby-oci8 to /Users/nitshah/.rvm/gems/. ?

Thanks

nitashah commented 7 years ago

Hi installed the gem here

sudo env OCI_DIR=$OCI_DIR ./gem install ruby-oci8 Password: Sorry, try again. Password: Building native extensions. This could take a while... Successfully installed ruby-oci8-2.2.3 Parsing documentation for ruby-oci8-2.2.3 1 gem installed LM-SJN-21001407:bin nitshah$ pwd /Users/nitshah/.rvm/rubies/ruby-2.3.0/bin

However from rubymine still get this error

/Users/nitshah/.rvm/rubies/ruby-2.3.0/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/nitshah/msmonitor/helper/common/db_sql_helper.rb /Users/nitshah/.rvm/gems/ruby-2.3.0/gems/sequel-4.33.0/lib/sequel/adapters/oracle.rb:3:in require': LoadError: cannot load such file -- oci8 (Sequel::AdapterNotFound) from /Users/nitshah/.rvm/gems/ruby-2.3.0/gems/sequel-4.33.0/lib/sequel/adapters/oracle.rb:3:in<top (required)>' from /Users/nitshah/.rvm/gems/ruby-2.3.0/gems/sequel-4.33.0/lib/sequel/database/connecting.rb:98:in require' from /Users/nitshah/.rvm/gems/ruby-2.3.0/gems/sequel-4.33.0/lib/sequel/database/connecting.rb:98:inload_adapter' from /Users/nitshah/.rvm/gems/ruby-2.3.0/gems/sequel-4.33.0/lib/sequel/database/connecting.rb:28:in adapter_class' from /Users/nitshah/.rvm/gems/ruby-2.3.0/gems/sequel-4.33.0/lib/sequel/database/connecting.rb:47:inconnect' from /Users/nitshah/.rvm/gems/ruby-2.3.0/gems/sequel-4.33.0/lib/sequel/core.rb:108:in connect' from /Users/nitshah/msmonitor/helper/common/db_sql_helper.rb:10:ininitialize' from /Users/nitshah/msmonitor/helper/common/db_sql_helper.rb:58:in new' from /Users/nitshah/msmonitor/helper/common/db_sql_helper.rb:58:in<top (required)>' from -e:1:in load' from -e:1:in

'

Process finished with exit code 1

Please help

kubo commented 7 years ago

Could you try to install ruby-oci8 without sudo?

kubo commented 5 years ago

This issue was closed. If you still have problems, open a new issue.

Piush-Gupta-Firm commented 3 years ago

@kubo can you plz help me on following https://stackoverflow.com/questions/67253768/bundle-is-failing-due-to-ruby-oci8-gem-for-ruby-version-2-7-1