标准 OS X 发行版、RVM 和 MacPorts 中的 Ruby 有什么不同?

发布于 2024-09-11 04:29:12 字数 3188 浏览 3 评论 0原文

我向超级用户提出了有关在 Google SketchUp 中更新 Ruby 版本的问题。标准 OS X 发行版附带的 Ruby 与 RVM 或 MacPorts 安装的 Ruby 似乎有些不同。当我尝试使用 RVM 或 MacPorts 的 Ruby 1.9.1

Exception Type:  EXC_BREAKPOINT (SIGTRAP)

Dyld Error Message:
  Library not loaded: @executable_path/../Frameworks/Ruby.framework/Versions/A/Ruby
  Referenced from: /Applications/Google SketchUp 7/SketchUp.app/Contents/MacOS/SketchUp
  Reason: no suitable image found.  Did find:
    /Applications/Google SketchUp 7/SketchUp.app/Contents/MacOS/../Frameworks/Ruby.framework/Versions/A/Ruby: mach-o, but wrong architecture
    /Applications/Google SketchUp 7/SketchUp.app/Contents/MacOS/../Frameworks/Ruby.framework/Versions/A/Ruby: mach-o, but wrong architecture
    /usr/lib/Ruby: not a file

Model: MacBookPro7,1, BootROM MBP71.0039.B05, 2 processors, Intel Core 2 Duo, 2.4 GHz, 4 GB, SMC 1.62f5

但它适用于 /System/Library/Frameworks/Ruby.framework/


UPDATE1 中的 Ruby 1.8.7 时,出现以下错误消息

因为它是 Alex 解释 我需要使用 i386 架构编译 Ruby。有人可以为 MacPorts 和 RVM 做到这一点,但由于各种错误,这些方法都不适合我。

  1. 如何forece i386 在雪豹 macports 上构建?
  2. 内部配置文件
  3. Darwin OS

所以我决定编译Ruby 1.9.2-rc2 从来源

$ ARCHFLAGS="-arch i386"  CFLAGS="-arch i386" LDFLAGS="-arch i386" ./configure  --with-arch=i386
$ make && sudo make install

并将相应的文件复制到 SketchUp

