An error occurred while installing openssl (2.2.0), and Bundler cannot continue while cmd bundle install

Viewed 1073

I'm having a error while bundle install

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/home/vivek/.rvm/gems/ruby-2.6.6/gems/openssl-2.2.0/ext/openssl
/usr/share/rvm/rubies/ruby-2.6.6/bin/ruby -I
/usr/share/rvm/rubies/ruby-2.6.6/lib/ruby/site_ruby/2.6.0 -r
./siteconf20210817-4774-ci9poy.rb extconf.rb
checking for t_open() in -lnsl... no
checking for socket() in -lsocket... no
checking for openssl/ssl.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/share/rvm/rubies/ruby-2.6.6/bin/$(RUBY_BASE_NAME)
    --with-openssl-dir
    --without-openssl-dir
    --with-openssl-include
    --without-openssl-include=${openssl-dir}/include
    --with-openssl-lib
    --without-openssl-lib=${openssl-dir}/lib
    --with-kerberos-dir
    --without-kerberos-dir
    --with-kerberos-include
    --without-kerberos-include=${kerberos-dir}/include
    --with-kerberos-lib
    --without-kerberos-lib=${kerberos-dir}/lib
    --with-debug
    --without-debug
    --enable-debug
    --disable-debug
    --with-nsllib
    --without-nsllib
    --with-socketlib
    --without-socketlib
    --with-openssl-config
    --without-openssl-config
    --with-pkg-config
    --without-pkg-config
extconf.rb:99:in `<main>': OpenSSL library could not be found. You might want to
use --with-openssl-dir=<dir> option to specify the prefix where OpenSSL is
installed. (RuntimeError)

To see why this extension failed to compile, please check the mkmf.log which can
be found here:

/home/vivek/.rvm/gems/ruby-2.6.6/extensions/x86_64-linux/2.6.0/openssl-2.2.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in
/home/vivek/.rvm/gems/ruby-2.6.6/gems/openssl-2.2.0 for inspection.
Results logged to
/home/vivek/.rvm/gems/ruby-2.6.6/extensions/x86_64-linux/2.6.0/openssl-2.2.0/gem_make.out

An error occurred while installing openssl (2.2.0), and Bundler cannot
continue.
Make sure that `gem install openssl -v '2.2.0' --source 'https://rubygems.org/'`
succeeds before bundling.

In Gemfile:
  openssl

then while installing gem install openssl -v '2.2.0' --source 'https://rubygems.org/'

Building native extensions. This could take a while...
ERROR:  Error installing openssl:
    ERROR: Failed to build gem native extension.

    current directory: /home/vivek/.rvm/gems/ruby-2.6.6/gems/openssl-2.2.0/ext/openssl
/usr/share/rvm/rubies/ruby-2.6.6/bin/ruby -I /usr/share/rvm/rubies/ruby-2.6.6/lib/ruby/site_ruby/2.6.0 -r ./siteconf20210817-5107-y9i9dg.rb extconf.rb
checking for t_open() in -lnsl... no
checking for socket() in -lsocket... no
checking for openssl/ssl.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/share/rvm/rubies/ruby-2.6.6/bin/$(RUBY_BASE_NAME)
    --with-openssl-dir
    --without-openssl-dir
    --with-openssl-include
    --without-openssl-include=${openssl-dir}/include
    --with-openssl-lib
    --without-openssl-lib=${openssl-dir}/lib
    --with-kerberos-dir
    --without-kerberos-dir
    --with-kerberos-include
    --without-kerberos-include=${kerberos-dir}/include
    --with-kerberos-lib
    --without-kerberos-lib=${kerberos-dir}/lib
    --with-debug
    --without-debug
    --enable-debug
    --disable-debug
    --with-nsllib
    --without-nsllib
    --with-socketlib
    --without-socketlib
    --with-openssl-config
    --without-openssl-config
    --with-pkg-config
    --without-pkg-config
extconf.rb:99:in `<main>': OpenSSL library could not be found. You might want to use --with-openssl-dir=<dir> option to specify the prefix where OpenSSL is installed. (RuntimeError)

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/vivek/.rvm/gems/ruby-2.6.6/extensions/x86_64-linux/2.6.0/openssl-2.2.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/vivek/.rvm/gems/ruby-2.6.6/gems/openssl-2.2.0 for inspection.
Results logged to /home/vivek/.rvm/gems/ruby-2.6.6/extensions/x86_64-linux/2.6.0/openssl-2.2.0/gem_make.out

My problem is I want to do bundle install

This issue is related to:

-openssl -v '2.2.0'

Here are my current environment details:

rvm --version rvm 1.29.12 (manual) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]

ruby --version ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-linux]

bundle --version Bundler version 2.2.21

0 Answers
Related