提问人:CombustibleToast 提问时间:3/22/2023 更新时间:3/22/2023 访问量:707
无法安装 Ruby 3.0.2 在 Ubuntu 上 22.10
Unable to Install Ruby 3.0.2 on Ubuntu 22.10
问:
我尝试同时使用 Ruby 版本管理器 (RVM) 和 RBENV 来安装 3.0.2,但两次都出现某种 Make 错误,但无法对日志文件进行正面或反面处理。 以下是使用 RVM 进行安装的控制台日志
~$ rvm install 3.0.2
ruby-3.0.2 - #removing src/ruby-3.0.2..
Searching for binary rubies, this might take some time.
No binary rubies available for: ubuntu/22.10/x86_64/ruby-3.0.2.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for ubuntu.
Requirements installation successful.
Installing Ruby from source to: /usr/share/rvm/rubies/ruby-3.0.2, this may take a while depending on your cpu(s)...
ruby-3.0.2 - #downloading ruby-3.0.2, this may take a while depending on your connection...
ruby-3.0.2 - #extracting ruby-3.0.2 to /usr/share/rvm/src/ruby-3.0.2.....
ruby-3.0.2 - #configuring......................................................|
ruby-3.0.2 - #post-configuration..
ruby-3.0.2 - #compiling........................................................|
Error running '__rvm_make -j20',
please read /usr/share/rvm/log/1679415049_ruby-3.0.2/make.log
There has been an error while running make. Halting the installation.
这是上述错误 https://pastebin.com/TdqPS8gm 中的日志文件
这是通过 RBENV 安装时的控制台
~$ rbenv install 3.0.2
Downloading ruby-3.0.2.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.2.tar.gz
Installing ruby-3.0.2...
BUILD FAILED (Ubuntu 22.10 using ruby-build 20220426)
Inspect or clean up the working tree at /tmp/ruby-build.20230321125011.119650.C0ZjOk
Results logged to /tmp/ruby-build.20230321125011.119650.log
Last 10 log lines:
linking shared-object json/ext/generator.so
linking shared-object zlib.so
make[2]: Leaving directory '/tmp/ruby-build.20230321125011.119650.C0ZjOk/ruby-3.0.2/ext/json/generator'
make[2]: Leaving directory '/tmp/ruby-build.20230321125011.119650.C0ZjOk/ruby-3.0.2/ext/zlib'
linking shared-object date_core.so
make[2]: Leaving directory '/tmp/ruby-build.20230321125011.119650.C0ZjOk/ruby-3.0.2/ext/date'
linking shared-object ripper.so
make[2]: Leaving directory '/tmp/ruby-build.20230321125011.119650.C0ZjOk/ruby-3.0.2/ext/ripper'
make[1]: Leaving directory '/tmp/ruby-build.20230321125011.119650.C0ZjOk/ruby-3.0.2'
make: *** [uncommon.mk:300: build-ext] Error 2
这是上述错误 https://pastebin.com/dPe6HhtW 中的日志文件
答:
2赞
Hwiparam
3/22/2023
#1
您可能正在遵循这方面的教程。 教程是否告诉您使用 Rbenv?还是 RVM?
您可能已经尝试过,但如果您还没有尝试过,我会这样做:
sudo apt install ruby-full
ruby --version
现在,如果您真的想使用 RVM 或 Rbenv,您可能需要查看它们的安装。另外,您可以尝试运行以下命令:
sudo apt install build-essential
如果仍然不起作用,请尝试上面提到的答案。 希望我能帮上忙!
评论
0赞
CombustibleToast
3/22/2023
感谢您的建议,但请安装 3.0.4 版,而我需要 3.0.2 版。运行说一切都是最新的,运行 Rbenv 和 RVM 仍然有相同的错误。sudo apt install ruby
ruby-full
sudo apt install build-essential
0赞
Hwiparam
3/23/2023
哦,当然!运行以下命令: 我使用以下命令找到了 ruby3.0 包的所有版本: 换句话说,要检查软件包的特定版本并安装该软件包,请执行以下操作: 希望这有帮助!祝你有美好的一天。sudo apt-get install ruby3.0=3.0.2-7ubuntu2
apt-cache policy ruby3.0
apt-cache policy [package-name] && sudo apt-get install [package-name]=[version]
0赞
Mike Szyndel
3/24/2023
虽然为 apt 指定 Ruby 版本是一种解决方案,但我认为问题出在 openssl 上。请参阅此处 github.com/rbenv/ruby-build/discussions/1940
评论