【问题标题】:M1Mac : rbenv install 2.6.6 Build FailedM1Mac:rbenv 安装 2.6.6 构建失败
【发布时间】:2021-09-12 12:01:10
【问题描述】:

当我尝试使用 rbenv 在我的 Mac 上安装 ruby​​2.6.6 时,我收到了“Builed Failed”消息。

一开始我是这样运行的

% rbenv install 2.6.6 

Downloading ruby-2.6.6.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.6.tar.bz2
Installing ruby-2.6.6...
ruby-build: using readline from homebrew

BUILD FAILED (macOS 12.0 using ruby-build 20210825)

Inspect or clean up the working tree at /var/folders/zs/rjdwp8ws5_s4gjd40lj1q2gr0000gn/T/ruby-build.20210912210429.75083.Uqwy5z
Results logged to /var/folders/zs/rjdwp8ws5_s4gjd40lj1q2gr0000gn/T/ruby-build.20210912210429.75083.log

Last 10 log lines:
checking build system type... x86_64-apple-darwin13.4.0
checking host system type... x86_64-apple-darwin13.4.0
checking target system type... x86_64-apple-darwin13.4.0
checking for x86_64-apple-darwin13.4.0-clang... (cached) x86_64-apple-darwin13.4.0-clang
checking for x86_64-apple-darwin13.4.0-gcc... (cached) x86_64-apple-darwin13.4.0-clang
checking whether the C compiler works... no
configure: error: in `/var/folders/zs/rjdwp8ws5_s4gjd40lj1q2gr0000gn/T/ruby-build.20210912210429.75083.Uqwy5z/ruby-2.6.6':
configure: error: C compiler cannot create executables
See `config.log' for more details
make: *** No targets specified and no makefile found.  Stop.

正如您在输出中看到的,“正在检查 C 编译器是否工作......不”,我认为编译器工作不正常并寻找解决方案。

有一个解决方案可以通过指定 GCC 路径来运行它,我用它作为参考来运行它,如下所示。

CC=/usr/bin/gcc rbenv install 2.6.6

但是,结果是“构建失败”。

gcc的版本如下

%gcc --version 

Configured with: --prefix=/Applications/Xcode-beta.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 13.0.0 (clang-1300.0.29.3)
Target: x86_64-apple-darwin21.1.0
Thread model: posix
InstalledDir: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

指定gcc路径时的输出和日志如下。

% CC=/usr/bin/gcc rbenv install 2.6.6

CC=/usr/bin/gcc rbenv install 2.6.6
Downloading ruby-2.6.6.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.6.tar.bz2
Installing ruby-2.6.6...
ruby-build: using readline from homebrew

BUILD FAILED (macOS 12.0 using ruby-build 20210825)

Inspect or clean up the working tree at /var/folders/zs/rjdwp8ws5_s4gjd40lj1q2gr0000gn/T/ruby-build.20210912211846.75422.XoStEO
Results logged to /var/folders/zs/rjdwp8ws5_s4gjd40lj1q2gr0000gn/T/ruby-build.20210912211846.75422.log

Last 10 log lines:
transform_mjit_header: SKIPPED to transform __inline_isinff
transform_mjit_header: SKIPPED to transform __inline_isfinitel
transform_mjit_header: SKIPPED to transform __inline_isfinited
transform_mjit_header: SKIPPED to transform __inline_isfinitef
transform_mjit_header: SKIPPED to transform __darwin_fd_clr
transform_mjit_header: SKIPPED to transform __darwin_fd_set
transform_mjit_header: SKIPPED to transform __darwin_fd_isset
transform_mjit_header: SKIPPED to transform __darwin_check_fd_set
transform_mjit_header: SKIPPED to transform __sputc
ln -sf ../../../.ext/include/x86_64-darwin13/rb_mjit_min_header-2.6.6.h include/ruby-2.6.0/x86_64-darwin13/rb_mjit_min_header-2.6.6.h

log file link here

我认为 gcc 没有正确编译,所以我尝试使用自制软件重新安装它,但没有成功。

我无法找到解决此问题的方法。如果有人能告诉我该怎么做,我将不胜感激。

【问题讨论】:

    标签: ruby macos rbenv apple-m1


    【解决方案1】:

    Apple Silicon 不支持 YARV 2.6。

    正如您在the issue which is used to track which branches of YARV the fixes for Apple Silicon need to be back ported to 中看到的,2.6 被标记为“REQUIRED”,这意味着它需要一个后端端口才能工作,但这个后端端口尚未完成。 (与标记为“DONE”的 2.7 相比。)

    向后移植:2.5:未知,2.6:需要,2.7:完成

    考虑到the back port to 2.7 happened a year ago,我们可以假设维护者不打算将其应用于 2.6。这是有道理的:YARV 2.6 is in "security maintenance" status,这意味着只完成了安全修复,这不是安全问题。

    【讨论】:

    • 感谢您的快速回答!我懂了。那么这是否意味着支持2.7并且可以安装?
    【解决方案2】:
    【解决方案3】:

    我已经成功安装了 2.6.3 和以下

    CFLAGS="-Wno-error=implicit-function-declaration -Wcompound-token-split-by-macro" rbenv install 2.6.3
    

    来源:https://github.com/rbenv/ruby-build/issues/1725#issuecomment-927446555

    【讨论】:

      猜你喜欢
      • 2019-10-16
      • 1970-01-01
      • 2017-04-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-16
      • 2017-07-03
      相关资源
      最近更新 更多