无法在Mojave上安装任何版本的ruby-内部ranlib命令失败 [英] Cannot install any version of ruby on Mojave - internal ranlib command failed

查看:212
本文介绍了无法在Mojave上安装任何版本的ruby-内部ranlib命令失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道与此有关的一些silimar问题,但找不到与我的问题相符的问题.

I know there are a few silimar issues to this one, but I cannot find one that matches my issue.

我无法使用rvm或rbenv安装任何版本的ruby.两者都导致相同的错误.例如,以下是安装ruby 2.5.3时的日志摘录:

I cannot install any version of ruby with either rvm nor rbenv. Both result in the same error. For example, here's an extract for the logs when installing ruby 2.5.3:

compiling loadpath.c
making srcs under enc
linking static-library libruby.2.5.3-static.a
make[1]: Nothing to be done for `srcs'.
generating transdb.h
/opt/local/bin/ranlib: object: libruby.2.5.3-static.a(dln.o) malformed object (unknown load command 1)
ar: internal ranlib command failed
make: *** [libruby.2.5.3-static.a] Error 1
make: *** Waiting for unfinished jobs....
transdb.h updated

问题似乎在这里:

/opt/local/bin/ranlib: object: libruby.2.5.3-static.a(dln.o) malformed object (unknown load command 1)
ar: internal ranlib command failed
make: *** [libruby.2.5.3-static.a] Error 1

我尝试过的

  • 安装,重新安装,卸载rvm,rbenv.
  • 更新,重新安装XCode.
  • 删除,安装XCode命令行工具.
  • What I've tried

    • Installing, reinstalling, uninstalling rvm, rbenv.
    • Updating, reinstalling XCode.
    • Deleting, installing, XCode command line tools.
    • 是什么原因造成的?

      gcc --version返回:

      gcc --version
      Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
      Apple LLVM version 10.0.0 (clang-1000.10.44.4)
      Target: x86_64-apple-darwin18.0.0
      Thread model: posix
      InstalledDir: /Library/Developer/CommandLineTools/usr/bin
      

      推荐答案

      所以,我认为对此修复程序正在运行:

      So, I think the fix to this was running:

      $ sudo xcodebuild -runFirstLaunch

      为什么?我不知道.我的怀疑是我试图在更新XCode之前构建ruby.但是,一旦我更新了XCode,我怀疑还是以某种方式引用了错误/较旧的命令行工具.

      Why? I'm not sure. My suspicion is I tried to build ruby before updating XCode. But once I had updated XCode I suspect the wrong/older command line tool was still being referenced somehow.

      我不知道到底是什么解决了这个问题,但是我完全删除了XCode,而ruby仍然没有安装.

      I don't know exactly what fixed this but I completely deleted XCode and ruby still didn't install.

      然后我完全删除了命令行工具,而ruby仍然没有安装.

      Then I completely deleted command line tools and ruby still didn't install.

      然后,我只重新安装了没有XCode的命令行工具,而ruby仍然没有安装.

      Then I reinstalled just the command line tools without XCode and ruby still didn't install.

      然后我运行此runFirstLaunch命令并安装ruby.

      Then I ran this runFirstLaunch command and ruby installed.

      这篇关于无法在Mojave上安装任何版本的ruby-内部ranlib命令失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