[MacRuby-devel] macruby and sqlite3 gem

Jordan Breeding jordan.breeding at mac.com
Tue Mar 31 08:35:38 PDT 2009


"does not contain a version for the current architecture" sounds like  
a 32-bit vs. 64-bit problem to me.

MacRuby 0.4 has both i386 and x86_64 archs for macruby and macirb, on  
a capable system it will pick the x86_64 arch first, which means any  
frameworks you load while running that arch need to have x86_64 in  
their Framework/library/bundle as well.

What happens if you try running with something like `arch -arch i386  
macruby` or `arch -arch i386 macirb` instead?

On Mar 31, 2009, at 10:32, Tim Rand wrote:

> I was worried that it was an IO issue with macruby, which is why I am
> very excited that the 0.5 version is going to be address the IO
> system--hopefully it will help with this issue. I would love to help,
> but an issue spanning macruby, obj-c, sqlite3, and possibly C is
> really stretching my abilities.
>
> On the subject of sqlite wrappers in objective-C. I tried several that
> I found on the sqlite webpage (the have a long list of wrappers in
> several languages including obj-c). But it appears that most if not
> all are not being maintained and are not up to date and don't work
> with Leopard. If anyone knows of a light weight obj-c wrapper for
> sqlite3 that works in Leopard, please let us know. If I had some code
> that works to look at, I should be able to adapt it for macruby.
>
> framework 'QuickLite.framework'   # fails with the error below
> framework 'QuickLite'                   # fails can't find file
>
> Error Domain=NSCocoaErrorDomain Code=3585 UserInfo=0x800621ae0 "The
> bundle “QuickLite” could not be loaded because it does not contain a
> version for the current architecture."
>
>
> On Tue, Mar 31, 2009 at 7:24 AM,
> <macruby-devel-request at lists.macosforge.org> wrote:
>> Send MacRuby-devel mailing list submissions to
>>        macruby-devel at lists.macosforge.org
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>>        http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>> or, via email, send a message with subject or body 'help' to
>>        macruby-devel-request at lists.macosforge.org
>>
>> You can reach the person managing the list at
>>        macruby-devel-owner at lists.macosforge.org
>>
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of MacRuby-devel digest..."
>>
>>
>> Today's Topics:
>>
>>   1. Re: Can any kind macruby experts help me get      sqlite3 gem
>>      working with macruby--please? (Matt Aimonetti)
>>
>>
>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Tue, 31 Mar 2009 01:51:07 -0700
>> From: Matt Aimonetti <mattaimonetti at gmail.com>
>> Subject: Re: [MacRuby-devel] Can any kind macruby experts help me get
>>        sqlite3 gem working with macruby--please?
>> To: "MacRuby development discussions."
>>        <macruby-devel at lists.macosforge.org>
>> Message-ID:
>>        <20fefa50903310151r6cb96a11lf2f0d394428f5738 at mail.gmail.com>
>> Content-Type: text/plain; charset="utf-8"
>>
>> the sqlite3 gem uses a native C extension which needs to compiled  
>> for your
>> system. (usually done when installed via rubygems)
>> The installation will fail if you use macgem, probably due to some  
>> IO issues
>> and the lack of support of C extension.
>>
>> Someone should look into writing a wrapper for macruby using an obj-c
>> driver. That can't be that hard and that would be very useful. I've  
>> been
>> thinking about porting the DataObject and the DO SQlite3 driver to  
>> MacRuby
>> but I didn't have time yet (and I didn't really need it either).   
>> DataObject
>> is the uniform API used by DataMapper to talk to its drivers.
>> If someone is interested in working on that, I can put him/her in  
>> contact
>> with the DM team.
>>
>> - Matt
>>
>>
>>
>> 2009/3/31 Tim Rand <timrandg at gmail.com>
>>
>>> Can any kind macruby experts help me get sqlite3 gem working with  
>>> macruby?
>>>
>>> sqlite3-ruby-1.2.4 ruby gem works in ruby 1.9.0. So I think it  
>>> should work
>>> in macruby also...
>>> From macirb I added the path to the gem:
>>>
>>> $: << "path/to/the/sqlite3-ruby-1.2.4/lib"
>>>
>>> require 'sqlite3.rb'  # => true
>>>
>>> $db = SQLite3::Database.new("/path/to/x.db.rsd")
>>>
>>> RuntimeError: *no driver for sqlite3 found*
>>> the error comes from the load_driver method near line 621 of the
>>> sqlite3/database.rb file.
>>>
>>>    def load_driver( driver )
>>>       case driver
>>>         when Class
>>>           # do nothing--use what was given
>>>         when Symbol, String
>>>           require "sqlite3/driver/#{driver.to_s.downcase}/driver"
>>>           driver = SQLite3::Driver.const_get( driver )::Driver
>>>         else
>>>           [ "Native", "DL" ].each do |d|
>>>             begin
>>>               require "sqlite3/driver/#{d.downcase}/driver"
>>>               driver = SQLite3::Driver.const_get( d )::Driver
>>>               break
>>>             rescue SyntaxError
>>>               raise
>>>             rescue ScriptError, Exception, NameError
>>>             end
>>>           end
>>>           raise "no driver for sqlite3 found" unless driver
>>>       end
>>>
>>>       @driver = driver.new
>>>     end
>>>     private :load_driver
>>>
>>> Macruby enters the method with driver set to NSNull, and the  
>>> driver fails
>>> to load. In ruby (1.9.0) the driver loads via the Native driver.
>>>
>>> irb19 session:
>>>>> db = SQLite3::Database.new("/Users/Tim/Desktop/newdb")
>>> => #<SQLite3::Database:0x5cba48
>>> @driver=#<SQLite3::Driver::Native::Driver:0x5c4784  
>>> @callback_data={},
>>> @authorizer={}, @busy_handler={}, @trace={}>,
>>> @statement_factory=SQLite3::Statement,
>>> @handle=#<SWIG::TYPE_p_sqlite3:0x5c470c>, @closed=false,
>>> @results_as_hash=false, @type_translation=false, @translator=nil,
>>> @transaction_active=false>
>>>
>>> Can anyone offer an idea about how they might try to patch this to  
>>> work
>>> with macruby?  I know an alternative would be CoreData--but it is  
>>> too
>>> cumbersome for me.
>>> Thanks,
>>> Tim
>>>
>>> _______________________________________________
>>> MacRuby-devel mailing list
>>> MacRuby-devel at lists.macosforge.org
>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>>
>>>
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20090331/83530eaa/attachment-0001.html 
>> >
>>
>> ------------------------------
>>
>> _______________________________________________
>> MacRuby-devel mailing list
>> MacRuby-devel at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>
>>
>> End of MacRuby-devel Digest, Vol 13, Issue 47
>> *********************************************
>>
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3847 bytes
Desc: not available
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20090331/28e31049/attachment.bin>


More information about the MacRuby-devel mailing list