Today, my colleague asked me to install Ruby and rails on a test machine, and there was a compilation error in installing ruby-1.8.7. as follows:
Ossl_pkey_ec.c:815:error: ' ec_group_new_curve_gf2m ' undeclared (in the This function)
Ossl_pkey_ec.c:815:error: (Each undeclared identifier are reported only once
Ossl_pkey_ec.c:815:error:for each function it appears in.)
MAKE[1]: * * * [OSSL_PKEY_EC.O] Error 1
MAKE[1]: Leaving directory '/home/vagrant/ruby-1.8.7-p357/ext/openssl '
Make: * * * [ALL] Error 1
The workaround is as follows:
VI ~/INSTALL/RUBY-1.8.7-P357/EXT/OPENSSL/OSSL_PKEY_EC.C
Change the following 4 places, the + number is added:
---ruby-1.8.7-p374/ext/openssl/ossl_pkey_ec.c 2010-06-21 04:18:59.000000000-0500
+++/ROOT/RUBY-1.8.7-P374/EXT/OPENSSL/OSSL_PKEY_EC.C 2013-12-10 13:30:18.919963527-0600
@@ -757,8 +757,10 @@
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) {
@@ -811,8 +813,10 @@
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 {
Rb_raise (Rb_eargerror, "unknown symbol, must BE:GFP or:gf2m");
}
After the change is done, recompile again, as follows:
./configure--prefix=/usr/local/ruby
Make
Make install
And then look at the ruby version number:
/usr/local/ruby/bin/ruby-v
Ruby 1.8.7 (2012-02-08 patchlevel 358) [X86_64-linux]