I've installed Linux Mint 18 on a VM under Windows. When I try to install some rubies I keep getting an error at the same point of the process. I'm using ruby-install, but tried ruby-build also with the same results. I guess they're basically doing the same thing.
I need to install ruby 1.9.3 to work on an old project and it fails, both p448 and p551. Some Ruby 2.xs also fail. I have gotten 2.1.9p490 to compile fully.
Following other advice I've found, I've ensured openssl and libssl-dev are both installed and at their latest versions. Can anyone tell me what's going on and how to fix?
Here's where it fails:
compiling ossl_ssl.c
ossl_ssl.c:116:27: error: ‘SSLv3_method’ undeclared here (not in a function)
OSSL_SSL_METHOD_ENTRY(SSLv3),
^
ossl_ssl.c:106:69: note: in definition of macro ‘OSSL_SSL_METHOD_ENTRY’
#define OSSL_SSL_METHOD_ENTRY(name) { #name, (SSL_METHOD *(*)(void))name##_method }
^
ossl_ssl.c:117:27: error: ‘SSLv3_server_method’ undeclared here (not in a function)
OSSL_SSL_METHOD_ENTRY(SSLv3_server),
^
ossl_ssl.c:106:69: note: in definition of macro ‘OSSL_SSL_METHOD_ENTRY’
#define OSSL_SSL_METHOD_ENTRY(name) { #name, (SSL_METHOD *(*)(void))name##_method }
^
ossl_ssl.c:118:27: error: ‘SSLv3_client_method’ undeclared here (not in a function)
OSSL_SSL_METHOD_ENTRY(SSLv3_client),
^
ossl_ssl.c:106:69: note: in definition of macro ‘OSSL_SSL_METHOD_ENTRY’
#define OSSL_SSL_METHOD_ENTRY(name) { #name, (SSL_METHOD *(*)(void))name##_method }
^
ossl_ssl.c: In function ‘ossl_sslctx_session_new_cb’:
ossl_ssl.c:382:35: warning: variable ‘ret_obj’ set but not used [-Wunused-but-set-variable]
VALUE ary, ssl_obj, sess_obj, ret_obj;
^
ossl_ssl.c: In function ‘ossl_sslctx_session_remove_cb’:
ossl_ssl.c:431:38: warning: variable ‘ret_obj’ set but not used [-Wunused-but-set-variable]
VALUE ary, sslctx_obj, sess_obj, ret_obj;
^
ossl_ssl.c: In function ‘ssl_servername_cb’:
ossl_ssl.c:508:25: warning: variable ‘ret_obj’ set but not used [-Wunused-but-set-variable]
VALUE ary, ssl_obj, ret_obj;
^
Makefile:269: recipe for target 'ossl_ssl.o' failed
make[2]: *** [ossl_ssl.o] Error 1
make[2]: Leaving directory '/usr/local/src/ruby-1.9.3-p448/ext/openssl'
exts.mk:126: recipe for target 'ext/openssl/all' failed
make[1]: *** [ext/openssl/all] Error 2
make[1]: Leaving directory '/usr/local/src/ruby-1.9.3-p448'
uncommon.mk:178: recipe for target 'build-ext' failed
make: *** [build-ext] Error 2
!!! Compiling ruby 1.9.3-p448 failed!
I tried to figure this out for hours and found the answer right after I posted it. Hopefully it helps someone else.
There were problems between some Ruby versions and some versions of OpenSSL. The fix is to find a patch for the version of Ruby you're trying to install. I found patches for many versions other than 1.9.3 (what I needed) so they are out there. (I tried them anyway, but the patching always failed when trying to install 1.9.3.)
Finally found the right patch for 1.9.3 in this discussion over at the archlinux forums.
https://www.reddit.com/r/archlinux/comments/49bw8j/rvm_fails_to_compile_ruby_with_openssl_102g3/
Discussion leads to correct patch here:
https://gist.github.com/anonymous/679228bc324d6fdd3074
Download the patch and then it apply it as you compile with your Ruby installer of choice. They all have switches to apply a patch.
With this patch in place I was able to successfully install ruby-1.9.3-p551 on my system.