kubo / ruby-oci8

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

Unable to compile on macos bigsur #228

Open coding-bunny opened 3 years ago

coding-bunny commented 3 years ago

Hello,

I'm unable to get the client to compile under macos bigsur. I have the Oracle Instant Client v12 installed as we use this for other projects well, but one legacy project seems to have issues installing this properly.

The project originally uses ruby-oci8 2.1.5 on Ruby 1.9.3 (Old I Know)

When not setting any ENV vars, this is what happens:

Fetching ruby-oci8 2.1.5
Installing ruby-oci8 2.1.5 with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /Users/olivar/.rbenv/versions/1.9.3-p551/bin/ruby extconf.rb --with-instant-client=/usr/local/opt/oracle-instant-client
=======================================================

  '--with-instant-client' is an obsolete option. ignore it.

=======================================================
checking for load library path... 
  DYLD_LIBRARY_PATH is not set.
checking for cc... ok
checking for gcc... yes
checking for LP64... yes
checking for sys/types.h... 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=/Users/olivar/.rbenv/versions/1.9.3-p551/bin/ruby
        --with-instant-client
/Users/olivar/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:889:in `get_home': RuntimeError (RuntimeError)
        from /Users/olivar/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:705:in `initialize'
        from /Users/olivar/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:320:in `new'
        from /Users/olivar/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:320:in `get'
        from extconf.rb:18:in `<main>'
---------------------------------------------------
Error Message:
  Set the environment variable ORACLE_HOME if Oracle Full Client.
  Append the path of Oracle client libraries to DYLD_LIBRARY_PATH if Oracle Instant Client.

Backtrace:
  /Users/olivar/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:889:in `get_home'
  /Users/olivar/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:705:in `initialize'
  /Users/olivar/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:320:in `new'
  /Users/olivar/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:320:in `get'
  extconf.rb:18:in `<main>'
---------------------------------------------------
See:
 * http://ruby-oci8.rubyforge.org/en/HowToInstall.html
 * http://ruby-oci8.rubyforge.org/en/ReportInstallProblem.html

Gem files will remain installed in /Users/olivar/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.1.5 for inspection.
Results logged to /Users/olivar/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.1.5/ext/oci8/gem_make.out

An error occurred while installing ruby-oci8 (2.1.5), and Bundler cannot continue.
Make sure that `gem install ruby-oci8 -v '2.1.5' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  oracle_query was resolved to 0.1.6, which depends on
    ruby-oci8

Not sure if this is a client problem or a macos Big Sur issue.

kubo commented 3 years ago

Is it Intel Mac? Otherwise, M1 Mac?

How did you install instant client? It is installed at /usr/local/opt/oracle-instant-client? Let me know file names in the directory by ls -l /usr/local/opt/oracle-instant-client?

coding-bunny commented 3 years ago

This is an Intel Mac. The client is installed with Homebrew, we have our custom tap, but the principle is exactly the same as described in the documentation for homebrew, we just have the files hosted ourselves.

brew --prefix oracle-instant-client
/usr/local/opt/oracle-instant-client
ls -l /usr/local/opt/oracle-instant-client
lrwxr-xr-x  1 olivar  admin  42 Jan 18 10:29 /usr/local/opt/oracle-instant-client -> ../Cellar/oracle-instant-client/12.2.0.1.0
kubo commented 3 years ago

Instant client 12.2.0.1.0 is too old. It doesn't run on Big Sur.

Could you use instant client 19.8? See https://www.oracle.com/database/technologies/instant-client/macos-intel-x86-downloads.html#ic_osx_inst

coding-bunny commented 3 years ago

I'll have to run this through our teams as this will have a major impact.