Ruby-build: Cannot install Ruby 2.2.3 in ubuntu 14.04

Created on 24 Nov 2015  ·  37Comments  ·  Source: rbenv/ruby-build

Hi,

I am getting below error while installing Ruby 2.2.3 in fresh ubuntu install.

ossl_ssl.c:141:27: error: ‘SSLv3_method’ undeclared here (not in a function)
     OSSL_SSL_METHOD_ENTRY(SSLv3),
                           ^
ossl_ssl.c:119: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:142:27: error: ‘SSLv3_server_method’ undeclared here (not in a function)
     OSSL_SSL_METHOD_ENTRY(SSLv3_server),
                           ^
ossl_ssl.c:119: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:143:27: error: ‘SSLv3_client_method’ undeclared here (not in a function)
     OSSL_SSL_METHOD_ENTRY(SSLv3_client),
                           ^
ossl_ssl.c:119:69: note: in definition of macro ‘OSSL_SSL_METHOD_ENTRY’
 #define OSSL_SSL_METHOD_ENTRY(name) { #name, (SSL_METHOD *(*)(void))name##_method }
                                                                     ^
make[2]: Leaving directory `/tmp/ruby-build.20151124103608.7950/ruby-2.2.3/ext/date'
make[2]: Entering directory `/tmp/ruby-build.20151124103608.7950/ruby-2.2.3/ext/sdbm'
compiling _sdbm.c
make[2]: *** [ossl_ssl.o] Error 1
make[2]: *** Waiting for unfinished jobs....
compiling init.c
make[2]: Leaving directory `/tmp/ruby-build.20151124103608.7950/ruby-2.2.3/ext/openssl'
make[1]: *** [ext/openssl/all] Error 2
make[1]: *** Waiting for unfinished jobs....
checking ../.././parse.y and ../.././ext/ripper/eventids2.c
installing default ripper libraries
linking shared-object sdbm.so
make[2]: Leaving directory `/tmp/ruby-build.20151124103608.7950/ruby-2.2.3/ext/sdbm'
linking shared-object ripper.so
make[2]: Leaving directory `/tmp/ruby-build.20151124103608.7950/ruby-2.2.3/ext/ripper'
make[1]: Leaving directory `/tmp/ruby-build.20151124103608.7950/ruby-2.2.3'
make: *** [build-ext] Error 2

Thank you

unconfirmed

Most helpful comment

Using Ubuntu 18 here, solved doing this:

sudo apt install libssl1.0-dev
rbenv install 2.2.2

The problem is that this ruby version uses an old version of libssl (1.0) and the default package for Ubuntu is libssl 1.1.0

All 37 comments

Have you installed the suggested Ubuntu packages? Installing libssl-dev would be the key here. Try it and report back. Thanks!

Having the same problem on a fresh 14.04 install. libssl-dev installed. Also happening for me on 2.2.2. Following the process here: https://gist.github.com/thepoho/26e8d8d1ead67bd6ca51

@mislav
It's already installed in my ubuntu 14.04. Is there any other alternative.

Now I also did
sudo apt-get dist-upgrade to make sure I am not using older ssl versions. Then also I am getting error

linking shared-object sdbm.so
ossl_ssl.c:141:27: error: ‘SSLv3_method’ undeclared here (not in a function)
     OSSL_SSL_METHOD_ENTRY(SSLv3),
                           ^
ossl_ssl.c:119: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:142:27: error: ‘SSLv3_server_method’ undeclared here (not in a function)
     OSSL_SSL_METHOD_ENTRY(SSLv3_server),
                           ^
ossl_ssl.c:119: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:143:27: error: ‘SSLv3_client_method’ undeclared here (not in a function)
     OSSL_SSL_METHOD_ENTRY(SSLv3_client),
                           ^
ossl_ssl.c:119:69: note: in definition of macro ‘OSSL_SSL_METHOD_ENTRY’
 #define OSSL_SSL_METHOD_ENTRY(name) { #name, (SSL_METHOD *(*)(void))name##_method }
                                                                     ^
