rbenv安装Ruby2.3.5报错BUILD FAILED (Ubuntu 18.04 using ruby-build 20191225-1-gbac1f1c) openssl

1、错误全貌
vagrant@vagrant:~$ rbenv install 2.3.5
Downloading ruby-2.3.5.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.5.tar.bz2

Installing ruby-2.3.5...

BUILD FAILED (Ubuntu 18.04 using ruby-build 20191225-1-gbac1f1c)

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

Last 10 log lines:
ossl_pkey.h:45:5: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
ossl_pkey.h:45:5: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
Makefile:301: recipe for target 'ossl_config.o' failed
make[2]: *** [ossl_config.o] Error 1
make[2]: Leaving directory '/tmp/ruby-build.20200110024455.7699.rhd7DZ/ruby-2.3.5/ext/openssl'
exts.mk:212: recipe for target 'ext/openssl/all' failed
make[1]: *** [ext/openssl/all] Error 2
make[1]: Leaving directory '/tmp/ruby-build.20200110024455.7699.rhd7DZ/ruby-2.3.5'
uncommon.mk:203: recipe for target 'build-ext' failed
make: *** [build-ext] Error 2

自己下载ruby-2.3.5.tar.gz文件,用make进行源安装,还是报错

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/x509_vfy.h:17,from openssl_missing.c:15:
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);
      ^
openssl_missing.c:39:23: error: macro "EVP_MD_CTX_create" passed 1 arguments,but takes just 0
 EVP_MD_CTX_create(void)
                       ^
openssl_missing.c:40:1: error: expected ‘=,,,;,‘asm’ or ‘__attribute__’ before ‘{’ token
 {
 ^
openssl_missing.c: In function ‘EVP_MD_CTX_cleanup’:
openssl_missing.c:55:27: error: invalid application of ‘sizeof’ to incomplete type ‘EVP_MD_CTX {aka struct evp_md_ctx_st}memset(ctx,sizeof(EVP_MD_CTX));
                           ^~~~~~~~~~
In file included from /usr/include/openssl/x509.h:23:0,from openssl_missing.c:15:
openssl_missing.c: At top level:
openssl_missing.c:63:1: error: expected declaration specifiers or ‘...’ before (’ token
 EVP_MD_CTX_destroy(EVP_MD_CTX *ctx)
 ^
openssl_missing.c:72:1: error: expected declaration specifiers or ‘...’ before (’ token
 EVP_MD_CTX_init(EVP_MD_CTX *ctx)
 ^
openssl_missing.c: In function ‘HMAC_CTX_init’:
openssl_missing.c:82:25: error: dereferencing pointer to incomplete type ‘HMAC_CTX {aka struct hmac_ctx_st}EVP_MD_CTX_init(&ctx->i_ctx);
                         ^
openssl_missing.c: In function ‘HMAC_CTX_cleanup’:
openssl_missing.c:95:27: error: invalid application of ‘sizeof’ to incomplete type ‘HMAC_CTX {aka struct hmac_ctx_st}memset(ctx,sizeof(HMAC_CTX));
                           ^~~~~~~~
Makefile:301: recipe for target 'openssl_missing.o' failed
make[2]: *** [openssl_missing.o] Error 1
make[2]: Leaving directory '/home/gabriel/Downloads/ruby-2.3.7/ext/openssl'
exts.mk:212: recipe for target 'ext/openssl/all' failed
make[1]: *** [ext/openssl/all] Error 2
make[1]: Leaving directory '/home/gabriel/Downloads/ruby-2.3.7'
uncommon.mk:203: recipe for target 'build-ext' failed
make: *** [build-ext] Error 2
2、解决方法

运行下面这条语句,安装libssl-dev和libssl1.0-dev依赖包

sudo apt purge libssl-dev && sudo apt install libssl1.0-dev

再运行rbenv install 2.3.5就可以安装成功了

如果网络太慢,运行rbenv install 2.3.5总是卡在下载ruby安装文件这一步上,可以试试下面的方法
解决rbenv install安装过慢的问题

  • 3
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

喵宁一

点赞是最好的赞赏~

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值