解决linux编译ruby1.8.7错误
时间:2016-06-05 00:06 来源:linux.it.net.cn 作者:IT
今天同事要求在测试机上安装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个地方,+号是添加的:
01
--- ruby-1.8.7-p374/ext/openssl/ossl_pkey_ec.c 2010-06-21 04:18:59.000000000 -0500
02
+++ /root/ruby-1.8.7-p374/ext/openssl/ossl_pkey_ec.c 2013-12-10 13:30:18.919963527 -0600
03
@@ -757,8 +757,10 @@
04
method = EC_GFp_mont_method();
05
} else if (id == s_GFp_nist) {
06
method = EC_GFp_nist_method();
07
+ #if !defined(OPENSSL_NO_EC2M)
08
} else if (id == s_GF2m_simple) {
09
method = EC_GF2m_simple_method();
10
+ #endif
11
}
12
13
if (method) {
14
@@ -811,8 +813,10 @@
15
16
if (id == s_GFp) {
17
new_curve = EC_GROUP_new_curve_GFp;
18
+ #if !defined(OPENSSL_NO_EC2M)
19
} else if (id == s_GF2m) {
20
new_curve = EC_GROUP_new_curve_GF2m;
21
+ #endif
22
} else {
23
rb_raise(rb_eArgError, "unknown symbol, must be :GFp or :GF2m");
24
}
改好了之后,再重新编译,如下:
./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
(责任编辑:IT)
今天同事要求在测试机上安装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个地方,+号是添加的:
改好了之后,再重新编译,如下: ./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 (责任编辑:IT) |