【问题标题】:Can't install OpenSSL gem on OSX无法在 OSX 上安装 OpenSSL gem
【发布时间】:2018-10-11 16:50:07
【问题描述】:

我正在尝试按如下方式安装 OpenSSL gem:

sudo gem install openssl -- --with-openssl-dir=/usr/local/opt/openssl

但是,我收到以下错误

Building native extensions with: '-with-openssl-dir=/usr/local/opt/openssl'
This could take a while...
ERROR:  Error installing openssl:
    ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/2.3.0/gems/openssl-2.1.0/ext/openssl
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20180501-55786-16tbndt.rb extconf.rb -with-openssl-dir=/usr/local/opt/openssl
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=/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/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:94: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:

  /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-17/2.3.0/openssl-2.1.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Library/Ruby/Gems/2.3.0/gems/openssl-2.1.0 for inspection.
Results logged to /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-17/2.3.0/openssl-2.1.0/gem_make.out

它说它找不到 OpenSSL。但是,我将它指定为参数,但它仍然没有选择它。有人有什么建议吗?

值得注意的是,错误是:

找不到 OpenSSL 库。您可能想使用 --with-openssl-dir= 选项 指定安装 OpenSSL 的前缀。

【问题讨论】:

  • 如果您使用 ruby-build 或自制软件安装自己的 ruby​​,他们还将安装开箱即用的 openssl。

标签: ruby openssl rubygems


【解决方案1】:

拜托,你能把ls -l /usr/local/opt/openssl的输出发过来吗?

您是否尝试过使用 brew:brew install openssl 安装最新版本的 openssl?

【讨论】:

  • 感谢您的回复。我发现了这个问题。我需要用 OpenSSL 重新编译 Ruby。
猜你喜欢
  • 1970-01-01
  • 2014-08-27
  • 2016-05-21
  • 2012-04-21
  • 2012-12-11
  • 1970-01-01
  • 1970-01-01
  • 2015-05-24
  • 2012-12-07
相关资源
最近更新 更多