通过RVM安装Ruby时运行configure时出错,C编译器无法创建可执行文件。

时间:2019-04-03 23:12:31

标签: ruby macos rvm

无论出于什么原因,我只是让我的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
  • 已使用CL工具(版本9.3 -9E145-)完全安装了Xcode
  • 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.1 Apple LLVM版本9.1.0(clang-902.0.39.1) 目标:x86_64-apple-darwin18.5.0 螺纹型号:posix InstalledDir:/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 InstalledDir:/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 env输出

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

1 个答案:

答案 0 :(得分:1)

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

相关问题