make[2]: Leaving directory `/tmp/ruby-build.20151127184330.2839/ruby-2.2.3/ext/sdbm'
make[2]: *** [ossl_ssl.o] Error 1
make[2]: *** Waiting for unfinished jobs....
checking ../.././parse.y and ../.././ext/ripper/eventids2.c
make[2]: Entering directory `/tmp/ruby-build.20151127184330.2839/ruby-2.2.3/ext/socket'
generating constant definitions
installing default ripper libraries
make[2]: Entering directory `/tmp/ruby-build.20151127184330.2839/ruby-2.2.3/ext/stringio'
compiling stringio.c
generating constant definitions
compiling basicsocket.c
compiling socket.c
make[2]: Leaving directory `/tmp/ruby-build.20151127184330.2839/ruby-2.2.3/ext/openssl'
make[1]: *** [ext/openssl/all] Error 2
make[1]: *** Waiting for unfinished jobs....
compiling ipsocket.c
linking shared-object stringio.so
make[2]: Leaving directory `/tmp/ruby-build.20151127184330.2839/ruby-2.2.3/ext/stringio'
compiling tcpsocket.c
compiling tcpserver.c
compiling sockssocket.c
compiling udpsocket.c
compiling unixsocket.c
compiling unixserver.c
compiling option.c
compiling ancdata.c
compiling raddrinfo.c
compiling ifaddr.c
installing default socket libraries
compiling init.c
compiling constants.c
linking shared-object socket.so
make[2]: Leaving directory `/tmp/ruby-build.20151127184330.2839/ruby-2.2.3/ext/socket'
linking shared-object ripper.so
make[2]: Leaving directory `/tmp/ruby-build.20151127184330.2839/ruby-2.2.3/ext/ripper'
make[1]: Leaving directory `/tmp/ruby-build.20151127184330.2839/ruby-2.2.3'
make: *** [build-ext] Error 2

Thank you

Same issue here with fresh ubuntu 14.04 install.

I could not reproduce this issue with ubuntu 14.04.3

@bhargavmehta @thepoho @zeke8402
Can you paste results of cat /etc/issue, apt show libssl-dev and apt show libssl1.0.0?

Same issue here with Debian Strech.

alexandreab

@zeke8402 Your linux boxes with vagrant seems to be broken. My linux server shows different version of libssl-dev under apt dist-upgrade environment on ubuntu trusty.

What's name or url your vagrant box?

@zeke8402
I can't reproduce ubuntu trusty with vagrant. You should remove 3rd party apt-line or install same version (1.0.1f-ubuntu2.15) of libssl-dev. It's not related ruby-build issue.

Right, I do not have the latest dist-upgrade. However it appears to be an issue with ruby itself. I was able to get it working by following this using rvm. If you'd like I can perform a dist-upgrade and attempting the installation again at a later time.

Thank you for your pointing.

I can reproduce this issue with debian stretch. Some beta distribution will disable SSLv3 on OpenSSL packages. Next version of ruby will fix this issue. /cc @alexandreab

but ubuntu xenial supports SSLv3 yet. I confirmed to success to build Ruby 2.2.3.

@mislav this issue is caused distribution policies. Ruby core team will release Ruby 2.2.4 and 2.1.8 before 2016.

This seems to be a cross-plateform issue. I'm running an up-to-date Debian stretch with all the dependencies I usually need, and I too fail to install ruby 2.2.3 using rbenv.

Linux yoones-laptop 4.2.0-1-amd64 #1 SMP Debian 4.2.6-1 (2015-11-10) x86_64 GNU/Linux

sudo apt-get install -y -f build-essential openssl libreadline6 libreadline6-dev curl libcurl4-openssl-dev git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison pkg-config libpq-dev libmysqlclient-dev libmagickcore-dev libmagickwand-dev imagemagick nodejs libffi-dev libgnutls28-dev
compiling ossl_ssl.c
ossl_ssl.c:141:27: error: ‘SSLv3_method’ undeclared here (not in a function)
     OSSL_SSL_METHOD_ENTRY(SSLv3),
                           ^
ossl_ssl.c:119: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:142:27: error: ‘SSLv3_server_method’ undeclared here (not in a function)
     OSSL_SSL_METHOD_ENTRY(SSLv3_server),
                           ^
ossl_ssl.c:119: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:143:27: error: ‘SSLv3_client_method’ undeclared here (not in a function)
     OSSL_SSL_METHOD_ENTRY(SSLv3_client),
                           ^
ossl_ssl.c:119:69: note: in definition of macro ‘OSSL_SSL_METHOD_ENTRY’
 #define OSSL_SSL_METHOD_ENTRY(name) { #name, (SSL_METHOD *(*)(void))name##_method }
                                                                     ^
