You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

通过RVM安装Ruby时出现__rvm_make -j4错误求助

解决WSL2 Ubuntu下RVM安装Ruby时的__rvm_make错误

问题根源

你遇到的编译失败,核心原因是Ruby 3.0.0不兼容Ubuntu默认预装的OpenSSL 3.0。日志里的关键错误是:

error: ‘RSA_SSLV23_PADDING’ undeclared (first use in this function); did you mean ‘RSA_NO_PADDING’?

OpenSSL 3.0移除了RSA_SSLV23_PADDING这个常量,而Ruby 3.0.0的openssl扩展还在引用它,导致编译中断。

解决方案

下面提供两种可行的修复方法,推荐第二种(升级Ruby版本):

方法一:指定OpenSSL 1.1.1编译Ruby 3.0.0

  • 清理RVM残留文件:
rvm implode
sudo rm -rf ~/.rvm
  • 安装OpenSSL 1.1.1及编译依赖:
sudo apt update && sudo apt install -y libssl1.1 libssl-dev build-essential
  • 重新安装RVM并指定OpenSSL路径:
curl -sSL https://get.rvm.io | bash -s stable --ruby --with-openssl-dir=/usr/lib/ssl

方法二:安装支持OpenSSL 3.0的高版本Ruby(推荐)

Ruby 3.1.0及以上版本已经适配了OpenSSL 3.0,步骤如下:

  • 清理RVM残留:
rvm implode
sudo rm -rf ~/.rvm
  • 安装RVM(不自动安装默认Ruby):
curl -sSL https://get.rvm.io | bash -s stable
  • 加载RVM环境:
source ~/.rvm/scripts/rvm
  • 安装Ruby 3.1.0(或更高版本,比如3.2.2):
rvm install 3.1.0
rvm use 3.1.0 --default
  • 安装Ruby on Rails:
gem install rails

附:你提供的错误日志

In file included from /usr/include/openssl/x509.h:36,
                 from /usr/include/openssl/x509v3.h:25,
                 from ossl.h:23,
                 from ossl_pkey_rsa.c:10:
