Hi Bob, Unfortunately, the gem you are trying to use is based on a C extensions which doesn't seem to be well written. That's why it doesn't run on Ruby 1.8.7. (and probably not 1.9) Unfortunately, even if the gem was working fine, it wouldn't currently work in MacRuby due to a lack of support for C extensions :( You have a few options, 1. wait for the next version of MacRuby which should support C extensions. 2. fix the gem to use FFI instead (so it's compatible with JRuby, MacRuby etc... 3. Rewrite the C code in an obj-c wrapper that you load in macruby 4. use the Cocoa API (I'm personally not familiar with the rs232/serial API) 5. something I'm not aware of which would totally solve your problem. (one can always hope) My guess is that you'd better off going with 4. - Matt On Fri, May 22, 2009 at 1:30 PM, Robert Rice <rice.audio@pobox.com> wrote:
Matt: Thanks for your quick reply. The hot patch seems to work. You may find serialport named as 'ruby-serialport'.
At one time I had serialport working in ruby 1.8.7 but then after attempting to install some other Gems I now get the error:
irb 0.9.5(05/04/13) new-host:~ robertrice$ ruby -v ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9.7.0] new-host:~ robertrice$ irb irb(main):001:0> require "rubygems" => true irb(main):002:0> require "serialport" [BUG] cross-thread violation on rb_gc() ruby 1.8.6 (2008-08-11) [universal-darwin9.0]
Abort trap new-host:~ robertrice$ exit logout
[Process completed]
Could you suggest a fix for this?
Thanks, Bob Rice
On May 22, 2009, at 12:59 PM, Matt Aimonetti wrote:
For XML, you can use Cocoa API or if you want to ue REXML, you need to use the hot patch I mentioned there:
http://www.macruby.org/trac/ticket/134
Regarding the serialport library, I can't seem to see it on rubyforge, so I'm not sure what you are referring to.
- Matt
On Fri, May 22, 2009 at 9:44 AM, Robert Rice <rice.audio@pobox.com> wrote:
Dear MacRuby development team:
I am new to Ruby and I have an application that I would like to port to MacRuby. The two extensions I will need are XML and serial port I/O. So far I have not been able to get them to work:
Last login: Fri May 22 12:31:48 on ttys000 new-host:~ robertrice$ macirb
require "rexml/document" NameError: uninitialized constant REXML::Attribute::NAME_STR from /Library/Frameworks/MacRuby.framework/Versions/0.4/usr/lib/ruby/1.9.1/rexml/attribute.rb:18:in `<class:Attribute>' from /Library/Frameworks/MacRuby.framework/Versions/0.4/usr/lib/ruby/1.9.1/rexml/attribute.rb:9:in `<module:REXML>' from /Library/Frameworks/MacRuby.framework/Versions/0.4/usr/lib/ruby/1.9.1/rexml/attribute.rb:4:in `<top (required)>' from /Library/Frameworks/MacRuby.framework/Versions/0.4/usr/lib/ruby/1.9.1/rexml/element.rb:3:in `require' from /Library/Frameworks/MacRuby.framework/Versions/0.4/usr/lib/ruby/1.9.1/rexml/element.rb:3:in `<top (required)>' from /Library/Frameworks/MacRuby.framework/Versions/0.4/usr/lib/ruby/1.9.1/rexml/document.rb:1:in `require' from /Library/Frameworks/MacRuby.framework/Versions/0.4/usr/lib/ruby/1.9.1/rexml/document.rb:1:in `<top (required)>' from (irb):1:in `require' from (irb):1 from /usr/local/bin/macirb:12:in `<main>' require "rubygems" => false require "serialport" LoadError: no such file to load -- serialport from (irb):3:in `require' from (irb):3 from /usr/local/bin/macirb:12:in `<main>' exit new-host:~ robertrice$ exit logout
[Process completed]
Can anyone help me? Do I have a bad installation of MacRuby?
Thanks, Bob Rice _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel