[MacRuby-devel] MacRuby-devel Digest, Vol 45, Issue 26

Jean-Denis MUYS jdmuys at kleegroup.com
Thu Nov 17 03:30:05 PST 2011

Thanks for your answer. I followed your advice, and indeed, it works quite nicely. However, in the meantime, I filed a ticket reporting the bug to the MacRuby project. And the bug is already fixed (thanks Watson1978). A commit has been added today with the fix. The latest nightly doesn't yet include the fix, but tomorrow's should. So I built MacRuby from source, and I can confirm that the short sample session that I quoted yesterday now works fine. I can't preclude other bugs to show up downstream, but I have no reason to suspect so.

So I now have two working options, between MCPKit and Sequel. MacRuby at its best.

For reference, the short version of the recipe for MCPKit is:

- Download the source code for Sequel Pro and open the included Xcode project. Sequel Pro uses Interface Builder plugins which are not support in Xcode 4. However, we won't build Sequel Pro, and it's OK here to use Xcode 4. I used Xcode 4.2

- Out of the 8 or so targets included in the Sequel Pro Xcode project, choose the framework target named MCPKit

- As of today, this target specifies an old SDK. In the target settings, switch the SDK to the latest SDK (10.7 under Lion for me).

- As of today, this target is set up as incompatible with GC. This doesn't work with MacRuby. Switch that target setting to "Supported". This setting is "Objective-C Garbage Collection" in the "Apple LLVM Compiler 3.0 - Language" section.

- The "Installation Directory" setting (in the "deployment" section) is set for installing the framework as a private framework in the application bundle. This works for me. If you want to install the framework system-wide, you'll have to change this.

- Build the target and copy the output package (MCPKit.framework) to your MacRuby source code directory.

- You can close the Sequel Pro Xcode project. Switch to your MacRuby Xcode project.

- Go to your app target "Build Phases" tab, and open the "Link Binary With Libraries" section. Click the + button to add the framework. In the library selection sheet, click "Add Other…" and select the MCPKit.framework package.

- Click the big + button at the bottom right of the Build Phases pane to add a new Copy Files phase. Select "Frameworks" in the new Copy Phase destination pop up menu. Drag the MCPKit.framework from your project source list to the Copy Phase file list (or alternatively use the + button).

- That's it.

This recipe actually works for any external private framework.


On 16 nov. 2011, at 19:28, <macruby-devel-request at lists.macosforge.org<mailto:macruby-devel-request at lists.macosforge.org>>

Message: 3
Date: Wed, 16 Nov 2011 17:29:18 +0000
From: Steve Clarke <steve at sclarkes.me.uk<mailto:steve at sclarkes.me.uk>>
To: "MacRuby development discussions."
<macruby-devel at lists.macosforge.org<mailto:macruby-devel at lists.macosforge.org>>
Subject: Re: [MacRuby-devel] symbol not found: _rb_str_freeze
Message-ID: <60D7AE97-7D34-481A-BD2E-E17B8B7CAB7A at sclarkes.me.uk<mailto:60D7AE97-7D34-481A-BD2E-E17B8B7CAB7A at sclarkes.me.uk>>
Content-Type: text/plain; charset=windows-1252

Hi Jean-Denis,

I can't answer your question directly but I may be able to help a bit. I also want to use mysql with `MacRuby.  I tried mysql gem version 2.8.1 and hit problems I couldn't work around.  I also tried ruby-mysql 2.9.4.  I did get that to work after some mods, but it was very slow to load and didn't seem totally reliable.

I then decided to use an Objective-C framework that accesses SQL.  Sequel Pro contains such a framework called MCPKit and it's open source.  This means no gems so it loads v quickly.  However, the version of MCPKit that I downloaded had manual memory management so wouldn't link with a MacRuby app.  I don't know much about Objective-C but I thought I would just try recompiling MCPKit with ARC and garbage collection.  To my surprise and delight it worked.  I'm afraid I don't know how robust this approach is likely to be.  Maybe I've just been lucky.  It would be interesting to hear from someone who understands memory management better than me.


On 16 Nov 2011, at 15:33, Jean-Denis MUYS wrote:


I have a big showstopper with my app: sequel with the mysql gem fails with the following error message:

dyld: Symbol not found: _rb_str_freeze
Referenced from: /Library/Frameworks/MacRuby.frameword/[?]/mysql_api.bundle

This is mentioned on the net on the sequel project back in february. The diagnostic of the sequel developer was that this is a bug in MacRuby.

I am using MacRuby nightly latest as of November 17, 2011, which reports its version as 0.12
I have mysql gem version 2.8.1
I have sequel gem version 3.29.0

Steps to reproduce in macirb:

require 'ruby gems'
require 'sequel'
DB = Sequel.connect(:adapter => 'mysql', :user => 'root', :host => 'localhost', :database => 'test', :password => 'your password')

Is there any workaround/ easy fix?

I would appreciate any suggestion, including of alternate gems to use.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20111117/58aa5a57/attachment.html>

More information about the MacRuby-devel mailing list