Closed gacha closed 8 years ago
Could you run sqlplus on the alpine linux?
If it works, could you run sqlplus after setting export LD_BIND_NOW=1
?
/opt/oracle/instantclient_12_1/libclntsh.so: undefined reference to `bindresvport@GLIBC_2.2.5'
libclntsh.so
refers bindresvport
, which exists in glibc (GNU C Library) 2.2.5 or upper.
However it doesn't exist in your system.
IMO, musl libc used by the alpine linux doesn't implement bindresvport
.
@gacha I changed the title.
Linux distributions usually use glibc as a C library. Oracle instant client was build for such distributions. However Alpine Linux uses musl libc in place of glibc to make the distribution size small.
At present, some glibc-linked shared libraries can be loaded with musl, ...
Oracle instant libraries isn't included in such libraries because of lack of a function. If you want to use ruby-oci8 on Apline Linux, you need to request musl libc developers to implement the missing function (and others if necessary) and then request Alpine Linux to include fixed musl libc.
... but all but the simplest glibc-linked applications will fail if musl is dropped-in in place of /lib/ld-linux.so.2.
sqlplus fails because musl is dropped-in in place of /lib/ld-linux.so.2 on Alpine Linux.
I tried to compile ruby-oci8 by myself and looked at full mkmf.log
.
IMO, it is impossible to use Oracle client library on Alpine Linux as long as Alpine Linux lacks the glibc dynamic loader by design.
Hi, thanks for investigating, now I tried with the docker default ruby image - debian, now it get's by the OCIEnvCreate() but fails in another place:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/local/bin/ruby -r ./siteconf20160425-11-1poeet9.rb 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 OCIEnvCreate() in oci.h... yes
checking for OCI_MAJOR_VERSION in oci.h... *** 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/lib/ruby/2.2.0/mkmf.rb:704:in `Integer': can't convert nil into Integer (TypeError)
from /usr/local/lib/ruby/2.2.0/mkmf.rb:704:in `block in try_constant'
from /usr/local/lib/ruby/2.2.0/mkmf.rb:408:in `popen'
from /usr/local/lib/ruby/2.2.0/mkmf.rb:408:in `block in xpopen'
from /usr/local/lib/ruby/2.2.0/mkmf.rb:321:in `open'
from /usr/local/lib/ruby/2.2.0/mkmf.rb:401:in `xpopen'
from /usr/local/lib/ruby/2.2.0/mkmf.rb:703:in `try_constant'
from extconf.rb:34:in `block in <main>'
from /usr/local/lib/ruby/2.2.0/mkmf.rb:917:in `block in checking_for'
from /usr/local/lib/ruby/2.2.0/mkmf.rb:351:in `block (2 levels) in postpone'
from /usr/local/lib/ruby/2.2.0/mkmf.rb:321:in `open'
from /usr/local/lib/ruby/2.2.0/mkmf.rb:351:in `block in postpone'
from /usr/local/lib/ruby/2.2.0/mkmf.rb:321:in `open'
from /usr/local/lib/ruby/2.2.0/mkmf.rb:347:in `postpone'
from /usr/local/lib/ruby/2.2.0/mkmf.rb:916:in `checking_for'
from extconf.rb:33:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /usr/local/bundle/gems/ruby-oci8-2.2.2 for inspection.
Results logged to /usr/local/bundle/extensions/x86_64-linux/2.2.0-static/ruby-oci8-2.2.2/gem_make.out
Installing sass 3.4.22
Installing libv8 3.16.14.13
An error occurred while installing ruby-oci8 (2.2.2), and Bundler cannot
continue.
Make sure that `gem install ruby-oci8 -v '2.2.2'` succeeds before bundling.
Here is my Dockerfile:
FROM ruby:2.2.0
RUN apt-get update -qq && apt-get install -y build-essential wget unzip
RUN mkdir -p /opt/oracle
ADD *.zip /opt/oracle/
RUN cd /opt/oracle && unzip -q \*.zip
RUN cd /opt/oracle/instantclient_12_1 && ln -s libclntsh.so.12.1 libclntsh.so
ENV LD_LIBRARY_PATH /opt/oracle/instantclient_12_1
RUN mkdir /myapp
WORKDIR /myapp
ADD Gemfile /myapp/Gemfile
# ADD Gemfile.lock /myapp/Gemfile.lock
RUN bundle install --jobs=4
ADD . /myapp
Could you put mkmf.log
to https://gist.github.com/?
./conftest: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
You need to install libaio.so.1
.
apt-get install libaio1
Thanks, it works, should spot that by myself.
Hi, Im trying to compile ruby-oci8 on a alpine linux with ruby 2.2.1. I have unzipped these files:
into
/opt/oracle
and have set LD_LIBRARY_PATH to /opt/oracle/instantclient_12_1.Output:
Last lines of mkmf.log:
Env:
And yes the link to libclntsh.so is correct: