openssl Ruby gem安装失败,因为它找不到Ubuntu中安装的openssl

mwyxok5s  于 11个月前  发布在  Ruby
关注(0)|答案(2)|浏览(131)

我在做这个:

$ apt-get install -y openssl
$ gem install openssl -- --with-openssl-include=/usr/include/openssl

字符串
它失败:

...
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)


传递给gem install的正确参数是什么?顺便说一下,这是有效的:

$ which openssl
/usr/bin/openssl
$ openssl version
OpenSSL 3.0.2 15 Mar 2022 (Library: OpenSSL 3.0.2 15 Mar 2022)

3pmvbmvn

3pmvbmvn1#

从线:

--ruby=/usr/local/rvm/rubies/ruby-3.0.1/bin/$(RUBY_BASE_NAME)

字符串
我看到你正在使用ruby 3.0.1,并且你正在尝试安装openssl 3。低于3.1的Ruby版本不沿着openssl 3。你可以尝试安装3.1或更新的版本,或者如果3.0.1对你来说是强制性的,将openssl降级到1.0。
当你使用rvm时,试着:

rvm install 3.1.4 --with-openssl-dir=<the directory you have>


然后,您可以尝试安装openssl gem。

k5hmc34c

k5hmc34c2#

尝试指定路径:

gem install openssl -- --with-openssl-dir=/usr

字符串
此命令允许您在gem安装过程中指定OpenSSL库和头文件的位置。如果此方法不起作用,您也可以尝试单独指定库和包含的目录,如下所示:

gem install openssl -- --with-openssl-lib=/usr/lib --with-openssl-include=/usr/include

相关问题