Reputation: 6136
I've used rbenv to install ruby 2.3.0. After installation ruby is using different openssl then what I've in my os. How can I resolve this?
[cp@cloud pkgconfig]$ ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION'
OpenSSL 1.0.1e 11 Feb 2013
[cp@cloud pkgconfig]$ openssl version
OpenSSL 1.0.2k 26 Jan 2017
I've tried to reinstall ruby with openssl option, I'm getting below error
Giving Executable path in openssl dir option:
which openssl
/usr/bin/openssl
RUBY_CONFIGURE_OPTS="--with-openssl-dir=/usr/bin/openssl” rbenv install 2.3.1
BUILD FAILED (CentOS release 6.8 (Final) using ruby-build 20160913-13-g8ef0c34)
Inspect or clean up the working tree at /tmp/ruby-build.20170219080937.10731
Results logged to /tmp/ruby-build.20170219080937.10731.log
Log File
linking shared-object digest/bubblebabble.so
make[2]: Leaving directory `/tmp/ruby-build.20170219073346.517/ruby-2.3.1/ext/digest/bubblebabble'
make[2]: Entering directory `/tmp/ruby-build.20170219073346.517/ruby-2.3.1/ext/digest/md5'
compiling md5init.c
cc1: error: /usr/bin/openssl/include: Not a directory
make[2]: *** [md5init.o] Error 1
make[2]: Leaving directory `/tmp/ruby-build.20170219073346.517/ruby-2.3.1/ext/digest/md5'
make[1]: *** [ext/digest/md5/all] Error 2
make[1]: Leaving directory `/tmp/ruby-build.20170219073346.517/ruby-2.3.1'
make: *** [build-ext] Error 2
Giving source directory path
RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/local/src/openssl-1.0.2k rbenv install 2.3.1
BUILD FAILED (CentOS release 6.8 (Final) using ruby-build 20170201-7-g5d62e84)
Inspect or clean up the working tree at /tmp/ruby-build.20170219084345.1062
Results logged to /tmp/ruby-build.20170219084345.1062.log
Last 10 log lines:
from /tmp/ruby-build.20170219084345.1062/ruby-2.3.1/lib/rubygems/core_ext/kernel_require.rb:55:in `require'
from /tmp/ruby-build.20170219084345.1062/ruby-2.3.1/lib/rubygems/package.rb:44:in `<top (required)>'
from /tmp/ruby-build.20170219084345.1062/ruby-2.3.1/lib/rubygems/core_ext/kernel_require.rb:55:in `require'
from /tmp/ruby-build.20170219084345.1062/ruby-2.3.1/lib/rubygems/core_ext/kernel_require.rb:55:in `require'
from /tmp/ruby-build.20170219084345.1062/ruby-2.3.1/lib/rubygems/installer.rb:10:in `<top (required)>'
from /tmp/ruby-build.20170219084345.1062/ruby-2.3.1/lib/rubygems/core_ext/kernel_require.rb:55:in `require'
from /tmp/ruby-build.20170219084345.1062/ruby-2.3.1/lib/rubygems/core_ext/kernel_require.rb:55:in `require'
from ./tool/rbinstall.rb:657:in `<module:RbInstall>'
from ./tool/rbinstall.rb:585:in `<main>'
Log File
generating x86_64-linux-fake.rb
x86_64-linux-fake.rb updated
./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems -r./x86_64-linux-fake ./tool/rbinstall.rb --make="make" --dest-dir="" --extout=".ext" --mflags="" --make-flags="" --data-mode=0644 --prog-mode=0755 --installed-list .installed.list --mantype="doc" --install=all --rdoc-output=".ext/rdoc"
/tmp/ruby-build.20170219084345.1062/ruby-2.3.1/lib/rubygems/core_ext/kernel_require.rb:55:in `require': /tmp/ruby-build.20170219084345.1062/ruby-2.3.1/.ext/x86_64-linux/openssl.so: undefined symbol: EC_GROUP_new_curve_GF2m - /tmp/ruby-build.20170219084345.1062/ruby-2.3.1/.ext/x86_64-linux/openssl.so (LoadError)
from /tmp/ruby-build.20170219084345.1062/ruby-2.3.1/lib/rubygems/core_ext/kernel_require.rb:55:in `require'
from /tmp/ruby-build.20170219084345.1062/ruby-2.3.1/.ext/common/openssl.rb:13:in `<top (required)>'
from /tmp/ruby-build.20170219084345.1062/ruby-2.3.1/lib/rubygems/core_ext/kernel_require.rb:55:in `require'
from /tmp/ruby-build.20170219084345.1062/ruby-2.3.1/lib/rubygems/core_ext/kernel_require.rb:55:in `require'
from /tmp/ruby-build.20170219084345.1062/ruby-2.3.1/lib/rubygems/security.rb:12:in `<top (required)>'
from /tmp/ruby-build.20170219084345.1062/ruby-2.3.1/lib/rubygems/core_ext/kernel_require.rb:55:in `require'
from /tmp/ruby-build.20170219084345.1062/ruby-2.3.1/lib/rubygems/core_ext/kernel_require.rb:55:in `require'
from /tmp/ruby-build.20170219084345.1062/ruby-2.3.1/lib/rubygems/package.rb:44:in `<top (required)>'
from /tmp/ruby-build.20170219084345.1062/ruby-2.3.1/lib/rubygems/core_ext/kernel_require.rb:55:in `require'
from /tmp/ruby-build.20170219084345.1062/ruby-2.3.1/lib/rubygems/core_ext/kernel_require.rb:55:in `require'
from /tmp/ruby-build.20170219084345.1062/ruby-2.3.1/lib/rubygems/installer.rb:10:in `<top (required)>'
from /tmp/ruby-build.20170219084345.1062/ruby-2.3.1/lib/rubygems/core_ext/kernel_require.rb:55:in `require'
from /tmp/ruby-build.20170219084345.1062/ruby-2.3.1/lib/rubygems/core_ext/kernel_require.rb:55:in `require'
from ./tool/rbinstall.rb:657:in `<module:RbInstall>'
from ./tool/rbinstall.rb:585:in `<main>'
make: *** [do-install-all] Error 1
Upvotes: 1
Views: 2454
Reputation: 48589
It's all about the PATH. The directories specified in your PATH environment variable are searched in order for any command that you issue. So rbenv must be adding a directory to the front of your PATH in which a command named openssl is found, i.e. rbenv's version of openssl.
What to do?
1) You could try moving the directory that contains your system's openssl in front of the rbenv directory on the front of your path, e.g. at the bottom of .bash_profile or similar:
export PATH="/path/to/openssl:$PATH"
2) rbenv allows you to specify a directory that contains an openssl when you install a ruby:
$ RUBY_CONFIGURE_OPTS="--with-openssl-dir=/path/to/openssl” rbenv install 2.4.0
3) You may be able to delete the openssl command that rbenv installed. You can find out the first directory that a command is found in using:
$ which openssl
But rather than delete the command, I would mv
it to a different name in case you need it later:
$ mv openssl rbenv_openssl
Then when that directory is searched for the openssl command it won't be found, therefore the other directories in your path will be searched in order until your system's openssl command is found.
If changing the name of rbenv's openssl breaks rbenv, you can just mv
the command back to its original name.
Upvotes: 1