ruby - 在 mint 中使用 rbenv 的 Ruby 2.3.8 安装错误 | uncommon.mk:203:目标“build-ext”的配方失败
问题描述
我刚刚安装了 Mint 19(Tara) 并尝试使用安装 Ruby2.3.8
并rbenv
收到此错误。有人可以帮我解决这个问题吗?
$ rbenv install 2.3.8 1 ↵
Downloading ruby-2.3.8.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.8.tar.bz2
Installing ruby-2.3.8...
WARNING: ruby-2.3.8 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.
BUILD FAILED (LinuxMint 19 using ruby-build 20200401-11-g12af1c3)
Inspect or clean up the working tree at /tmp/ruby-build.20200519084931.6743.ptWQ7b
Results logged to /tmp/ruby-build.20200519084931.6743.log
Last 10 log lines:
../../internal.h:84:30: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
linking shared-object json/ext/generator.so
make[2]: Leaving directory '/tmp/ruby-build.20200519084931.6743.ptWQ7b/ruby-2.3.8/ext/json/generator'
linking shared-object objspace.so
make[2]: Leaving directory '/tmp/ruby-build.20200519084931.6743.ptWQ7b/ruby-2.3.8/ext/objspace'
linking shared-object nkf.so
make[2]: Leaving directory '/tmp/ruby-build.20200519084931.6743.ptWQ7b/ruby-2.3.8/ext/nkf'
make[1]: Leaving directory '/tmp/ruby-build.20200519084931.6743.ptWQ7b/ruby-2.3.8'
uncommon.mk:203: recipe for target 'build-ext' failed
make: *** [build-ext] Error 2
解决方案
似乎问题不在于其他版本管理器,rbenv
而在于其他版本管理器,例如chruby
and asdf
。真正的问题是与 openssl 和 ruby 2.3.x 的兼容性问题。
Ruby 2.4 之前版本的 openssl 扩展与 OpenSSL 1.1.x 不兼容。目前,大多数带有 OpenSSL 1.1.0 的 Linux 发行版都有一个单独的 OpenSSL 1.0.x 包。
您需要安装较早版本的 OpenSSL 或使用 ruby 2.4.x。
sudo apt-get install autoconf bison build-essential libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm5 libgdbm-dev libdb-dev
sudo apt-get install libssl1.0-dev
这解决了我的问题。
笔记:
libgdbm5
适用于 Ubuntu19 或 Mint19 以及libgdbm6
更高版本。
请MacOS and Home brew
参阅https://github.com/rbenv/ruby-build/wiki#openssl-version-compatibility
推荐阅读
- azure - Linux 上的 Web 应用程序,无法更改虚拟路径
- javascript - JS:将新对象推送到嵌套数组对象中
- javascript - 正确嵌套三元运算符
- java - 仅在生产中签署 Maven 工件的最佳实践是什么?
- laravel - 我需要这个网站的 http 帖子
- powershell - 通过 Visual Studio 使用 CMake 运行 powershell 脚本而不更改系统范围的权限
- java - 当放置在另一个特定块的顶部时,有什么方法可以删除某个块?
- css - 如何使用 CSS 使复选框和单选按钮中的长标签适当地换行和缩进?
- numpy - 使用自定义数据集进行逻辑回归
- r - 模拟分位数回归中给定 tau = 0.5 和 X 值的响应变量 y