Ruby 使用 rbenv 安装 Ruby 2.1.10 报错!!!(已解决)

qq2729877005 · 2018年06月28日 · 最后由 qq2729877005 回复于 2018年06月28日 · 4085 次阅读

今天改用 deepin,安装环境时,在安装 ruby 卡住了,搞了半天都没解决,只能来求助了。

换回之前使用的 Ubuntu16.04 安装这个版本也报错

日志文件

compiling ossl_x509store.c
In file included from ossl.h:58:0,
                 from ossl_x509store.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:219:0,
                 from ossl_x509store.c:11:
openssl_missing.h:79: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:59,
                 from ossl_x509store.c:11:
openssl_missing.h:83:6: error: expected declaration specifiers or ‘...’ before ‘(’ token
 void EVP_MD_CTX_init(EVP_MD_CTX *ctx);
      ^
openssl_missing.h:91:6: error: expected declaration specifiers or ‘...’ before ‘(’ token
 void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx);
      ^
In file included from ossl.h:233:0,
                 from ossl_x509store.c:11:
ossl_pkey.h:43:5: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
 #if HAVE_BN_GENCB
     ^~~~~~~~~~~~~
ossl_pkey.h:43:5: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
ossl_pkey.h:43:5: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
ossl_x509store.c: In function ‘DupX509StorePtr’:
ossl_x509store.c:83:5: warning: implicit declaration of function ‘CRYPTO_add’; did you mean ‘CRYPTO_free’? [-Wimplicit-function-declaration]
     CRYPTO_add(&store->references, 1, CRYPTO_LOCK_X509_STORE);
     ^~~~~~~~~~
     CRYPTO_free
ossl_x509store.c:83:22: error: dereferencing pointer to incomplete type ‘X509_STORE {aka struct x509_store_st}’
     CRYPTO_add(&store->references, 1, CRYPTO_LOCK_X509_STORE);
                      ^~
ossl_x509store.c:83:39: error: ‘CRYPTO_LOCK_X509_STORE’ undeclared (first use in this function); did you mean ‘CRYPTO_EX_INDEX_X509_STORE’?
     CRYPTO_add(&store->references, 1, CRYPTO_LOCK_X509_STORE);
                                       ^~~~~~~~~~~~~~~~~~~~~~
                                       CRYPTO_EX_INDEX_X509_STORE
ossl_x509store.c:83:39: note: each undeclared identifier is reported only once for each function it appears in
ossl_x509store.c: In function ‘ossl_x509stctx_free’:
ossl_x509store.c:372:11: error: dereferencing pointer to incomplete type ‘X509_STORE_CTX {aka struct x509_store_ctx_st}if(ctx->untrusted)
           ^~
ossl_x509store.c: In function ‘ossl_x509stctx_get_curr_crl’:
ossl_x509store.c:537:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
Makefile:280: recipe for target 'ossl_x509store.o' failed
make[2]: *** [ossl_x509store.o] Error 1
make[2]: Leaving directory '/tmp/ruby-build.20180628213825.8724/ruby-2.1.10/ext/openssl'
exts.mk:191: recipe for target 'ext/openssl/all' failed
make[1]: *** [ext/openssl/all] Error 2
make[1]: *** 正在等待未完成的任务....
linking shared-object objspace.so
make[2]: Leaving directory '/tmp/ruby-build.20180628213825.8724/ruby-2.1.10/ext/objspace'
linking shared-object nkf.so
make[2]: Leaving directory '/tmp/ruby-build.20180628213825.8724/ruby-2.1.10/ext/nkf'
linking shared-object dl/callback.so
make[2]: Leaving directory '/tmp/ruby-build.20180628213825.8724/ruby-2.1.10/ext/dl/callback'
make[1]: Leaving directory '/tmp/ruby-build.20180628213825.8724/ruby-2.1.10'
uncommon.mk:180: recipe for target 'build-ext' failed
make: *** [build-ext] Error 2

解决方案

折腾了一天,没想到 github 中的 ruby-build 项目中的 wiki 中已有前辈碰见过这种问题,并提供了解决方案。

实在汗颜,感情自己白折腾了,不过了也从中吸取到了教训,谷歌和百度不是万能的,最靠谱的还是源项目文档!!!!!!(此处强调)

是你的配置问题吧,

googya 回复

目前我也没搞清楚,不知道哪里出了问题😂

googya 回复

大佬,你用的这个系统是什么版本的?

googya 回复

安装 2.5.1 的就没问题

qq2729877005 关闭了讨论。 06月29日 14:21
需要 登录 后方可回复, 如果你还没有账号请 注册新账号