【问题标题】:Problem when installing Ruby 2.2.9 on Mac Big Sur M1在 Mac Big Sur M1 上安装 Ruby 2.2.9 时出现问题
【发布时间】:2020-12-16 14:25:00
【问题描述】:

我尝试在 Big Sur - M1 芯片组上安装 Ruby 2.2.9。

我尝试使用 RVM、ASDF...但在编译过程中总是出现此错误:

encoding.c:825:2: error: implicit declaration of function 'rb_str_change_terminator_length' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    rb_str_change_terminator_length(obj, oldtermlen, termlen);

【问题讨论】:

标签: ruby macos macos-big-sur


【解决方案1】:

答案将是通过尝试旧版本的命令行工具来反复试验,因为它是 BigSur 我现在不支持最旧版本,否则您可以降级到 Catalina 并使用命令行工具 11.4.1。问题是旧的 ruby​​ 版本无法编译,因为一些与当时使用的编译器有关的 clang 错误(确实在帖子中回答了这个问题)。 最后一个非常重要的提示是使用 RBENV,如果 M1 mac 支持它的话。 I answered a similar question but with Catalina. If it helps.

您也可以尝试设置此标志以忽略错误(在安装过程之前):

export optflags="-Wno-error=implicit-function-declaration"

一位同事发现了此修复程序(他正在运行带有 Big Sur 的 16 英寸 macbook)

【讨论】:

  • 谢谢,您的回答对我有用:export optflags="-Wno-error=implicit-function-declaration" | rvm 安装 2.5.8
  • 如果你使用的是 rbenv,这个命令应该可以工作CFLAGS="-Wno-error=implicit-function-declaration" rbenv install 2.2.9。来源:bountysource.com/issues/…
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-06-29
  • 1970-01-01
  • 2022-07-02
  • 1970-01-01
  • 2021-07-29
  • 2023-02-18
  • 1970-01-01
相关资源
最近更新 更多