geerlingguy/ansible-role-ruby

Ruby 2.3 builds from source fail on Ubuntu 18

Closed this issue · 1 comments

Using Ansible 2.7:

ansible 2.7.0
  config file = None
  configured module search path = ['/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.7.0 (default, Jun 29 2018, 20:13:13) [Clang 9.1.0 (clang-902.0.39.2)]

Provisioning against Ubuntu 18:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.1 LTS"

Attempting to build/use ruby 2.3.7:

ruby 2.3.7p456 (2018-03-28 revision 63024) [x86_64-linux]

When using the role, ruby would build fine but this error would occur for the install of bundler:

2018-10-18 10:18:26,695 p=1026 u=shane |  TASK [ruby : Install Bundler.] ***********************************************************************************
2018-10-18 10:18:26,695 p=1026 u=shane |  Thursday 18 October 2018  10:18:26 -0400 (0:00:00.765)       0:04:46.810 ******
2018-10-18 10:18:27,478 p=1026 u=shane |  fatal: [ubuntu18]: FAILED! => {
    "changed": false,
    "cmd": "/usr/local/bin/gem install --no-user-install --no-document bundler",
    "rc": 1
}

STDERR:

ERROR:  While executing gem ... (Gem::Exception)
    Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources



MSG:

ERROR:  While executing gem ... (Gem::Exception)
    Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources

I did some tire kicking and google fuing and found out that libssl-dev package is not compatible with ruby2.3. Being able to specify different ruby build packages and ensuring that libssl1.0-dev was installed first and that libssl-dev was not present resolved this for me on Ubuntu 18, building ruby 2.3.7 from source.

refs:

zavan commented

I still get the same error with the latest version (2.6.0) of the role when trying to install bundler with ruby 2.3.8 (which builds successfully) on Ubuntu 18.04.

    - role: geerlingguy.ruby
      become: yes
      vars:
        ruby_version: 2.3.8
        ruby_install_from_source: true
        ruby_download_url: 'https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.8.tar.gz'

Edit: Tried 2.3.7, same thing.

Edit2: Ok, this worked for ruby 2.3.8:

  - role: geerlingguy.ruby
    become: yes
    vars:
      ruby_version: 2.3.8
      ruby_install_from_source: true
      ruby_download_url: 'https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.8.tar.gz'
      ruby_build_packages:
          - build-essential
          - zlib1g-dev
          - libssl1.0-dev # This is what we're overriding
          - libyaml-dev
          - libreadline6-dev
          - libncurses5-dev
          - libffi-dev
          - libgdbm-dev