I’m doing this:
$ apt-get install -y openssl
$ gem install openssl -- --with-openssl-include=/usr/include/openssl
It fails:
...
checking for openssl/ssl.h... yes
checking for CRYPTO_malloc() in -lcrypto... yes
checking for SSL_new() in -lssl... yes
checking for LIBRESSL_VERSION_NUMBER in openssl/opensslv.h... no
checking for OpenSSL version >= 1.0.2... 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/local/rvm/rubies/ruby-3.0.1/bin/$(RUBY_BASE_NAME)
--with-openssl-dir
--with-openssl-include=${openssl-dir}/include
--with-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-nsl-dir
--without-nsl-dir
--with-nsl-include
--without-nsl-include=${nsl-dir}/include
--with-nsl-lib
--without-nsl-lib=${nsl-dir}/lib
--with-nsllib
--without-nsllib
--with-socket-dir
--without-socket-dir
--with-socket-include
--without-socket-include=${socket-dir}/include
--with-socket-lib
--without-socket-lib=${socket-dir}/lib
--with-socketlib
--without-socketlib
--with-crypto-dir
--without-crypto-dir
--with-crypto-include
--without-crypto-include=${crypto-dir}/include
--with-crypto-lib
--without-crypto-lib=${crypto-dir}/lib
--with-cryptolib
--without-cryptolib
--with-ssl-dir
--without-ssl-dir
--with-ssl-include
--without-ssl-include=${ssl-dir}/include
--with-ssl-lib
--without-ssl-lib=${ssl-dir}/lib
--with-ssllib
--without-ssllib
extconf.rb:136:in `<main>': OpenSSL >= 1.0.2 or LibreSSL >= 3.1.0 is required (RuntimeError)
What are the right arguments to pass to gem install
to make it work? This works, by the way:
$ which openssl
/usr/bin/openssl
$ openssl version
OpenSSL 3.0.2 15 Mar 2022 (Library: OpenSSL 3.0.2 15 Mar 2022)
2
Answers
From the line:
I see you’re using ruby 3.0.1 and you’re trying to install openssl 3. Ruby versions lower that 3.1 doesn’t go along with openssl3. You can wether try to install 3.1 o newer or if 3.0.1 is mandatory for you, downgrade openssl to 1.0.
As you’re using rvm, try:
Then, you can try to install your
openssl
gem.You have to upgrade Ruby or downgrade openssl!