我用rbenv安装了ruby 2.3.0。安装后ruby使用不同的openssl然后我在我的操作系统中。我该如何解决这个问题?
[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
我尝试用openssl选项重新安装ruby,我收到以下错误
在openssl dir选项中提供可执行路径:
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
日志文件
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
提供源目录路径
RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/local/src/openssl-1.0.2k rbenv install 2.3.1
建立失败(CentOS版本6.8(最终版)使用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>'
日志文件
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
答案 0 :(得分:1)
关于PATH的全部内容。将搜索PATH环境变量中指定的目录,以便发出任何命令。所以rbenv必须在PATH的前面添加一个目录,其中找到一个名为openssl的命令,即rbenv的openssl版本。
怎么办?
1)您可以尝试将包含系统的openssl的目录移动到路径前面的rbenv目录前面,例如在.bash_profile或类似的底部:
export PATH="/path/to/openssl:$PATH"
2)rbenv允许您在安装ruby时指定包含openssl的目录:
$ RUBY_CONFIGURE_OPTS="--with-openssl-dir=/path/to/openssl” rbenv install 2.4.0
3)您可以删除rbenv安装的openssl命令。您可以使用以下命令查找找到命令的第一个目录:
$ which openssl
但不是删除命令,我会mv
将其改为另一个名称,以备日后需要时使用:
$ mv openssl rbenv_openssl
然后,当在该目录中搜索openssl命令时,它将无法找到,因此将按顺序搜索路径中的其他目录,直到找到系统的openssl命令。
如果更改rbenv的openssl的名称会破坏rbenv,您只需mv
将命令恢复为原始名称。