I decided to port all my Rails projects to use the rvm and rvmrc to have separate environment and avoid conflicts between gems.
My frustration only grew when I was trying to update Ruby on my debian squeeze.
First shot:
rvm install ruby-head
Failed!
compiling ossl_ssl.c
ossl_ssl.c:110:1: error: ‘SSLv2_method’ undeclared here (not in a function)
ossl_ssl.c:111:1: error: ‘SSLv2_server_method’ undeclared here (not in a function)
ossl_ssl.c:112:1: error: ‘SSLv2_client_method’ undeclared here (not in a function)
make[2]: *** [ossl_ssl.o] Error 1
It's because debian removed support for SSLv2 which is deprecated because of security problems
rvm install ruby-1.9.2
Failed!
PIC -I. -I.ext/include/i686-linux -I./include -I. -DRUBY_EXPORT -o dmyversion.o -c dmyversion.c
In file included from vm.c:26:0:
vm_eval.c: In function ‘loop_i’:
vm_eval.c:801:1: internal compiler error: in dfs_enumerate_from, at cfganal.c:1207
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.5/README.Bugs> for instructions.
make: *** [vm.o] Error 1
Which means it's a bug in compiler itself! There is regression bug in gcc 4.5, there are some patches backported from 4.6 but I would have to patch gcc by hand.
rvm install ruby-1.9.1
ossl_ssl.c:1201:2: warning: passing argument 1 of ‘sk_value’ from incompatible pointer type
/usr/include/openssl/stack.h:80:7: note: expected ‘const struct _STACK *’ but argument is of type ‘struct stack_st_X509 *’
ossl_ssl.c: In function ‘ossl_ssl_get_cipher’:
ossl_ssl.c:1223:12: warning: assignment discards qualifiers from pointer target type
ossl_pkcs7.c:575:14: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
ossl_pkcs7.c: In function ‘ossl_pkcs7_set_certificates’:
ossl_pkcs7.c:613:5: warning: implicit declaration of function ‘pkcs7_get_certs_or_crls’
ossl_pkcs7.c:613:11: warning: assignment makes pointer from integer without a cast
ossl_pkcs7.c: In function ‘ossl_pkcs7_get_certificates’:
ossl_pkcs7.c:623:5: warning: passing argument 1 of ‘ossl_x509_sk2ary’ makes pointer from integer without a cast
ossl.h:117:7: note: expected ‘struct stack_st_X509 *’ but argument is of type ‘int’
ossl_pkcs7.c: In function ‘ossl_pkcs7_set_crls’:
ossl_pkcs7.c:653:10: warning: assignment makes pointer from integer without a cast
ossl_pkcs7.c: In function ‘ossl_pkcs7_get_crls’:
ossl_pkcs7.c:663:5: warning: passing argument 1 of ‘ossl_x509crl_sk2ary’ makes pointer from integer without a cast
ossl.h:118:7: note: expected ‘struct stack_st_X509_CRL *’ but argument is of type ‘int’
make[1]: *** [ossl_pkcs7.o] Error 1
So finally I decided that the easiest way will be to remove the checks for SSLv2 in Ruby and created this patch:
cat /tmp/disable_ssl2.patch
diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c
index d8951fb..4254b76 100644
--- a/ext/openssl/ossl_ssl.c
+++ b/ext/openssl/ossl_ssl.c
@@ -107,9 +107,11 @@ struct {
OSSL_SSL_METHOD_ENTRY(TLSv1),
OSSL_SSL_METHOD_ENTRY(TLSv1_server),
OSSL_SSL_METHOD_ENTRY(TLSv1_client),
- OSSL_SSL_METHOD_ENTRY(SSLv2),
+/*
+OSSL_SSL_METHOD_ENTRY(SSLv2),
OSSL_SSL_METHOD_ENTRY(SSLv2_server),
OSSL_SSL_METHOD_ENTRY(SSLv2_client),
+*/
OSSL_SSL_METHOD_ENTRY(SSLv3),
OSSL_SSL_METHOD_ENTRY(SSLv3_server),
OSSL_SSL_METHOD_ENTRY(SSLv3_client),
So now you can successfully compile ruby using:
rvm install ruby-head --patch /tmp/disable_ssl2.patch
And finally success!!!!
ruby --version
ruby 1.8.7 (2010-12-23 patchlevel 330) [i686-linux]
It works also for ruby 1.9.2
rvm install ruby-1.9.2 --patch /tmp/disable_ssl2.patch
ruby --version
ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]