今天想在公司内部的一台centos上面配置ror环境,在编译ruby的时候出现
Error: ossl_pkey_ec.c:In functin 'ossl_ec_group_initialize':
ossl_pkey_ec.c:816:error: 'EC_GROUP_new_curve_GF2m' undeclard
(first use in this function) ossl_pkey_ec.c:816:error:
(Each undeclard indentifier is reported only once ossl_pkey_ec.c:816
error:for each function it appearts in.)
原来是centos新版本默认openssl的配置变更取消了对EC_xx的支持,所以出现这种错误。
解决办法
https://bugs.ruby-lang.org/issues/8384
diff --git a/ext/openssl/ossl_pkey_ec.c b/ext/openssl/ossl_pkey_ec.c
index 8e6d88f..29e28ca 100644
--- a/ext/openssl/ossl_pkey_ec.c
+++ b/ext/openssl/ossl_pkey_ec.c
@@ -762,8 +762,10 @@ static VALUE ossl_ec_group_initialize(int argc, VALUE *argv, VALUE self)
method = EC_GFp_mont_method();
} else if (id == s_GFp_nist) {
method = EC_GFp_nist_method();
+#if !defined(OPENSSL_NO_EC2M)
} else if (id == s_GF2m_simple) {
method = EC_GF2m_simple_method();
+#endif
}
if (method) {
@@ -817,8 +819,10 @@ static VALUE ossl_ec_group_initialize(int argc, VALUE *argv, VALUE self)
if (id == s_GFp) {
new_curve = EC_GROUP_new_curve_GFp;
+#if !defined(OPENSSL_NO_EC2M)
} else if (id == s_GF2m) {
new_curve = EC_GROUP_new_curve_GF2m;
+#endif
} else {
ossl_raise(rb_eArgError, "unknown symbol, must be :GFp or :GF2m");
}