postmodern / ruby-install

Installs Ruby, JRuby, TruffleRuby, or mruby
MIT License
1.89k stars 250 forks source link

openssl and other isses when installing Ruby 2.7.5 #480

Closed alexwilliamsdr closed 5 months ago

alexwilliamsdr commented 5 months ago

Hi,

Can anyone help me on this issue. I'm using AWS Linux 2 and I'm trying to install ruby 2.7.5 on the machine with the following command:

sudo /home/developer/ruby_install/bin/ruby-install ruby 2.7.5 --install-dir /opt/ruby/2.7.5 but fails with the details at the end.

I tried with sudo /home/developer/ruby_install/bin/ruby-install ruby 2.7.5 --install-dir /opt/ruby/2.7.5 --with-openssl-dir=/usr/bin/openssl but get: ruby-install: unrecognized option --with-openssl-dir=/usr/bin/openssl

My openssl version is: OpenSSL 1.0.2k-fips 26 Jan 2017

the first command runs through a lot of processing but ultimately fails with the details below (I've installed gdbm, readline, groupinstall "Developer Tools", and zlib but there is no yum package for dbm, I just find: ================================================ N/S matched: dbm ================================================ gdbm-devel.aarch64 : Development libraries and header files for the gdbm library gdbm.aarch64 : A GNU set of database routines which use extensible hashing tokyocabinet.aarch64 : A modern implementation of a DBM ):

Following extensions are not compiled: -test-/cxxanyargs: Could not be configured. It will not be installed. /usr/local/src/ruby-2.7.5/lib/mkmf.rb:471: The compiler failed to generate an executable file. You have to install development tools first. Check ext/-test-/cxxanyargs/mkmf.log for more details. dbm: Could not be configured. It will not be installed. Check ext/dbm/mkmf.log for more details. gdbm: Could not be configured. It will not be installed. Check ext/gdbm/mkmf.log for more details. openssl: Could not be configured. It will not be installed. /usr/local/src/ruby-2.7.5/ext/openssl/extconf.rb:96: OpenSSL library could not be found. You might want to use --with-openssl-dir=

option to specify the prefix where OpenSSL is installed. Check ext/openssl/mkmf.log for more details. readline: Could not be configured. It will not be installed. /usr/local/src/ruby-2.7.5/ext/readline/extconf.rb:62: Neither readline nor libedit was found Check ext/readline/mkmf.log for more details. zlib: Could not be configured. It will not be installed. Check ext/zlib/mkmf.log for more details. Fix the problems, then remove these directories and try again if you want.

Any help would be greatly appreciated. Thanks.

postmodern commented 5 months ago

It appears that ruby-install is not installing the openssl, libreadline, etc, dependencies. Apparently AWS Linux is based on RHEL and uses the yum package manager. Not sure why ruby-install isn't detecting yum and installing the packages via yum. Make sure you have the following packages installed xz gcc automake bison zlib-devel libyaml-devel openssl-devel gdbm-devel readline-devel ncurses-devel libffi-devel.

alexwilliamsdr commented 5 months ago

Thanks so much for the quick reply! That worked!!

I first checked with yum directly:

[ sudo yum install xz gcc automake bison zlib-devel libyaml-devel openssl-devel gdbm-devel readline-devel ncurses-devel libffi-devel ]

and those packages were not installed, then I added them for install in the ansible playbook with:

- name: "Prerequisite: ensure devel pkgs are installed on machine"
  ansible.builtin.yum:
    name: xz,gcc,automake,bison,zlib-devel,libyaml-devel,openssl-devel,gdbm-devel,readline-devel,ncurses-devel,libffi-devel
    state: present

and viola, everything worked! [>>> Successfully installed ruby 2.7.5 into /opt/ruby/2.7.5]

Thanks so much!

Ansible:

Direct console: sudo /home/developer/ruby_install/bin/ruby-install ruby 2.7.5 --install-dir /opt/ruby/2.7.5