$ cd /Applications/Google\ SketchUp\ 7/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/A/
$ rm -r Headers Ruby
$ cp /usr/local/bin/ruby Ruby
$ mkdir Headers
$ cp /usr/local/include/ruby-1.9.1/i386-darwin10.4.0/ruby/config.h Headers/
$ cp /usr/local/include/ruby-1.9.1/ruby.h Headers/
$ cp -r /usr/local/include/ruby-1.9.1/ruby/* Headers/
$ ls Headers
backward/   defines.h   dl.h        intern.h    missing.h   re.h        ruby.h      util.h      vm.h
config.h    digest.h    encoding.h  io.h        oniguruma.h regex.h     st.h        version.h

这次我收到以下消息

Dyld Error Message:
  Library not loaded: @executable_path/../Frameworks/Ruby.framework/Versions/A/Ruby
  Referenced from: /Applications/Google SketchUp 7/SketchUp.app/Contents/MacOS/SketchUp
  Reason: no suitable image found.  Did find:
    /Applications/Google SketchUp 7/SketchUp.app/Contents/MacOS/../Frameworks/Ruby.framework/Versions/A/Ruby: can't map
    /Applications/Google SketchUp 7/SketchUp.app/Contents/MacOS/../Frameworks/Ruby.framework/Versions/A/Ruby: can't map
    /usr/local/lib/Ruby: not a file
    /usr/lib/Ruby: not a file

I have asked a question on SuperUser about updating Ruby version in Google SketchUp. It seems that there is something different between Ruby shipped with the standard OS X distribution, and Ruby installed by RVM or MacPorts. I get the following error message when I try to use RVM's or MacPorts' Ruby 1.9.1

Exception Type:  EXC_BREAKPOINT (SIGTRAP)

Dyld Error Message:
  Library not loaded: @executable_path/../Frameworks/Ruby.framework/Versions/A/Ruby
  Referenced from: /Applications/Google SketchUp 7/SketchUp.app/Contents/MacOS/SketchUp
  Reason: no suitable image found.  Did find:
    /Applications/Google SketchUp 7/SketchUp.app/Contents/MacOS/../Frameworks/Ruby.framework/Versions/A/Ruby: mach-o, but wrong architecture
    /Applications/Google SketchUp 7/SketchUp.app/Contents/MacOS/../Frameworks/Ruby.framework/Versions/A/Ruby: mach-o, but wrong architecture
    /usr/lib/Ruby: not a file

Model: MacBookPro7,1, BootROM MBP71.0039.B05, 2 processors, Intel Core 2 Duo, 2.4 GHz, 4 GB, SMC 1.62f5

But it works with Ruby 1.8.7 from /System/Library/Frameworks/Ruby.framework/


UPDATE1

As it was explained by Alex I need to compile Ruby with i386 architecture. One can do it for MacPorts and RVM, but none of the methods worked for me due to various errors.

  1. How to forece i386 build on snow leopard macports ?
  2. Internal config files
  3. Darwin OS

So I decided to compile Ruby 1.9.2-rc2 from sources

$ ARCHFLAGS="-arch i386"  CFLAGS="-arch i386" LDFLAGS="-arch i386" ./configure  --with-arch=i386
$ make && sudo make install

and copy corresponding files to SketchUp

$ cd /Applications/Google\ SketchUp\ 7/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/A/
$ rm -r Headers Ruby
$ cp /usr/local/bin/ruby Ruby
$ mkdir Headers
$ cp /usr/local/include/ruby-1.9.1/i386-darwin10.4.0/ruby/config.h Headers/
$ cp /usr/local/include/ruby-1.9.1/ruby.h Headers/
$ cp -r /usr/local/include/ruby-1.9.1/ruby/* Headers/
$ ls Headers
backward/   defines.h   dl.h        intern.h    missing.h   re.h        ruby.h      util.h      vm.h
config.h    digest.h    encoding.h  io.h        oniguruma.h regex.h     st.h        version.h

This time I have got the following message

Dyld Error Message:
  Library not loaded: @executable_path/../Frameworks/Ruby.framework/Versions/A/Ruby
  Referenced from: /Applications/Google SketchUp 7/SketchUp.app/Contents/MacOS/SketchUp
  Reason: no suitable image found.  Did find:
    /Applications/Google SketchUp 7/SketchUp.app/Contents/MacOS/../Frameworks/Ruby.framework/Versions/A/Ruby: can't map
    /Applications/Google SketchUp 7/SketchUp.app/Contents/MacOS/../Frameworks/Ruby.framework/Versions/A/Ruby: can't map
    /usr/local/lib/Ruby: not a file
    /usr/lib/Ruby: not a file

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

叹梦 2024-09-18 04:29:12

看起来您的 sketchup 目录中有用于两种架构(可能是 32 位 intel 和 PPC,我猜)的 Ruby 库版本,并且正在尝试使用由第三种架构构建的 Ruby 二进制文件和不同的架构(我猜可能是 64 位英特尔)。您可以在 Terminal.App shell 提示符下使用 arch 命令进行检查。

如果这确实是问题所在,您可以尝试从源代码构建 1.9 ruby​​,针对 32 位 intel CPU...? (我不知道有任何为 32 位 intel CPU 构建的预打包的 ruby​​ 1.9 for mac —— 当然,很可能有一些我不知道!-)。

Looks like you have versions of the Ruby library in the sketchup directories for two architectures (probably 32-bit intel, and PPC, I'd guess) and are trying to use a Ruby binary built of a third and different architecture (probably 64-bit intel, I'd guess). You can check with the arch command at a Terminal.App shell prompt.

If this should indeed prove to be the problem, you could maybe try to build a 1.9 ruby from sources, targeting 32-bit intel CPUs...? (I don't know of any prepackaged ruby 1.9 for mac built for 32-bit intel CPUs -- of course, there might well be some I don't know about!-).

删除会话 2024-09-18 04:29:12

这件事解决了吗?为了回答您标题中的一般问题,这就是我点击此的原因:

System Ruby(我认为是 1.8.7)已预加载,并且不会被 MacPorts 或 RVM 覆盖。默认情况下,MacPorts 写入不同的目录,终端开始解析新安装,从而使系统 Ruby 处于未使用状态。 RVM 创建自己的 Ruby 虚拟安装,并且可以使用 $ rvm use 在虚拟安装和系统 Ruby 之间切换。

Was this solved? To answer the general question in your title, which is why I clicked on this:

System Ruby (1.8.7, I think) comes preloaded and is not overwritten by MacPorts or RVM. MacPorts writes by default to a different directory and Terminal begins to resolve to that new installation, leaving system Ruby sitting unused. RVM creates its own virtual installations of Ruby and can switch between those and system Ruby using $ rvm use.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文