我需要使用Ruby 2.6.10版本,我的基础操作系统是CentOS 6。我想知道我是否可以用openssl v3构建这个版本的ruby?这是我正在构建的Ruby分支:https://github.com/ruby/ruby/tree/v2_6_10
这是我在用openssl v3编译ruby 2.6.10时遇到的错误:
2023-07-11T04:27:11.0498806Z ossl_pkey_rsa.c:872:1: warning: 'RSA_set0_crt_params' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
2023-07-11T04:27:11.0499056Z In file included from /usr/local_ssl_3.0.0/include/openssl/x509.h:36:0,
2023-07-11T04:27:11.0499267Z from /usr/local_ssl_3.0.0/include/openssl/x509v3.h:25,
2023-07-11T04:27:11.0499451Z from ossl.h:23,
2023-07-11T04:27:11.0499626Z from ossl_pkey_rsa.c:10:
2023-07-11T04:27:11.0499829Z /usr/local_ssl_3.0.0/include/openssl/rsa.h:209:27: note: declared here
2023-07-11T04:27:11.0500092Z OSSL_DEPRECATEDIN_3_0 int RSA_set0_crt_params(RSA *r,
2023-07-11T04:27:11.0500279Z ^~~~~~~~~~~~~~~~~~~
2023-07-11T04:27:11.0535494Z In file included from ../.././include/ruby.h:33:0,
2023-07-11T04:27:11.0536068Z from ossl.h:16,
2023-07-11T04:27:11.0536408Z from ossl_pkey_rsa.c:10:
2023-07-11T04:27:11.0536922Z ossl_pkey_rsa.c: In function 'Init_ossl_rsa':
2023-07-11T04:27:11.0537392Z ossl_pkey_rsa.c:877:58: error: 'RSA_SSLV23_PADDING' undeclared (first use in this function); did you mean 'RSA_NO_PADDING'?
2023-07-11T04:27:11.0537854Z #define DefRSAConst(x) rb_define_const(cRSA, #x, INT2NUM(RSA_##x))
2023-07-11T04:27:11.0538062Z ^
2023-07-11T04:27:11.0538545Z ../.././include/ruby/ruby.h:261:33: note: in definition of macro 'RB_INT2FIX'
2023-07-11T04:27:11.0538956Z #define RB_INT2FIX(i) (((VALUE)(i))<<1 | RUBY_FIXNUM_FLAG)
2023-07-11T04:27:11.0539289Z ^
2023-07-11T04:27:11.0539750Z ../.././include/ruby/ruby.h:1594:20: note: in expansion of macro 'RB_INT2NUM'
2023-07-11T04:27:11.0540018Z #define INT2NUM(x) RB_INT2NUM(x)
2023-07-11T04:27:11.0540188Z ^~~~~~~~~~
2023-07-11T04:27:11.0540448Z ossl_pkey_rsa.c:877:50: note: in expansion of macro 'INT2NUM'
2023-07-11T04:27:11.0540671Z #define DefRSAConst(x) rb_define_const(cRSA, #x, INT2NUM(RSA_##x))
2023-07-11T04:27:11.0540857Z ^~~~~~~
2023-07-11T04:27:11.0541109Z ossl_pkey_rsa.c:942:5: note: in expansion of macro 'DefRSAConst'
2023-07-11T04:27:11.0541310Z DefRSAConst(SSLV23_PADDING);
字符串
OpenSSL V3的实现如下:
git clone git://git.openssl.org/openssl.git openssl-3.0.0
cd openssl-3.0.0
git checkout openssl-3.0.0
export PATH=/usr/local_perl_5_24_1/bin:$PATH
./config --prefix=/usr/local_ssl_3.0.0 shared -no-ssl2 -no-ec -no-ec2m -no-ecdh
make depend
make
sudo make install_sw
型
有没有人知道有没有一种方法可以用openssl v3构建ruby?
使用openssl v3编译ruby 2.6.10。
1条答案
按热度按时间kulphzqa1#
Ruby 2.6和Ruby 3.1之前的所有其他Ruby版本都不兼容OpenSSL 3。当你需要运行Ruby 2.6时,你需要降级到OpenSSL 1.0或1.1。
但是因为Ruby 2.6在一年多前就已经结束了,并且不再有任何安全更新或bug修复。我强烈建议更新到最新的Ruby版本,如3.1或3.2。
Ruby bug tracker:
状态由 Assigned zu Rejected geändert
我们决定不将openssl-3.x gem移植到
ruby_2_7
和ruby_3_0
分支中。因为它影响OpenSSL 1.0.x。不幸的是,用户应该在升级操作系统版本之前将其Ruby版本升级到3.1+。