【发布时间】:2018-04-07 09:28:00
【问题描述】:
我最近决定查看一个运行 Ruby 1.9.2 的旧 Rails 应用程序,并决定尝试在我的 macOS 10.13 机器上安装 1.9.2。
我知道 gcc 不再随 macOS 一起提供,所以我想起了使用 Homebrew Core 的 apple-gcc42 配方的老技巧,遗憾的是,它的最高版本是 10.9 (Mavericks)。反正我是碰运气,甚至关注rbenv's gcc compatibility notes:
(请注意,Ruby
我尝试了以下命令(注意我已经安装了 rbenv 的 ruby-build 插件并且是最新的):
RUBY_CONFIGURE_OPTS="--with-opt-dir=/usr/local/opt/" CC=/usr/local/bin/gcc-4.2 rbenv install 1.9.2-p180
ruby-build: use libyaml from homebrew
Downloading ruby-1.9.2-p180.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p180.tar.bz2
Installing ruby-1.9.2-p180...
WARNING: ruby-1.9.2-p180 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.
ruby-build: use readline from homebrew
BUILD FAILED (OS X 10.13.3 using ruby-build 20180329)
Inspect or clean up the working tree at /var/folders/0t/hft4_1h13wqd91mwcw2j94h80000gn/T/ruby-build.20180407090310.93949
Results logged to /var/folders/0t/hft4_1h13wqd91mwcw2j94h80000gn/T/ruby-build.20180407090310.93949.log
Last 10 log lines:
/var/folders/0t/hft4_1h13wqd91mwcw2j94h80000gn/T/ruby-build.20180407090310.93949 /usr/local/bin
/var/folders/0t/hft4_1h13wqd91mwcw2j94h80000gn/T/ruby-build.20180407090310.93949/ruby-1.9.2-p180 /var/folders/0t/hft4_1h13wqd91mwcw2j94h80000gn/T/ruby-build.20180407090310.93949 /usr/local/bin
configure: WARNING: unrecognized options: --with-openssl-dir, --with-libyaml-dir, --with-readline-dir
checking build system type... i386-apple-darwin17.4.0
checking host system type... i386-apple-darwin17.4.0
checking target system type... i386-apple-darwin17.4.0
checking whether the C compiler works... no
configure: error: in `/var/folders/0t/hft4_1h13wqd91mwcw2j94h80000gn/T/ruby-build.20180407090310.93949/ruby-1.9.2-p180':
configure: error: C compiler cannot create executables
See `config.log' for more details
config.log 上的错误与上面的输出相同:
configure:3446: 错误:C 编译器无法创建可执行文件
我试图用 C 代码编译一个基本文件,但 gcc-4.2 没有这样做(与 /usr/local/bin/gcc 不同),我告诉我 gcc-4.2 现在根本无法在 macOS 10.13 上运行。也许前进的唯一方法是找到一种方法来用现代 gcc 版本编译旧的 Ruby,但我猜这可能需要对 configure 文件进行大量手动更改以使其兼容。
我只是好奇是否有人在这项努力中取得了成功,或者这是一个失败的事业。
【问题讨论】:
-
我还没有尝试过,但是我的 1.9 甚至 1.8 构建了几个版本似乎可以工作。我很乐意向您发送任何二进制文件。
标签: ruby macos gcc rbenv macos-high-sierra