ruby-build: 2.3.1 build fails on Ubuntu 18.04 with libssl-dev installed

Hey folks, I’m getting a The Ruby openssl extension was not compiled. Error when trying to build Ruby 2.3.1. The warning and docs have been helpful but unfortunately i’m still being prompted to install libssl-dev even thought it exists on my machine.

Anything I can do to help debug this further or perhaps force it to check a path with a flag?

System

  • rbenv version: rbenv 1.1.1-37-g1c772d5
  • ruby-build version: RUBY_BUILD_VERSION="20180618"
  • OS:
$ lsb_release -a 
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04 LTS
Release:	18.04
Codename:	bionic
  • libssl-dev version
$ apt-cache policy libssl-dev
libssl-dev:
  Installed: 1.1.0g-2ubuntu4
  Candidate: 1.1.0g-2ubuntu4
  Version table:
 *** 1.1.0g-2ubuntu4 500
        500 http://gb.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
        100 /var/lib/dpkg/status

Steps to reproduce

rbenv install 2.3.1.

Output

Downloading ruby-2.3.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.bz2
Installing ruby-2.3.1...

BUILD FAILED (Ubuntu 18.04 using ruby-build 20180618)

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

Last 10 log lines:
installing rdoc:              /home/user/.rbenv/versions/2.3.1/share/ri/2.3.0/system
installing capi-docs:         /home/user/.rbenv/versions/2.3.1/share/doc/ruby
The Ruby openssl extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Try running `apt-get install -y libssl-dev` to fetch missing dependencies.

Configure options used:
  --prefix=/home/user/.rbenv/versions/2.3.1
  LDFLAGS=-L/home/user/.rbenv/versions/2.3.1/lib 
  CPPFLAGS=-I/home/user/.rbenv/versions/2.3.1/include 

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 16

Most upvoted comments

Following on from a diffferent error message on #1207 I can confirm installing libssl1.0-dev sorts the problem sudo apt install libssl1.0-dev

Does the suggestion need to be improved, or is this some ubuntu wierdness?

sudo apt install libssl1.0-dev Reading package lists… Done Building dependency tree Reading state information… Done Package libssl1.0-dev is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source

E: Package ‘libssl1.0-dev’ has no installation candidate

@aristotelesbr2014 Could you try this https://github.com/rbenv/ruby-build/issues/1199#issuecomment-386800501

I used this specifically:

On Ubuntu 19 (or any version I guess), lets install old openssl 1.0 on custom folder and then use argument options when installing ruby.

$ cd ~/src
$ wget https://www.openssl.org/source/openssl-1.0.2s.tar.gz
$ tar xvzf openssl-1.0.2s.tar.gz
$ cd openssl-1.0.2s
$ mkdir ~/.rubies/openssl-1.0.2s
$ ./config --prefix=$HOME/.rubies/openssl-1.0.2s --shared
$ make
$ make install
$ RUBY_CONFIGURE_OPTS=--with-openssl-dir=$HOME/.rubies/openssl-1.0.2s rbenv install 2.3.1

However I’m running on another issue when I run bundle install:

$ gem install bundler
ERROR:  Could not find a valid gem 'bundler' (>= 0), here is why:
          Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=error: certificate verify failed (https://api.rubygems.org/specs.4.8.gz)

EDIT: Found this as well

https://github.com/rubygems/rubygems/issues/2415#issuecomment-509806259

export SSL_CERT_DIR=/etc/ssl/certs
export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
gem install bundler

and I was able to gem install bundler

sudo apt install libssl1.0-dev Reading package lists… Done Building dependency tree Reading state information… Done Package libssl1.0-dev is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source

E: Package ‘libssl1.0-dev’ has no installation candidate

I’m a little unclear on how SSL dependencies work across Linux, but if someone more experienced either with Rbenv or SSL dependencies doesn’t mind having a quick chat I’m happy to put in a PR that either changes the warning message to sudo apt install libssl1.0-dev or see if I can add a conditional check to render the correct message for 18.04.

@IRobL can I confirm that you’re also running 18.04?

Why is this closed?

The workaround by @huwd is great, but most people aren’t going to know that and not everyone will find their way here by goog like I did.

I understand that @CoryWritesCode found a Mac solution, but this issue references installation on Ubuntu. I thought a PR to change the error message seemed like a reasonable solution.

I made this observation while operating on a fresh install of Debian 9.

On Debian, It seems as though installing libssl1.0-dev bumps away libssl-dev and then installing libssl-dev bumps away libssl1.0-dev.

I haven’t even glanced at the rbenv codebase, but this behavior of the packages makes me suspect that ruby-build’s dependency check is explicitly looking for proof of libssl1.0-dev and isn’t actually acknowledging when a (likely) compatible library is installed and ready for use?

I think so @huwd!

Is there a workaround for mac users. I think apt is mainly a linux command.