gpt4 book ai didi

ruby - 通过 RVM `C compiler cannot create executables` 安装 Ruby 时运行配置时出错

转载 作者:行者123 更新时间:2023-12-04 01:45:15 26 4
gpt4 key购买 nike

无论出于何种原因,我刚刚破坏了我的 RVM(它工作得很好)并尝试再次安装它。当 RVM 正在测试编译器时,我遇到了阻止安装的错误。如果能帮我调试这个,我将不胜感激。

运行后出现问题:

$ rvm install 2.6.2

任何其他版本的 Ruby。

我得到以下输出

Error running './configure --prefix=/Users/andres/.rvm/rubies/ruby-

2.6.2 --with-opt-dir=/usr/local/opt/libyaml:/usr/local/opt/readline:/usr/local/opt/libksba:/usr/local/opt/openssl@1.1 --disable-install-doc --enable-shared',
please read /Users/andres/.rvm/log/1554329766_ruby-2.6.2/configure.log
There has been an error while running configure. Halting the installation.

并且 configure.log 显示

[2019-04-04 09:07:04] ./configure
current path: /Users/andres/.rvm/src/ruby-2.6.0
PATH=/usr/local/opt/coreutils/bin:/usr/local/opt/pkg-config/bin:/usr/local/opt/libtool/bin:/usr/local/opt/automake/bin:/usr/local/opt/autoconf/bin:/usr/local/opt/node@8/bin:/usr/local/opt/node@8/bin:/opt/local/bin:/opt/local/sbin:/Users/andres/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/opt/node@8/bin:/opt/local/bin:/opt/local/sbin:/Users/andres/bin:/Users/andres/.rvm/bin
command(5): ./configure --prefix=/Users/andres/.rvm/rubies/ruby-2.6.0 --with-opt-dir=/usr/local/opt/libyaml:/usr/local/opt/readline:/usr/local/opt/libksba:/usr/local/opt/openssl@1.1 --disable-install-doc --enable-shared
checking for ruby... /usr/bin/ruby
tool/config.guess already exists
tool/config.sub already exists
checking build system type... x86_64-apple-darwin18.5.0
checking host system type... x86_64-apple-darwin18.5.0
checking target system type... x86_64-apple-darwin18.5.0
checking whether the C compiler works... no
configure: error: in `/Users/andres/.rvm/src/ruby-2.6.0':
configure: error: C compiler cannot create executables
See `config.log' for more details

相关的 config.log 行

## ----------- ##
## Core tests. ##
## ----------- ##

configure:2996: checking for ruby
configure:3014: found /usr/bin/ruby
configure:3027: result: /usr/bin/ruby
configure:3105: checking build system type
configure:3119: result: x86_64-apple-darwin18.5.0
configure:3207: checking host system type
configure:3220: result: x86_64-apple-darwin18.5.0
configure:3240: checking target system type
configure:3253: result: x86_64-apple-darwin18.5.0
configure:3905: checking for C compiler version
configure:3914: gcc --version >&5
Apple LLVM version 9.1.0 (clang-902.0.39.1)
Target: x86_64-apple-darwin18.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
configure:3925: $? = 0
configure:3914: gcc -v >&5
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 9.1.0 (clang-902.0.39.1)
Target: x86_64-apple-darwin18.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
configure:3925: $? = 0
configure:3914: gcc -V >&5
clang: error: argument to '-V' is missing (expected 1 value)
clang: error: no input files
configure:3925: $? = 1
configure:3914: gcc -qversion >&5
clang: error: unknown argument: '-qversion'
clang: error: no input files
configure:3925: $? = 1
configure:3945: checking whether the C compiler works
configure:3967: gcc conftest.c >&5
ld: malformed file
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd:4:18: error: unknown enumerated scalar
platform: zippered
^~~~~~~~
file '/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure:3971: $? = 1
configure:4009: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:4014: error: in `/Users/andres/.rvm/src/ruby-2.6.0':
configure:4016: error: C compiler cannot create executables
See `config.log' for more details

环境:

  • MacOS Mojave
  • Xcode 完全安装了 CL 工具(版本 9.3 -9E145-)
  • rvm 1.29.7(最新)
  • gcc -v 输出:

    配置为:--prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1Apple LLVM 版本 9.1.0 (clang-902.0.39.1)目标:x86_64-apple-darwin18.5.0线程模型:posix安装目录:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

  • clang --version 输出:

    Apple LLVM 版本 9.1.0 (clang-902.0.39.1)目标:x86_64-apple-darwin18.5.0线程模型:posix安装目录:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

    • xcode-select -p 输出:/Applications/Xcode.app/Contents/Developer

我已经尝试 (1) 一次又一次地重新安装 RVM。 (2) 运行 rvm get stable --autolibs=enable --auto-dotfiles 来修复 bash 等的任何问题。 (3) 确保 Xcode 已更新。 (4) 运行 rvm install 2.6.2 --with-gcc=clang (如某些 SO 答案中所建议)。

所有这些都没有成功。我很感激你的帮助。

--- 附加信息 ---

gem 环境 输出

RubyGems Environment:
- RUBYGEMS VERSION: 2.5.2.3
- RUBY VERSION: 2.3.7 (2018-03-28 patchlevel 456) [universal.x86_64-darwin18]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.3.0
- USER INSTALLATION DIRECTORY: /Users/andres/.gem/ruby/2.3.0
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/bin
- SPEC CACHE DIRECTORY: /Users/andres/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-18
- GEM PATHS:
- /Library/Ruby/Gems/2.3.0
- /Users/andres/.gem/ruby/2.3.0
- /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/gems/2.3.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-document"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/opt/node@8/bin
- /usr/local/opt/node@8/bin
- /opt/local/bin
- /opt/local/sbin
- /Users/andres/bin
- /usr/local/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /usr/local/opt/node@8/bin
- /opt/local/bin
- /opt/local/sbin
- /Users/andres/bin
- /Users/andres/.rvm/bin
- /Users/andres/.rvm/bin
- /Users/andres/.rvm/bin

最佳答案

我认为您的 xcode 版本已过时。升级到 10.2 应该可以解决这个问题。

关于ruby - 通过 RVM `C compiler cannot create executables` 安装 Ruby 时运行配置时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55505603/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com