views:

178

answers:

1

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. http://www.pubbs.net/201001/macports/76440-howto-force-i386-build-on-snow-leopard-macports-182.html
  2. http://guide.macports.org/chunked/internals.configuration-files.html
  3. http://rvm.beginrescueend.com/os/darwin/

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
+1  A: 

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!-).

Alex Martelli
Alex, I have compiled `Ruby 1.9.2-rc2` from sources and tried to run SketchUp. Now it gives me another error report -- `can't map`. Do you know what can be the reason?
Andrey