簡體   English   中英

如何使用 rbenv 在 Ubuntu 21.1 上安裝 Ruby 2.3.0?

[英]How do I install Ruby 2.3.0 on Ubuntu 21.1 using rbenv?

我正在開發一個使用 Ruby 2.3.0(帶有 Rails)編寫的應用程序,我的操作系統是 Linux Ubuntu 21.1。 (希望升級項目的 Ruby 版本,但也遇到了麻煩)

為了讓應用程序正常工作,我的第一個想法是使用 rbenv 安裝 2.3.0,但經過多次故障排除后,我繼續收到以下錯誤:

~$ rbenv install 2.3.0
-> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.0.tar.bz2
Installing ruby-2.3.0...

WARNING: ruby-2.3.0 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.


BUILD FAILED (Ubuntu 21.10 using ruby-build 20211203)

Inspect or clean up the working tree at /tmp/ruby-build.20211214112011.528089.XXe70o
Results logged to /tmp/ruby-build.20211214112011.528089.log

Last 10 log lines:
linking shared-object nkf.so
make[2]: Leaving directory '/tmp/ruby-build.20211214112011.528089.XXe70o/ruby-2.3.0/ext/nkf'
linking shared-object bigdecimal.so
make[2]: Leaving directory '/tmp/ruby-build.20211214112011.528089.XXe70o/ruby-2.3.0/ext/bigdecimal'
linking shared-object date_core.so
make[2]: Leaving directory '/tmp/ruby-build.20211214112011.528089.XXe70o/ruby-2.3.0/ext/date'
linking shared-object ripper.so
make[2]: Leaving directory '/tmp/ruby-build.20211214112011.528089.XXe70o/ruby-2.3.0/ext/ripper'
make[1]: Leaving directory '/tmp/ruby-build.20211214112011.528089.XXe70o/ruby-2.3.0'

錯誤日志文件:

錯誤日志文件

我嘗試使用以下方法安裝 openssl 1.0:

 ~$ brew install rbenv/tap/openssl@1.0

 x86_64cpuid.s: Assembler messages: x86_64cpuid.s:2: Error: unknown
 pseudo-op: `.private_extern' x86_64cpuid.s:3: Error: unknown
 pseudo-op: `.mod_init_func' x86_64cpuid.s:7: Error: unknown pseudo-op:
 `.private_extern' make[1]: *** [<builtin>: x86_64cpuid.o] Error 1
 make[1]: Leaving directory
 '/tmp/opensslA1.0-20211213-493929-qg8eui/openssl-1.0.2t/crypto' make:
 *** [Makefile:287: build_crypto] Error 1
   
 If reporting this issue please do so at (not Homebrew/brew or
 Homebrew/core):   https://github.com/rbenv/homebrew-tap/issues 
 These open issues may also help: `brew install rbenv/tap/openssl@1.0` not working anymore https://github.com/rbenv/homebrew-tap/issues/1

我按照錯誤消息中的鏈接,並嘗試了那里的建議:

~$ brew tap rbenv/tap

~$ brew install rbenv/tap/openssl@1.0

x86_64cpuid.s: Assembler messages:
x86_64cpuid.s:2: Error: unknown pseudo-op: `.private_extern'
x86_64cpuid.s:3: Error: unknown pseudo-op: `.mod_init_func'
x86_64cpuid.s:7: Error: unknown pseudo-op: `.private_extern'
make[1]: *** [<builtin>: x86_64cpuid.o] Error 1
make[1]: Leaving directory '/tmp/opensslA1.0-20211213-498635-w2ky1d/openssl-1.0.2t/crypto'
make: *** [Makefile:287: build_crypto] Error 1

If reporting this issue please do so at (not Homebrew/brew or Homebrew/core):
  https://github.com/rbenv/homebrew-tap/issues

These open issues may also help:
`brew install rbenv/tap/openssl@1.0` not working anymore https://github.com/rbenv/homebrew-tap/issues/1

我還嘗試升級應用程序的 ruby 版本,並繼續遇到錯誤 - 例如過時的依賴項。 我是 ruby 和 rails 的新手,我還在學習!

這是我的第一篇文章,如果它不是很好或者我錯過了一些細節,請道歉。 我很樂意提供所需的任何進一步信息。

非常感謝你的幫助。

感謝@Casper 的幫助,我解決了這個問題。

對於 Ubuntu 的最新版本,由於 OpenSSL 依賴項不匹配,rbenv 無法在 2.4 以下安裝 Ruby。

使用安裝在另一台計算機上的 Ubuntu 16.04 版本為我解決了這個問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM