无法在 Ubuntu 16.04 中使用 rbenv 2.3.1 安装 Ruby [英] Cannot install Ruby with rbenv 2.3.1 in Ubuntu 16.04

查看:50
本文介绍了无法在 Ubuntu 16.04 中使用 rbenv 2.3.1 安装 Ruby的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Ubuntu 16.04 中使用 rbenv 安装 ruby​​ 时,显示了有关 ruby​​ 构建的错误.我已经尝试完全删除 rbenv 并再次重新安装 rbenv,但我收到以下错误.

While installing ruby with rbenv for Ubuntu 16.04 error regarding the ruby build is shown. I've tried completely removing the rbenv and again re-installing rbenv, but all i get the following error.

我已按照 DigitalOcean 的程序安装 rbenv,如此处,并按照 此处 用于 ruby​​_build.我还安装了构建所需的所有依赖项.

I've followed DigitalOcean's procedure for installing the rbenv as in here, and followed steps listed here for ruby_build. I've also installed all dependencies required for the build.

卸载和安装多次后rbenv问题还是一样.

Still after times of uninstall and install of rbenv problem is the same.

   ~$ rbenv install 2.3.1
   Downloading ruby-2.3.1.tar.bz2...
   -> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.bz2
   Installing ruby-2.3.1...

   BUILD FAILED (Ubuntu 16.04 using ruby-build 20170726-2-g254728e)

   Inspect or clean up the working tree at /tmp/build.20170818162042.1074
   Results logged to /tmp/ruby-build.20170818162042.1074.log

   Last 10 log lines:
   linking shared-object objspace.so
   make[2]: Leaving directory '/tmp/ruby-build.20170818162042.1074/ruby-2.3.1/ext/objspace'
   installing default date_core libraries
   linking shared-object date_core.so
   make[2]: Leaving directory '/tmp/ruby-build.20170818162042.1074/ruby-2.3.1/ext/date'
   linking shared-object nkf.so
   make[2]: Leaving directory '/tmp/ruby-build.20170818162042.1074/ruby-2.3.1/ext/nkf'
   make[1]: Leaving directory '/tmp/ruby-build.20170818162042.1074/ruby-2.3.1'
   uncommon.mk:203: recipe for target 'build-ext' failed
   make: *** [build-ext] Error 2

cat/tmp/ruby-build.20170818162042.1074.log 的结果

Result of cat /tmp/ruby-build.20170818162042.1074.log

In file included from ossl.h:57:0,
                 from ossl_bn.c:11:
/usr/include/openssl/asn1_mac.h:10:2: error: #error "This file is obsolete; please update your software."
 #error "This file is obsolete; please update your software."
  ^
In file included from ossl.h:221:0,
                 from ossl_bn.c:11:
openssl_missing.h:78:35: error: macro "EVP_MD_CTX_create" passed 1 arguments, but takes just 0
 EVP_MD_CTX *EVP_MD_CTX_create(void);
                                   ^
In file included from /usr/include/openssl/x509.h:23:0,
                 from /usr/include/openssl/x509v3.h:14,
                 from ossl.h:58,
                 from ossl_bn.c:11:
openssl_missing.h:82:6: error: expected declaration specifiers or ‘...’ before ‘(’ token
 void EVP_MD_CTX_init(EVP_MD_CTX *ctx);
      ^
openssl_missing.h:90:6: error: expected declaration specifiers or ‘...’ before ‘(’ token
 void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx);
      ^
ossl_bn.c: In function ‘ossl_bn_size’:
ossl_bn.c:43:19: error: invalid application of ‘sizeof’ to incomplete type ‘BIGNUM {aka struct bignum_st}’
     return sizeof(BIGNUM);
                   ^
ossl_bn.c: In function ‘ossl_bn_s_generate_prime’:
ossl_bn.c:769:5: warning: ‘BN_generate_prime’ is deprecated [-Wdeprecated-declarations]
     if (!BN_generate_prime(result, num, safe, add, rem, NULL, NULL)) {
     ^
In file included from /usr/include/openssl/bn.h:31:0,
                 from /usr/include/openssl/asn1.h:24,
                 from /usr/include/openssl/objects.h:916,
                 from /usr/include/openssl/evp.h:27,
                 from /usr/include/openssl/x509.h:23,
                 from /usr/include/openssl/x509v3.h:14,
                 from ossl.h:58,
                 from ossl_bn.c:11:
/usr/include/openssl/bn.h:285:1: note: declared here
 DEPRECATEDIN_0_9_8(BIGNUM *BN_generate_prime(BIGNUM *ret, int bits, int safe,
 ^
ossl_bn.c: In function ‘ossl_bn_is_prime’:
ossl_bn.c:877:5: warning: ‘BN_is_prime’ is deprecated [-Wdeprecated-declarations]
     switch (BN_is_prime(bn, checks, NULL, ossl_bn_ctx, NULL)) {
     ^
In file included from /usr/include/openssl/bn.h:31:0,
                 from /usr/include/openssl/asn1.h:24,
                 from /usr/include/openssl/objects.h:916,
                 from /usr/include/openssl/evp.h:27,
                 from /usr/include/openssl/x509.h:23,
                 from /usr/include/openssl/x509v3.h:14,
                 from ossl.h:58,
                 from ossl_bn.c:11:
/usr/include/openssl/bn.h:291:1: note: declared here
 DEPRECATEDIN_0_9_8(int
 ^
ossl_bn.c: In function ‘ossl_bn_is_prime_fasttest’:
ossl_bn.c:916:5: warning: ‘BN_is_prime_fasttest’ is deprecated [-Wdeprecated-declarations]
     switch (BN_is_prime_fasttest(bn, checks, NULL, ossl_bn_ctx, NULL, do_trial_division)) {
     ^
In file included from /usr/include/openssl/bn.h:31:0,
                 from /usr/include/openssl/asn1.h:24,
                 from /usr/include/openssl/objects.h:916,
                 from /usr/include/openssl/evp.h:27,
                 from /usr/include/openssl/x509.h:23,
                 from /usr/include/openssl/x509v3.h:14,
                 from ossl.h:58,
                 from ossl_bn.c:11:
/usr/include/openssl/bn.h:295:1: note: declared here
 DEPRECATEDIN_0_9_8(int
 ^
ossl_bn.c: In function ‘ossl_bn_size’:
ossl_bn.c:44:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
Makefile:301: recipe for target 'ossl_bn.o' failed

推荐答案

这是一个与 openssl 和 ruby​​ 2.3.x 的已知兼容性问题.

This is a known compatibility issue with openssl and ruby 2.3.x.

Ruby 2.4 之前版本的 openssl 扩展与 OpenSSL 1.1.x 不兼容.目前,大多数随 OpenSSL 1.1.0 一起提供的 Linux 发行版都有一个单独的 OpenSSL 1.0.x 包.

The openssl extension of Ruby version before 2.4 is not compatible with OpenSSL 1.1.x. At the moment, most Linux distributions that come with OpenSSL 1.1.0 have a separate package for OpenSSL 1.0.x.

您需要安装较早版本的 OpenSSL 或使用 ruby​​ 2.4.x.

You need to install the earlier version of OpenSSL or use ruby 2.4.x.

这里有完整的描述和解决方案

这篇关于无法在 Ubuntu 16.04 中使用 rbenv 2.3.1 安装 Ruby的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