Installing activerecord-oracle_enhanced-adapter in a Docker container

121 views
Skip to first unread message

Serguei Cambour

unread,
Jul 11, 2018, 8:28:57 AM7/11/18
to Oracle enhanced adapter for ActiveRecord
Are there any special steps to follow (I didn't find any in README) when installing activerecord-oracle_enhanced-adapter gem in a Docker container ?
I added theses 2 gems to Gemfile of the app:

  gem 'activerecord-oracle_enhanced-adapter', '~> 5.2.0'
  gem
'ruby-oci8'

and everything was installed fine on macOS.

But when running bundle install fro inside the Docker container the same app is packed to, it failed:

Fetching rspec-mocks 3.7.0

Installing rspec-mocks 3.7.0

Fetching rspec-rails 3.7.2

Installing rspec-rails 3.7.2

Fetching ruby-oci8 2.2.5.1

Installing ruby-oci8 2.2.5.1 with native extensions

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


    current directory: /usr/local/bundle/gems/ruby-oci8-2.2.5.1/ext/oci8

/usr/local/bin/ruby -r ./siteconf20180711-7-11cf4dv.rb 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 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=/usr/local/bin/$(RUBY_BASE_NAME)

--with-instant-client

--without-instant-client

/usr/local/bundle/gems/ruby-oci8-2.2.5.1/ext/oci8/oraconf.rb:909:in `get_home':

RuntimeError (RuntimeError)

from /usr/local/bundle/gems/ruby-oci8-2.2.5.1/ext/oci8/oraconf.rb:728:in

`initialize'

from /usr/local/bundle/gems/ruby-oci8-2.2.5.1/ext/oci8/oraconf.rb:269:in `new'

from /usr/local/bundle/gems/ruby-oci8-2.2.5.1/ext/oci8/oraconf.rb:269:in `get'

from extconf.rb:22:in `<main>'

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

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.

  

Backtrace:

  /usr/local/bundle/gems/ruby-oci8-2.2.5.1/ext/oci8/oraconf.rb:909:in `get_home'

/usr/local/bundle/gems/ruby-oci8-2.2.5.1/ext/oci8/oraconf.rb:728:in

`initialize'

  /usr/local/bundle/gems/ruby-oci8-2.2.5.1/ext/oci8/oraconf.rb:269:in `new'

  /usr/local/bundle/gems/ruby-oci8-2.2.5.1/ext/oci8/oraconf.rb:269:in `get'

  extconf.rb:22:in `<main>'

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


What's wrong here ?


Christopher Jones

unread,
Jul 11, 2018, 8:35:40 PM7/11/18
to oracle-...@googlegroups.com, Serguei Cambour

From the README: "If you are using CRuby >= 1.9.3 then you need to install ruby-oci8 gem as well as Oracle client, e.g. Oracle Instant Client. "

How are you installing the Oracle client in the container?  (Or are you using Oracle's Instant Client container! https://store.docker.com/images/oracle-instant-client )

Chris
--
You received this message because you are subscribed to the Google Groups "Oracle enhanced adapter for ActiveRecord" group.
To unsubscribe from this group and stop receiving emails from it, send an email to oracle-enhanc...@googlegroups.com.
To post to this group, send email to oracle-...@googlegroups.com.
Visit this group at https://groups.google.com/group/oracle-enhanced.
For more options, visit https://groups.google.com/d/optout.

-- 
http://twitter.com/ghrd

Serguei Cambour

unread,
Jul 12, 2018, 3:31:48 AM7/12/18
to Oracle enhanced adapter for ActiveRecord
Yes, I found the line about the constraint to have Oracle Instant Client installed :(.
The big question is what is the right way to install it on a Linux machine, with rpm, other ways ?

Actually, what I'm trying to do is;:

- download oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm
- download  oracle-instantclient12.2-devel-12.2.0.1.0-1.x86_64.rpm (may be optional)
- download  oracle-instantclient12.2-tools-12.2.0.1.0-1.x86_64.rpm (may be optional)
- copy the above rpm files into a <RAILS_APP>/oracle folder

Then in my Dockerfile:

COPY oracle $APP_HOME/


RUN alien oracle
/oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm
RUN alien oracle
/oracle-instantclient12.2-devel-12.2.0.1.0-1.x86_64.rpm
RUN alien oracle
/oracle-instantclient12.2-tools-12.2.0.1.0-1.x86_64.rpm


RUN dpkg
-i oracle/oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.deb
RUN dpkg
-i oracle/oracle-instantclient12.2-devel-12.2.0.1.0-1.x86_64.deb
RUN dpkg
-i oracle/oracle-instantclient12.2-tools-12.2.0.1.0-1.x86_64.deb


RUN
export LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client64/lib:$LD_LIBRARY_PATH


But it still fails to run the above commands and install it. So, I'll have to dig deeper in Oracle & Linux docs to figure out how to fix that.

Serguei Cambour

unread,
Jul 12, 2018, 11:38:58 AM7/12/18
to Oracle enhanced adapter for ActiveRecord
I figured out how to make it work, see the example of a Rails app in my GitHub repo.
Reply all
Reply to author
Forward
0 new messages