解决linux编译ruby1.8.7错误

post by rocdk890 / 2015-11-25 17:01 Wednesday linux技术
  今天同事要求在测试机上安装ruby和rails的时候,居然安装ruby-1.8.7出现编译错误.如下:
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 `/home/vagrant/ruby-1.8.7-p357/ext/openssl'
make: *** [all] Error 1

解决方法如下:
vi ~/install/ruby-1.8.7-p357/ext/openssl/ossl_pkey_ec.c
改下面4个地方,+号是添加的:
--- 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");
             }


改好了之后,再重新编译,如下:
./configure --prefix=/usr/local/ruby
make
make install
然后再查看ruby版本号:
/usr/local/ruby/bin/ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [x86_64-linux]

好了,问题解决.
ps:http://yukemuri.hatenadiary.jp/entry/2015/04/21/212350
夜空- 本站版权
1、本站所有主题由该文章作者发表,该文章作者与夜空享有文章相关版权
2、其他单位或个人使用、转载或引用本文时必须同时征得该文章作者和夜空的同意
3、本帖部分内容转载自其它媒体,但并不代表本站赞同其观点和对其真实性负责
4、如本帖侵犯到任何版权问题,请立即告知本站,本站将及时予与删除并致以最深的歉意
5、原文链接:blog.slogra.com/post-616.html

标签: linux 编译 ruby ruby1.8.7 ruby-1.8.7

评论: