Wednesday, August 20, 2014

Ruby installation issue with openssl

So i was trying to install ruby 1.87 and the compilation broke due to openssl issue. The error was something like this.

ossl_pkey_ec.c: In function ‘ossl_ec_group_initialize’:
ossl_pkey_ec.c:761: warning: assignment makes pointer from integer without a cast
ossl_pkey_ec.c:815: error: ‘EC_GROUP_new_curve_GF2m’ undeclared (first use in this function)
ossl_pkey_ec.c:815: error: (Each undeclared identifier is 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 `/usr/local/src/ruby-enterprise-1.8.7-2012.02/source/ext/openssl'
make: *** [all] Error 1
So applied this patch to the openssl file in the extracted ruby source and finally the compilation was successfull. You will need to specify the location of the ossl_pkey.ec.c file in the below file or you can mention it while patching.




--- 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");
             }

Change your location to the ruby source directory and save the contents to a file named patch.txt. then issue the following command to patch.

#patch < patch.txt

Hope this helps :)

No comments:

Post a Comment