gpt4 book ai didi

ruby - 在 Ubuntu 18.04 上安装 Ruby 2.3.x 在安装过程结束时导致错误

转载 作者:数据小太阳 更新时间:2023-10-29 06:44:51 25 4
gpt4 key购买 nike

我最近更新了我的系统到 Ubuntu 18.04 LTS,从那时起,Ruby 版本似乎已经更新到 2.5。问题是,当尝试部署使用 Capistrano 的项目时,它现在会提示找不到 Ruby 2.3。

运行 rvm install 2.3 时它尝试安装的版本是 2.3.4,显示的第一个错误是“Error running '__rvm_make -j4'” .我尝试删除 RVM 并再次安装,但没有解决这个问题。日志是一个巨大的文件,什么也没有告诉我。

然后,我尝试使用 rbenv,这也会导致错误:

Installing ruby-2.3.4...

BUILD FAILED (Ubuntu 18.04 using ruby-build 20180424)

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

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

日志文件还有一个愚蠢的巨型日志文件。

下一次尝试是从源代码安装,在文件夹中运行 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, 0, sizeof(EVP_MD_CTX));
^~~~~~~~~~
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.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, 0, 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

安装它需要做什么?或者无法再安装这些旧版本?

最佳答案

我遇到了同样的问题,虽然看起来问题出在 gcc 中,但在我的例子中问题出在 libssl-dev 中,这对我有帮助:

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

我使用 rbenv。如果您使用 rvm,您可能会在运行之前的命令后遇到问题:

/usr/share/rvm/scripts/base: No such file or directory

我推荐尝试 rbenv。安装 libssl1.0-dev 后,一切都完美无缺。

关于ruby - 在 Ubuntu 18.04 上安装 Ruby 2.3.x 在安装过程结束时导致错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50085258/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com