Ruby 安装OpenSSL时未能生成gem本机扩展
因此,我遵循本教程:但当我使用Ruby 安装OpenSSL时未能生成gem本机扩展,ruby,macos,openssl,rubygems,Ruby,Macos,Openssl,Rubygems,因此,我遵循本教程:但当我使用捆绑安装时,它会给我以下错误: 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. 连同 Installing openssl 2.2.0 wi
捆绑安装时,它会给我以下错误:
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.
连同
Installing openssl 2.2.0 with native extensions
Installing cppjieba_rb 0.3.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension
但是为什么我会得到这个
正在运行gem安装openssl-v'2.2.0'--源代码'https://rubygems.org/“
给了我
Building native extensions. This could take a while...
ERROR: Error installing openssl:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.6.0/gems/openssl-2.2.0/ext/openssl
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20210225-70291-10x2bpm.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=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/$(RUBY_BASE_NAME)
--with-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:
/Library/Ruby/Gems/2.6.0/extensions/universal-darwin-20/2.6.0/openssl-2.2.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/openssl-2.2.0 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-20/2.6.0/openssl-2.2.0/gem_make.out
构建本机扩展。这可能需要一段时间。。。
错误:安装openssl时出错:
错误:无法生成gem本机扩展。
当前目录:/Library/Ruby/Gems/2.6.0/Gems/openssl-2.2.0/ext/openssl
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/Ruby-I/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/Ruby/2.6.0-r./siteconf20210225-70291-10x2bpm.rb extconf.rb
正在检查-lnsl中的t_open()。。。不
正在检查-lsocket中的套接字()。。。不
正在检查openssl/ssl.h。。。不
***extconf.rb失败***
由于某些原因无法创建Makefile,可能缺少必要的
库和/或标题。有关详细信息,请查看mkmf.log文件。你可以
需要配置选项。
提供的配置选项:
--使用opt dir
--不带opt dir
--选择包含
--不带opt include=${opt dir}/include
--使用opt lib
--不带opt lib=${opt dir}/lib
--用make prog
--没有make prog
--srcdir=。
--库尔迪尔
--ruby=/System/Library/Frameworks/ruby.framework/Versions/2.6/usr/bin/$(ruby\u BASE\u NAME)
--使用openssl目录
--使用openssl包括
--不带openssl include=${openssl dir}/include
--使用openssl库
--没有openssl lib=${openssl dir}/lib
--使用kerberos目录
--没有kerberos目录
--使用kerberos包括
--不带kerberos include=${kerberos dir}/include
--使用kerberos库
--不带kerberos-lib=${kerberos-dir}/lib
--带调试
--无调试
--启用调试
--禁用调试
--与nsllib合作
--没有nsllib
--用socketlib
--没有socketlib
--使用openssl配置
--没有openssl配置
--使用pkg配置
--没有pkg配置
找不到extconf.rb:99:in`:OpenSSL库。您可能希望使用--with openssl dir=选项来指定安装openssl的前缀。(运行时错误)
要了解此扩展未能编译的原因,请检查mkmf.log,该日志可在此处找到:
/Library/Ruby/Gems/2.6.0/extensions/universal-darwin-20/2.6.0/openssl-2.2.0/mkmf.log
extconf失败,退出代码1
Gem文件仍将安装在/Library/Ruby/Gems/2.6.0/Gems/openssl-2.2.0中以供检查。
结果记录到/Library/Ruby/Gems/2.6.0/extensions/universal-darwin-20/2.6.0/openssl-2.2.0/gem_make.out
再说一遍,为什么会发生这种情况?请帮忙!
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ openssl
gem基本上是围绕openssl
库的一组包装。在构建本机扩展步骤中,bundler无法在系统中找到库。因此,gem无法安装
这很奇怪,因为您链接的脚本在绑定gems之前很久就显式安装了openssl
检查脚本的输出是否有错误(并检查是否已达到此步骤)。您可能会在那里找到缺少openssl库的原因(或者简单地尝试使用上面的命令手动安装openssl)
安装openssl
库后,使用命令检查其版本
openssl version -a
如果您有一个自定义的openssl库安装,那么在指定openssl库的路径时,按照错误消息的建议手动安装openssl gem可能会有所帮助您知道openssl库的路径在哪里吗?请稍候,我会一直得到“无效选项--使用openssl目录”好的,我绕过了openSSL错误,但是现在我在安装nokogumbo(2.0.4)时出现了一个错误,Bundler无法继续。确保'gem install nokogumbo-v'2.0.4'--源代码'https://rubygems.org/“`绑定前成功。
并运行任何rake命令时,我会看到:在任何源代码中都找不到openssl-2.2.0,请运行`bundle install`以安装缺少的gems。
openssl version -a