我在 Arm Mac(M1 芯片)上使用 rbenv
安装
Ruby 2.6.6时遇到一些问题,该设备适用于我的队友,他拥有英特尔处理器。我已经尝试过这些解决方案(1、2和3)但无济于事。
错误日志:
To follow progress, use 'tail -f /var/folders/rb/hwbl5pxd5zs4gzzx5pdljhjw0000gq/T/ruby-build.20221014163104.57025.log' or pass --verbose
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.6 using ruby-build 20221004)
Inspect or clean up the working tree at /var/folders/rb/hwbl5pxd5zs4gzzx5pdljhjw0000gq/T/ruby-build.20221014163104.57025.x3LvP2
Results logged to /var/folders/rb/hwbl5pxd5zs4gzzx5pdljhjw0000gq/T/ruby-build.20221014163104.57025.log
Last 10 log lines:
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
transdb.h updated
ln -sf ../../../.ext/include/-darwin21/rb_mjit_min_header-2.6.6.h include/ruby-2.6.0/-darwin21/rb_mjit_min_header-2.6.6.h
根据我的研究,它似乎与 OpenSSL 有关。不过,我认为我有正确的版本。 跑步时
brew list
我得到:
==> Formulae
autoconf c-ares icu4c libevent libnghttp2 lz4 mysql [email protected] [email protected] ruby six zlib
awscli ca-certificates jq libffi libuv m4 node pkg-config rbenv ruby-build sqlite zstd
brotli gdbm libcbor libfido2 libyaml mpdecimal oniguruma protobuf readline saml2aws xz
==> Casks
google-cloud-sdk
跑步时
brew info openssl
我得到:
==> openssl@3: stable 3.0.5 (bottled) [keg-only]
Cryptography and SSL/TLS Toolkit
https://openssl.org/
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/[email protected]
License: Apache-2.0
==> Dependencies
Required: ca-certificates ✔
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
/opt/homebrew/etc/openssl@3/certs
and run
/opt/homebrew/opt/openssl@3/bin/c_rehash
openssl@3 is keg-only, which means it was not symlinked into /opt/homebrew,
because macOS provides LibreSSL.
==> Analytics
install: 159,362 (30 days), 444,743 (90 days), 1,589,438 (365 days)
install-on-request: 99,536 (30 days), 319,581 (90 days), 1,219,775 (365 days)
build-error: 4,303 (30 days)
你能证实我的假设是正确的吗?
对于这些问题的任何帮助,我将不胜感激。谢谢!
从
2.6.6
移动到2.7.6
似乎已经奏效了!所以 rbenv install 2.7.6
就是它的归结。无论如何,2.6.6
似乎存在一些安全问题,所以最好更新一下。
就我而言,我的 shell 使用 x86_64 而不是 ARM 架构。所以我就这么做了
arch -arm64 rbenv install 2.7.6
它之所以适用于使用 Intel 处理器的同行,是因为在 Ruby 2.6 发布时,Intel 处理器已经存在,而 M1 还没有。不要尝试在 M1 机器上安装低于 2.7 的 ruby 版本;人们提倡的解决方法并不能很好地利用时间,因为即使您可以在没有安装错误的情况下完成安装序列,您非常旧的项目也可能有一些非常旧的 gem 依赖项,它们也不支持您的处理器架构.
您应该在项目中升级 ruby 版本(至少因为我很确定在提出这个问题时 2.6 已经结束)和/或投入时间来对应用程序进行 docker 化。