/usr/include/openssl/rsa.h:225:28: note: declared here
  225 | OSSL_DEPRECATEDIN_3_0 void RSA_get0_crt_params(const RSA *r,
      |                            ^~~~~~~~~~~~~~~~~~~
ossl_pkey_rsa.c: In function ‘ossl_rsa_get_iqmp’:
ossl_pkey_rsa.c:880:1: warning: ‘EVP_PKEY_get0_RSA’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
  880 | OSSL_PKEY_BN_DEF3(rsa, RSA, crt_params, dmp1, dmq1, iqmp)
      | ^~~~~~~~~~~~~~~~~
In file included from /usr/include/openssl/x509.h:29,
                 from /usr/include/openssl/x509v3.h:25,
                 from ossl.h:23,
                 from ossl_pkey_rsa.c:10:
/usr/include/openssl/evp.h:1346:22: note: declared here
 1346 | const struct rsa_st *EVP_PKEY_get0_RSA(const EVP_PKEY *pkey);
      |                      ^~~~~~~~~~~~~~~~~
ossl_pkey_rsa.c:23:11: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
   23 |     (rsa) = EVP_PKEY_get0_RSA(_pkey); \
      |           ^
ossl_pkey.h:102:9: note: in expansion of macro ‘GetRSA’
  102 |         Get##_type(self, obj);                                          \
      |         ^~~
ossl_pkey.h:114:9: note: in expansion of macro ‘OSSL_PKEY_BN_DEF_GETTER0’
  114 |         OSSL_PKEY_BN_DEF_GETTER0(_keytype, _type, a3,                   \
      |         ^~~~~~~~~~~~~~~~~~~~~~~~
ossl_pkey.h:211:9: note: in expansion of macro ‘OSSL_PKEY_BN_DEF_GETTER3’
  211 |         OSSL_PKEY_BN_DEF_GETTER3(_keytype, _type, _group, a1, a2, a3)   \
      |         ^~~~~~~~~~~~~~~~~~~~~~~~
ossl_pkey_rsa.c:880:1: note: in expansion of macro ‘OSSL_PKEY_BN_DEF3’
  880 | OSSL_PKEY_BN_DEF3(rsa, RSA, crt_params, dmp1, dmq1, iqmp)
      | ^~~~~~~~~~~~~~~~~
ossl_pkey_rsa.c:880:1: warning: ‘RSA_get0_crt_params’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
In file included from /usr/include/openssl/x509.h:36,
                 from /usr/include/openssl/x509v3.h:25,
                 from ossl.h:23,
                 from ossl_pkey_rsa.c:10:
/usr/include/openssl/rsa.h:225:28: note: declared here
  225 | OSSL_DEPRECATEDIN_3_0 void RSA_get0_crt_params(const RSA *r,
      |                            ^~~~~~~~~~~~~~~~~~~
ossl_pkey_rsa.c: In function ‘ossl_rsa_set_crt_params’:
ossl_pkey_rsa.c:880:1: warning: ‘EVP_PKEY_get0_RSA’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
  880 | OSSL_PKEY_BN_DEF3(rsa, RSA, crt_params, dmp1, dmq1, iqmp)
      | ^~~~~~~~~~~~~~~~~
In file included from /usr/include/openssl/x509.h:29,
                 from /usr/include/openssl/x509v3.h:25,
                 from ossl.h:23,
                 from ossl_pkey_rsa.c:10:
/usr/include/openssl/evp.h:1346:22: note: declared here
 1346 | const struct rsa_st *EVP_PKEY_get0_RSA(const EVP_PKEY *pkey);
      |                      ^~~~~~~~~~~~~~~~~
ossl_pkey_rsa.c:23:11: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
   23 |     (rsa) = EVP_PKEY_get0_RSA(_pkey); \
      |           ^
ossl_pkey.h:135:9: note: in expansion of macro ‘GetRSA’
  135 |         Get##_type(self, obj);                                          \
      |         ^~~
ossl_pkey.h:212:9: note: in expansion of macro ‘OSSL_PKEY_BN_DEF_SETTER3’
  212 |         OSSL_PKEY_BN_DEF_SETTER3(_keytype, _type, _group, a1, a2, a3)
      |         ^~~~~~~~~~~~~~~~~~~~~~~~
ossl_pkey_rsa.c:880:1: note: in expansion of macro ‘OSSL_PKEY_BN_DEF3’
  880 | OSSL_PKEY_BN_DEF3(rsa, RSA, crt_params, dmp1, dmq1, iqmp)
      | ^~~~~~~~~~~~~~~~~
ossl_pkey_rsa.c:880:1: warning: ‘RSA_set0_crt_params’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
In file included from /usr/include/openssl/x509.h:36,
                 from /usr/include/openssl/x509v3.h:25,
                 from ossl.h:23,
                 from ossl_pkey_rsa.c:10:
/usr/include/openssl/rsa.h:209:27: note: declared here
  209 | OSSL_DEPRECATEDIN_3_0 int RSA_set0_crt_params(RSA *r,
      |                           ^~~~~~~~~~~~~~~~~~~
ossl_pkey_rsa.c: In function ‘Init_ossl_rsa’:
ossl_pkey_rsa.c:885:58: error: ‘RSA_SSLV23_PADDING’ undeclared (first use in this function); did you mean ‘RSA_NO_PADDING’?
  885 | #define DefRSAConst(x) rb_define_const(cRSA, #x, INT2NUM(RSA_##x))
      |                                                          ^~~~
ossl_pkey_rsa.c:950:5: note: in expansion of macro ‘DefRSAConst’
  950 |     DefRSAConst(SSLV23_PADDING);
      |     ^~~~~~~~~~~
ossl_pkey_rsa.c:885:58: note: each undeclared identifier is reported only once for each function it appears in
  885 | #define DefRSAConst(x) rb_define_const(cRSA, #x, INT2NUM(RSA_##x))
      |                                                          ^~~~
ossl_pkey_rsa.c:950:5: note: in expansion of macro ‘DefRSAConst’
  950 |     DefRSAConst(SSLV23_PADDING);
      |     ^~~~~~~~~~~
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
compiling sha2.c
ossl_pkey_rsa.c: At top level:
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
make[2]: *** [Makefile:328: ossl_pkey_rsa.o] Error 1
make[2]: Leaving directory '/home/mmullen/.rvm/src/ruby-3.0.0/ext/openssl'
make[1]: *** [exts.mk:260: ext/openssl/all] Error 2
make[1]: *** Waiting for unfinished jobs....
installing default sha2 libraries
linking shared-object socket.so
checking ../.././parse.y and ../.././ext/ripper/eventids2.c
In file included from sha2.c:40:
sha2.c:578:28: warning: argument 2 of type ‘sha2_byte[]’ {aka ‘unsigned char[]’} with mismatched bound [-Warray-parameter=]
  578 | int SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
      |                  ~~~~~~~~~~^~~~~~~~
sha2.h:145:50: note: in definition of macro ‘SHA256_Final’
  145 | #define SHA256_Final(d, c)      SHA256_Finish(c, d)
      |                                                  ^
sha2.h:170:18: note: previously declared as ‘uint8_t[32]’ {aka ‘unsigned char[32]’}
  170 | int SHA256_Final(uint8_t[SHA256_DIGEST_LENGTH], SHA256_CTX*);
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sha2.h:145:50: note: in definition of macro ‘SHA256_Final’
  145 | #define SHA256_Final(d, c)      SHA256_Finish(c, d)
      |                                                  ^
sha2.c:643:44: warning: argument 2 of type ‘char[]’ with mismatched bound [-Warray-parameter=]
  643 | char *SHA256_End(SHA256_CTX* context, char buffer[]) {
      |                                       ~~~~~^~~~~~~~
In file included from sha2.c:40:
sha2.h:171:31: note: previously declared as ‘char[65]’
  171 | char* SHA256_End(SHA256_CTX*, char[SHA256_DIGEST_STRING_LENGTH]);
      |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sha2.c:946:28: warning: argument 2 of type ‘sha2_byte[]’ {aka ‘unsigned char[]’} with mismatched bound [-Warray-parameter=]
  946 | int SHA512_Final(sha2_byte digest[], SHA512_CTX* context) {
      |                  ~~~~~~~~~~^~~~~~~~
sha2.h:163:50: note: in definition of macro ‘SHA512_Final’
  163 | #define SHA512_Final(d, c)      SHA512_Finish(c, d)
      |                                                  ^
sha2.h:182:18: note: previously declared as ‘uint8_t[64]’ {aka ‘unsigned char[64]’}
  182 | int SHA512_Final(uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*);
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sha2.h:163:50: note: in definition of macro ‘SHA512_Final’
  163 | #define SHA512_Final(d, c)      SHA512_Finish(c, d)
      |                                                  ^
sha2.c:976:44: warning: argument 2 of type ‘char[]’ with mismatched bound [-Warray-parameter=]
  976 | char *SHA512_End(SHA512_CTX* context, char buffer[]) {
      |                                       ~~~~~^~~~~~~~
In file included from sha2.c:40:
sha2.h:183:31: note: previously declared as ‘char[129]’
  183 | char* SHA512_End(SHA512_CTX*, char[SHA512_DIGEST_STRING_LENGTH]);
      |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sha2.c:1022:28: warning: argument 2 of type ‘sha2_byte[]’ {aka ‘unsigned char[]’} with mismatched bound [-Warray-parameter=]
 1022 | int SHA384_Final(sha2_byte digest[], SHA384_CTX* context) {
      |                  ~~~~~~~~~~^~~~~~~~
sha2.h:154:50: note: in definition of macro ‘SHA384_Final’
  154 | #define SHA384_Final(d, c)      SHA384_Finish(c, d)
      |                                                  ^
sha2.h:176:18: note: previously declared as ‘uint8_t[48]’ {aka ‘unsigned char[48]’}
  176 | int SHA384_Final(uint8_t[SHA384_DIGEST_LENGTH], SHA384_CTX*);
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sha2.h:154:50: note: in definition of macro ‘SHA384_Final’
  154 | #define SHA384_Final(d, c)      SHA384_Finish(c, d)
      |                                                  ^
sha2.c:1052:44: warning: argument 2 of type ‘char[]’ with mismatched bound [-Warray-parameter=]
 1052 | char *SHA384_End(SHA384_CTX* context, char buffer[]) {
      |                                       ~~~~~^~~~~~~~
In file included from sha2.c:40:
sha2.h:177:31: note: previously declared as ‘char[97]’
  177 | char* SHA384_End(SHA384_CTX*, char[SHA384_DIGEST_STRING_LENGTH]);
      |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
installing default ripper libraries
linking shared-object ripper.so
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
make[2]: Leaving directory '/home/mmullen/.rvm/src/ruby-3.0.0/ext/socket'
linking shared-object digest/sha2.so
make[2]: Leaving directory '/home/mmullen/.rvm/src/ruby-3.0.
相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.20 06:10:49