【发布时间】:2021-09-12 12:01:10
【问题描述】:
当我尝试使用 rbenv 在我的 Mac 上安装 ruby2.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
我认为 gcc 没有正确编译,所以我尝试使用自制软件重新安装它,但没有成功。
我无法找到解决此问题的方法。如果有人能告诉我该怎么做,我将不胜感激。
【问题讨论】: