如何在 Google SketchUp 中更新 Ruby?

发布于 2024-09-11 17:55:32 字数 2782 浏览 2 评论 0原文

目前 Google SketchUp for Mac 的 Ruby 版本 1.8.5 我觉得有点过时了。我可以通过以下命令将 Ruby 更新到 1.8.7(OSX 版本)。SketchUp

$ cd /Applications/Google\ SketchUp\ 7/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/Current
$ ls
Headers/       Resources/     Ruby
$ ls Headers/
config.h  defines.h intern.h  missing.h ruby.h

$ rm -r Headers
$ ln -s  /System/Library/Frameworks/Ruby.framework/Headers
$ ln -fs /System/Library/Frameworks/Ruby.framework/Ruby

启动时没有问题,并且 Ruby 控制台显示版本 1.8.7。

1.9.2

现在我尝试更进一步并更新到 1.9.2-rc2。 Google SketchUp 需要 i386 二进制文件,可以通过以下命令生成

$ cd ~/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/
$ rm 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

当我尝试启动 SketchUp 时,我收到以下错误报告

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: 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

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

您能告诉我原因吗?

UPDATE1

Dan Rathbun 做了一些测试并发现以下内容

在 Win32 上,当我尝试获取 Sketchup 时 加载任何 1.9.x 我得到一个“Entry ruby C 的点未找到” 函数“rb_set_kcode”没有 1.9.x 中更长(已重命名,并且 Ruby 人没有别名旧 名称更改为新名称。)

基本上 SketchUp 调用 rb_set_kcode 将字符编码设置为UTF8 加载 Ruby 后 口译员。它适用于任何 Ruby 在 1.8.x 分支中,但在 1.9.x 中 Ruby 项目完全重新设计 字符编码,并给出了所有 C 函数新的标识符,以及 添加了更多功能。

1.9.x 和 Sketchup 的解决方案 似乎Sketchup需要 “Ruby版本敏捷”,这意味着 Google Guys 的编码更改 博尔德。

Currently Google SketchUp for Mac has Ruby version 1.8.5 which I find a bit outdated. I can update Ruby to 1.8.7 (OSX's version) by the following commands

$ cd /Applications/Google\ SketchUp\ 7/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/Current
$ ls
Headers/       Resources/     Ruby
$ ls Headers/
config.h  defines.h intern.h  missing.h ruby.h

$ rm -r Headers
$ ln -s  /System/Library/Frameworks/Ruby.framework/Headers
$ ln -fs /System/Library/Frameworks/Ruby.framework/Ruby

SketchUp starts without a problem and Ruby console shows version 1.8.7.

1.9.2

Now I try to go further and update to 1.9.2-rc2. Google SketchUp requires i386 binary, which can be produced by the following commands

$ cd ~/ruby-1.9.2-rc2/
$ ARCHFLAGS="-arch i386"  CFLAGS="-arch i386" LDFLAGS="-arch i386" ./configure  --with-arch=i386
$ make && sudo make install

Then I copy the necessary files to SketchUp:

$ cd /Applications/Google\ SketchUp\ 7/SketchUp.app/Contents/Frameworks/Ruby.framework/
$ rm 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

and when I try to start SketchUp I get the following error report

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: 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

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

Could you tell me why?

UPDATE1

Dan Rathbun made some tests and found the following

On Win32 when I tried to get Sketchup
to load any 1.9.x I got an "Entry
point not found" for the ruby C
function "rb_set_kcode" which is no
longer in 1.9.x (it was renamed, and
the Ruby people did not alias the old
name to the new name.)

Basically Sketchup calls rb_set_kcode
to set the character encoding to UTF8
just after loading the Ruby
interpreter. It works fine for any
Ruby in the 1.8.x branch, but in 1.9.x
the Ruby project totally reengineered
the character encoding, and gave all
the C functions new identifiers, and
added alot more functions.

The solution for 1.9.x and Sketchup
seems to be that Sketchup needs to be
"Ruby Version Agile", which means a
coding change by the Google Guys in
Boulder.

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

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

发布评论

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

评论(1

那支青花 2024-09-18 17:55:32

C 级 API 在 1.9.1 中发生了变化。请注意,gems 的路径指示 API 兼容性:.../1.8/... 表示 1.8 行,.../1.9.1/...对于 1.9.2 行。

这使得在不重新编译的情况下升级非常困难。

您可以要求“向后移植”;这将使您充分利用 1.9.x 的新方法,但不能利用新语法或字符串编码。

The C level API has changed in 1.9.1. Notice that the paths to gems indicate the API compatibility: .../1.8/... for the 1.8 line and .../1.9.1/... for the 1.9.2 line.

This makes it very difficult to upgrade without recompiling.

You can require "backports"; this will get you the most of the new methods of 1.9.x, but not the new syntax or the string encoding.

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