Makefile:293: recipe for target 'ossl_ssl.o' failed
make[2]: *** [ossl_ssl.o] Error 1
make[2]: *** Attente des tâches non terminées....
make[2]: Leaving directory '/tmp/ruby-build.20151130125358.8468/ruby-2.2.3/ext/openssl'
exts.mk:201: recipe for target 'ext/openssl/all' failed
make[1]: *** [ext/openssl/all] Error 2
make[1]: *** Attente des tâches non terminées....
linking shared-object socket.so
make[2]: Leaving directory '/tmp/ruby-build.20151130125358.8468/ruby-2.2.3/ext/socket'
make[1]: Leaving directory '/tmp/ruby-build.20151130125358.8468/ruby-2.2.3'
uncommon.mk:189: recipe for target 'build-ext' failed
make: *** [build-ext] Error 2

Could everyone who's having this problem try this patch as a workaround?

curl -fsSL https://gist.github.com/mislav/055441129184a1512bb5.txt | rbenv install --patch 2.2.3

Thanks!

Thanks, it works for me. I included your patch in my ruby/rails install script (https://github.com/yoones/railsondeb)

Will add this patch as a caveat in our wiki.

Thanks mate - worked for me.

@mislav Its working thank you very much

Beautiful ! Had the same problem, came here, and this patch solved my problem !

Thank's very much.

confirmed @mislav patch works on ubuntu 15.10 64-bit. thanks.

Works for me as well on Stretch.
Thanks

I know this thread is a little old, but I wanted to chime in and say I was having the same problem on Arch and that the patch above fixed it. Cheers!

I had the same problem when installing on ubuntu 14.04 in docker. This fixed my problem.

Hi and thx! It works for me too. The ruby 2.2.4 seems to be fixed, but currently 2.2.3 is my needed version so thx so much.
PS:. rbenv is my ruby env manager

I had the same problem on Ubuntu 14.04. The patch works for me.

I'm working with a fresh, up-to-date install of Arch and, despite trying @mislav's patch and others and several ruby versions, continue to get the SSLv3 error in all cases:

curl -fsSL https://gist.github.com/mislav/055441129184a1512bb5.txt | rbenv install --patch 2.2.3

yields:

installing bundle gems: /home/lbrown/.linuxbrew/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0 (build_info, cach e, doc, extensions, gems, specifications)
/tmp/ruby-build.20160915151644.17700/ruby-2.2.3/lib/rubygems/core_ext/kernel_require.rb:54:in `require': /tmp/ruby-b uild.20160915151644.17700/ruby-2.2.3/.ext/x86_64-linux/openssl.so: undefined symbol: SSLv3_method - /tmp/ruby-build. 20160915151644.17700/ruby-2.2.3/.ext/x86_64-linux/openssl.so (LoadError)

What might you folks suggest?

Having same issues as @lewisbrown. I tried @mislav 's patch but build fails. All ruby versions < 2.4.x fail.

Info:
Linux archbox 4.10.13-1-ARCH #1 SMP PREEMPT Thu Apr 27 12:15:09 CEST 2017 x86_64 GNU/Linux

curl -fsSL https://gist.github.com/mislav/055441129184a1512bb5.txt | rbenv install --patch 2.2.4

``` ⏎
Downloading ruby-2.2.4.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.4.tar.bz2
Installing ruby-2.2.4...
patching file ext/openssl/extconf.rb
Hunk #1 FAILED at 104.
1 out of 1 hunk FAILED -- saving rejects to file ext/openssl/extconf.rb.rej
patching file ext/openssl/ossl_ssl.c
Hunk #1 FAILED at 109.
1 out of 1 hunk FAILED -- saving rejects to file ext/openssl/ossl_ssl.c.rej

BUILD FAILED (Arch Linux using ruby-build 20170405-2-g3b15693)

Inspect or clean up the working tree at /tmp/tmp.PPLKSdN7zN/ruby-build.20170511113555.4593
Results logged to /tmp/tmp.PPLKSdN7zN/ruby-build.20170511113555.4593.log

Last 10 log lines:
/tmp/tmp.PPLKSdN7zN/ruby-build.20170511113555.4593 ~
/tmp/tmp.PPLKSdN7zN/ruby-build.20170511113555.4593/ruby-2.2.4 /tmp/tmp.PPLKSdN7zN/ruby-build.20170511113555.4593 ~

It also fails if patch is not used. 

``` rbenv install 2.2.4```

Downloading ruby-2.2.4.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.4.tar.bz2
Installing ruby-2.2.4...

BUILD FAILED (Arch Linux using ruby-build 20170405-2-g3b15693)

Inspect or clean up the working tree at /tmp/tmp.SaVeVV0ted/ruby-build.20170511112706.24850
Results logged to /tmp/tmp.SaVeVV0ted/ruby-build.20170511112706.24850.log

Last 10 log lines:
make[2]: Leaving directory '/tmp/tmp.SaVeVV0ted/ruby-build.20170511112706.24850/ruby-2.2.4/ext/openssl'
make[1]: * [exts.mk:201: ext/openssl/all] Error 2
make[1]:
Waiting for unfinished jobs....
make[2]: Leaving directory '/tmp/tmp.SaVeVV0ted/ruby-build.20170511112706.24850/ruby-2.2.4/ext/json/generator'
linking shared-object objspace.so
make[2]: Leaving directory '/tmp/tmp.SaVeVV0ted/ruby-build.20170511112706.24850/ruby-2.2.4/ext/objspace'
linking shared-object nkf.so
make[2]: Leaving directory '/tmp/tmp.SaVeVV0ted/ruby-build.20170511112706.24850/ruby-2.2.4/ext/nkf'
make[1]: Leaving directory '/tmp/tmp.SaVeVV0ted/ruby-build.20170511112706.24850/ruby-2.2.4'
make: *
* [uncommon.mk:189: build-ext] Error 2
```

@jatindhankhar: I ran into the same problem on Archlinux.

The problem is that ruby < 2.4 tries to use the system default OpenSSL, which then fails with:

compiling ossl_pkcs7.c
In file included from ossl.h:57:0,
                  from ossl_pkcs7.c:10:
/usr/include/openssl/asn1_mac.h:10:2: error: #error "This file is obsolete; please update your software."
#error "This file is obsolete; please update your software."

The workaround for that is to force ruby to use OpenSSL 1.0 suggested in the Archlinux wiki for rvm, but the same thing works for rbenv:

sudo pacman -S openssl-1.0 # Probably already installed
PKG_CONFIG_PATH=/usr/lib/openssl-1.0/pkgconfig:/usr/lib/pkgconfig rbenv install 2.2.4

@piotrdz Just followed your suggestions and it works :+1:

https://github.com/rbenv/ruby-build/issues/834#issuecomment-160627207 was good for me to get ruby 2.1.5 to 2.1.7 compiled in debian 9.

I am on a fresh 4.9.35-1-MANJARO and neither

sudo pacman -S openssl-1.0 # Probably already installed PKG_CONFIG_PATH=/usr/lib/openssl-1.0/pkgconfig:/usr/lib/pkgconfig rbenv install 2.2.3

nor

curl -fsSL https://gist.github.com/mislav/055441129184a1512bb5.txt | rbenv install --patch 2.2.3 is working in my case. Versions > 2.4 are ok.

Last 10 log lines:
linking shared-object pathname.so make[2]: Leaving directory '/tmp/ruby-build.20170712154121.2082/ruby-2.2.3/ext/pathname' linking shared-object bigdecimal.so make[2]: Leaving directory '/tmp/ruby-build.20170712154121.2082/ruby-2.2.3/ext/bigdecimal' linking shared-object date_core.so make[2]: Leaving directory '/tmp/ruby-build.20170712154121.2082/ruby-2.2.3/ext/date' linking shared-object nkf.so make[2]: Leaving directory '/tmp/ruby-build.20170712154121.2082/ruby-2.2.3/ext/nkf' make[1]: Leaving directory '/tmp/ruby-build.20170712154121.2082/ruby-2.2.3' make: *** [uncommon.mk:189: build-ext] Error 2

Any suggestions?

For anyone running into the same error as @abieler check my comment on this other issue: https://github.com/rbenv/ruby-build/issues/930#issuecomment-322672194

Using Ubuntu 18 here, solved doing this:

sudo apt install libssl1.0-dev
rbenv install 2.2.2

The problem is that this ruby version uses an old version of libssl (1.0) and the default package for Ubuntu is libssl 1.1.0

It works great thank you @timotta !

Worked for me trying to install ruby 1.9.3 with rbenv on ubuntu server 18.04, thanks @timotta !

Ubuntu 19 does not include libssl1.0-dev in the standard repositories. I solved this by adding the cosmic security repository as per: https://packages.ubuntu.com/cosmic/amd64/libssl1.0.0/download

Add this line to /etc/apt/sources.list:
deb http://security.ubuntu.com/ubuntu cosmic-security main

Then run

sudo apt update
sudo apt install libssl1.0-dev
rbenv install 2.2.3

Using Ubuntu 18 here, solved doing this:

sudo apt install libssl1.0-dev
rbenv install 2.2.2

The problem is that this ruby version uses an old version of libssl (1.0) and the default package for Ubuntu is libssl 1.1.0

Perfect. It worked for me on Elementary OS after trying all of the above.

Was this page helpful?
0 / 5 - 0 ratings