无法在Ubuntu上使用asdf安装Ruby。

huangapple go评论49阅读模式
英文:

Cannot install ruby with asdf on ubuntu

问题

我在Kubuntu 22.04上使用asdf安装ruby时遇到了错误。
当我运行这段代码时
`asdf install ruby 2.6.4`
终端显示如下并永远停止:

下载ruby-build...
要跟踪进度,请使用'tail -f /tmp/ruby-build.20230227154534.54979.log'或传递--verbose
下载openssl-1.1.1t.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/8dee9b24bdb1dcbf0c3d1e9b02fb8f6bf22165e807f45adeb7c9677536859d3b
安装openssl-1.1.1t...
已安装openssl-1.1.1t到/home/lelouvincx/.asdf/installs/ruby/2.6.4

下载ruby-2.6.4.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.4.tar.bz2
错误:无法下载ruby-2.6.4.tar.bz2

构建失败(在Ubuntu 22.04上使用ruby-build 20230222)

检查或清理工作树/tmp/ruby-build.20230227154534.54979.cbqQx3
结果记录到/tmp/ruby-build.20230227154534.54979.log

最后10行日志:
下载结果:
gid |stat|avg speed |path/URI
======+====+===========+=======================================================
de0a40|ERR | 0B/s|/tmp/ruby-build.20230227154534.54979.cbqQx3/ruby-2.6.4.tar.bz2

状态图例:
(ERR):发生错误。

如果重新启动传输,aria2将恢复下载。
如果有任何错误,请查看日志文件。有关详细信息,请参见帮助/手册页中的'-l'选项。


请帮忙!

我尝试了一些不同的openssl标签,如`ASDF_RUBY_BUILD_VERSION=master asdf install ruby 2.6.4`或`RUBY_CONFIGURE_OPTS=--with-openssl-dir=/opt/openssl-1.1.1n asdf install ruby 2.6.4`,但也不起作用。
英文:

I encountered an error when installing ruby on my Kubuntu 22.04 using asdf.
When I ran this code
asdf install ruby 2.6.4
The terminal show this and stopped forever:

Downloading ruby-build...
To follow progress, use 'tail -f /tmp/ruby-build.20230227154534.54979.log' or pass --verbose
Downloading openssl-1.1.1t.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/8dee9b24bdb1dcbf0c3d1e9b02fb8f6bf22165e807f45adeb7c9677536859d3b
Installing openssl-1.1.1t...
Installed openssl-1.1.1t to /home/lelouvincx/.asdf/installs/ruby/2.6.4

Downloading ruby-2.6.4.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.4.tar.bz2
error: failed to download ruby-2.6.4.tar.bz2

BUILD FAILED (Ubuntu 22.04 using ruby-build 20230222)

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

Last 10 log lines:
Download Results:
gid   |stat|avg speed  |path/URI
======+====+===========+=======================================================
de0a40|ERR |       0B/s|/tmp/ruby-build.20230227154534.54979.cbqQx3/ruby-2.6.4.tar.bz2

Status Legend:
(ERR):error occurred.

aria2 will resume download if the transfer is restarted.
If there are any errors, then see the log file. See '-l' option in help/man page for details.

Please help!

I tried some different tag with openssl like ASDF_RUBY_BUILD_VERSION=master asdf install ruby 2.6.4 or RUBY_CONFIGURE_OPTS=--with-openssl-dir=/opt/openssl-1.1.1n asdf install ruby 2.6.4 but not working too.

答案1

得分: 0

请注意这些部分:

下载 ruby-2.6.4.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.4.tar.bz2
错误:无法下载 ruby-2.6.4.tar.bz2

...

下载结果:
gid   |stat|avg speed  |path/URI
======+====+===========+=======================================================
de0a40|ERR |       0B/s|/tmp/ruby-build.20230227154534.54979.cbqQx3/ruby-2.6.4.tar.bz2

...

如果传输重新启动,aria2 将恢复下载。

问题不是 Ruby 不能编译,所以你添加的标志没有改变任何东西。问题是根本无法下载 Ruby。

你需要确保:

  1. 远程主机 cache.ruby-lang.org 是在线的。
  2. 你的计算机可以访问远程主机 cache.ruby-lang.org。

你可以尝试使用 curl 直接下载文件:

curl -O https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.4.tar.bz2

你应该会看到如下输出:

  % 总量    % 已下载 % Xferd  平均速度   时间    时间     时间  当前
                                 Dload  Upload   总计   花费    剩余 速度
100 13.7M  100 13.7M    0     0   9.9M      0  0:00:01  0:00:01 --:--:--  9.9M

然后你应该会得到文件 ruby-2.6.4.tar.bz2。如果没有,那么问题要么是 1 或者是 2 上面提到的问题,你需要确保你没有阻止到 cache.ruby-lang.org 的连接。

英文:

Pay attention to these parts:

Downloading ruby-2.6.4.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.4.tar.bz2
error: failed to download ruby-2.6.4.tar.bz2

...

Download Results:
gid   |stat|avg speed  |path/URI
======+====+===========+=======================================================
de0a40|ERR |       0B/s|/tmp/ruby-build.20230227154534.54979.cbqQx3/ruby-2.6.4.tar.bz2

...

aria2 will resume download if the transfer is restarted.

The problem is not that Ruby will not compile and that's why the flags you added did not change anything. The problem is that Ruby can't be downloaded at all.

You need to ensure that:

  1. The remote host cache.ruby-lang.org is online
  2. The remote host cache.ruby-lang.org is reachable from your computer

You can try downloading the file directly with curl:

curl -O https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.4.tar.bz2

You should see output like this:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 13.7M  100 13.7M    0     0   9.9M      0  0:00:01  0:00:01 --:--:--  9.9M

And you should have the file ruby-2.6.4.tar.bz2 downloaded as a result. If not then the problem is either 1 or 2 above, and you need to ensure that you are not blocking connections to cache.ruby-lang.org.

答案2

得分: 0

Update! I figured it out by this command: CFLAGS="-Wno-error=implicit-function-declaration" asdf install ruby 3.2.0.

If there's any error, try pre-install these libs: sudo apt install libyaml-dev libssl-dev.

英文:

Update! I figured it out by this command: CFLAGS="-Wno-error=implicit-function-declaration" asdf install ruby 3.2.0.

If there's any error, try pre-install these libs: sudo apt install libyaml-dev libssl-dev.

huangapple
  • 本文由 发表于 2023年2月27日 16:55:50
  • 转载请务必保留本文链接:https://go.coder-hub.com/75578416.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定