0

在 SuperUser 上问了一个关于在 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

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


更新1

正如亚历克斯解释的那样,我需要用i386架构编译 Ruby。可以为 MacPorts 和 RVM 做到这一点,但由于各种错误,没有一种方法对我有用。

  1. 如何在雪豹 macports 上强制 i386 构建?
  2. 内部配置文件
  3. 达尔文操作系统

所以我决定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
4

2 回答 2

1

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

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

于 2010-07-25T17:14:37.410 回答
1

这解决了吗?要回答您标题中的一般性问题,这就是我点击它的原因:

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.

于 2011-01-12T02:03:59.290 回答