Forum: Ruby ruby-serialport with Ruby 1.9 error

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
514cec5aac58ece0b51dfc57f884d128?d=identicon&s=25 Tim Ngua (ohp)
on 2010-02-04 03:40
I'm a newbie programmer and I've been trying to communicate with an
Arduino using the ruby-serialport library. If I run this:

require 'rubygems'
require 'serialport'
sp = SerialPort.new "COM3", 9600
sp.write "H"
puts sp.read   # hopefully "OK" ;-)


I get this error (as a windows pop-up box):

'The application has failed to start because msvcrt-ruby18.dll was not
found. Re-installing the application may fix the problem.'


and this ruby error in my command line window:

D:/Ruby19/lib/ruby/gems/1.9.1/gems/ruby-serialport/lib/serialport.rb:1:in
`require': 126:
The specified module could not be found.   -
D:/Ruby19/lib/ruby/1.9.1/i386-mingw32/serialport.so (LoadError)
        from
D:/Ruby19/lib/ruby/gems/1.9.1/gems/ruby-serialport/lib/serialport.rb:1:in
`<top (required)>'
        from ser.rb:2:in `require'
        from ser.rb:2:in `<main>'


As far as I can see, the serialport library was supposed to work with
1.8. There doesn't seem to be a 1.9 version on the GitHub repository
either.

I'm pretty stuck and don't want to learn Python just so I can write
programs for my Arduino (I need to use an email library as well so I can
light an LED each time I get a new email - ie. I can't use
'Processing').

Any suggestions much appreciated.
E7cff3cfd41c495e1012227d7dc24202?d=identicon&s=25 Luis Lavena (luislavena)
on 2010-02-04 13:54
(Received via mailing list)
On Feb 4, 3:40 am, Tim Ngua <techro...@yahoo.co.uk> wrote:
>
> D:/Ruby19/lib/ruby/gems/1.9.1/gems/ruby-serialport/lib/serialport.rb:1:in
> `<top (required)>'
>         from ser.rb:2:in `require'
>         from ser.rb:2:in `<main>'
>
> As far as I can see, the serialport library was supposed to work with
> 1.8. There doesn't seem to be a 1.9 version on the GitHub repository
> either.
>

You've installed a Binary gem for 1.8 when you've tried to use Ruby
1.9

Please install a gem binary gem that is compatible with Ruby 1.9 or
force the compilation process indicating the "ruby" platform:

gem install ruby-serialport --platform=ruby

I can't comment on the state of the gem itself, but if you used
RubyInstaller and the Development Kit, building other gems could be
straight forward as *nix OS.

http://rubyinstaller.org/
http://wiki.github.com/oneclick/rubyinstaller/deve...
054515cb92a507d2b549b8fe4c281fff?d=identicon&s=25 Ashik Ali (ashikalim)
on 2010-02-04 15:12
Luis Lavena wrote:
> On Feb 4, 3:40�am, Tim Ngua <techro...@yahoo.co.uk> wrote:
>>
>> D:/Ruby19/lib/ruby/gems/1.9.1/gems/ruby-serialport/lib/serialport.rb:1:in
>> `<top (required)>'
>> � � � � from ser.rb:2:in `require'
>> � � � � from ser.rb:2:in `<main>'
>>
>> As far as I can see, the serialport library was supposed to work with
>> 1.8. There doesn't seem to be a 1.9 version on the GitHub repository
>> either.
>>
>
> You've installed a Binary gem for 1.8 when you've tried to use Ruby
> 1.9
>
> Please install a gem binary gem that is compatible with Ruby 1.9 or
> force the compilation process indicating the "ruby" platform:
>
> gem install ruby-serialport --platform=ruby
>
> I can't comment on the state of the gem itself, but if you used
> RubyInstaller and the Development Kit, building other gems could be
> straight forward as *nix OS.
>
> http://rubyinstaller.org/
> http://wiki.github.com/oneclick/rubyinstaller/deve...

Hi Louis,
    Does ruby-serial works well with ruby1.8 ?

Thanks,
ashik
81b5e41ae80dc7f1aa57d2bf40e7e7d0?d=identicon&s=25 Shawn Anderson (Guest)
on 2010-02-04 15:28
(Received via mailing list)
There is a 1.9 version of this gem on github, I'm not sure why searching
didn't find it.
http://github.com/shawn42/ruby-serialport

Also, I believe this was released to gemcutter as serialport:
gem install serialport


HTH
/Shawn Anderson
514cec5aac58ece0b51dfc57f884d128?d=identicon&s=25 Tim Ngua (ohp)
on 2010-02-04 16:28
Shawn Anderson wrote:
> There is a 1.9 version of this gem on github, I'm not sure why searching
> didn't find it.
> http://github.com/shawn42/ruby-serialport
>
> Also, I believe this was released to gemcutter as serialport:
> gem install serialport
>
>
> HTH
> /Shawn Anderson

Thanks but I still seem to get the same errors. First it gives me this
error:


D:\Ruby19\lib\ruby\gems\1.9.1\gems\ruby-serialport\test>ruby miniterm.rb
miniterm.rb:1:in `require': no such file to load -- ../serialport.so
(LoadError)
        from miniterm.rb:1:in `<main>'


So I find 'serialport.so' from here
http://rubyforge.org/frs/?group_id=61&release_id=30322. The file called
'serialport_win32.zip'. I put the  'serialport.so' file in the
D:\Ruby19\lib\ruby\gems\1.9.1\gems\ruby-serialport folder and then I get
this windows pop-up error again:


'The application has failed to start because msvcrt-ruby18.dll was not
found. Re-installing the application may fix the problem.'

I don't quite understand where I am going wrong. Is there some kind of
updated 'serialport.so' that I need?

Thanks for the help.
Bec38d63650c8912b6ba9b557fb953b9?d=identicon&s=25 Roger Pack (rogerdpack)
on 2010-02-04 18:36
> D:\Ruby19\lib\ruby\gems\1.9.1\gems\ruby-serialport\test>ruby miniterm.rb
> miniterm.rb:1:in `require': no such file to load -- ../serialport.so
> (LoadError)
>         from miniterm.rb:1:in `<main>'

I think this might mean there is "some other" dependency that it is
missing.


from

http://wiki.github.com/oneclick/rubyinstaller/gem-list

it appears that the "serialport" gem should build and work with 1.9.1
mingw + devkit

E:\dev\ruby\ruby-prof\test>gem install serialport
Building native extensions.  This could take a while...
Successfully installed serialport-1.0.1
1 gem installed

E:\dev\ruby\ruby-prof\test>irb
>> require 'serialport'
=> true


> 'The application has failed to start because msvcrt-ruby18.dll was not
> found. Re-installing the application may fix the problem.'

That ruby18.dll is a hint--you're using ruby19 and it's searching for
ruby18.dll, so there's probably a problem there.

You could also try using an older version of Ruby for windows, which
probably would work with that .so file ("legacy one click installer" on
http://rubyinstaller.org/download.html)


Also Python isn't that hard to learn--we don't hate it here :)

GL!
-r
054515cb92a507d2b549b8fe4c281fff?d=identicon&s=25 Ashik Ali (ashikalim)
on 2010-02-05 08:04
Roger Pack wrote:
>
>> D:\Ruby19\lib\ruby\gems\1.9.1\gems\ruby-serialport\test>ruby miniterm.rb
>> miniterm.rb:1:in `require': no such file to load -- ../serialport.so
>> (LoadError)
>>         from miniterm.rb:1:in `<main>'
>
> I think this might mean there is "some other" dependency that it is
> missing.
>
>
> from
>
> http://wiki.github.com/oneclick/rubyinstaller/gem-list
>
> it appears that the "serialport" gem should build and work with 1.9.1
> mingw + devkit
>
> E:\dev\ruby\ruby-prof\test>gem install serialport
> Building native extensions.  This could take a while...
> Successfully installed serialport-1.0.1
> 1 gem installed
>
> E:\dev\ruby\ruby-prof\test>irb
>>> require 'serialport'
> => true
>
>
>> 'The application has failed to start because msvcrt-ruby18.dll was not
>> found. Re-installing the application may fix the problem.'
>
> That ruby18.dll is a hint--you're using ruby19 and it's searching for
> ruby18.dll, so there's probably a problem there.
>
> You could also try using an older version of Ruby for windows, which
> probably would work with that .so file ("legacy one click installer" on
> http://rubyinstaller.org/download.html)
>
>
> Also Python isn't that hard to learn--we don't hate it here :)
>
> GL!
> -r

Hi Gordon and All ,

Thank you very much  rubyinstaller.org groups .  We achieved not only in
linux, windows too . As per the instructions  from rubyinstaller.org , I
installed ruby1.8 and devkit .

Then Finally I download win32serial then I followed the instructions in
Readme from win32serial.zip . Then run the modem.rb sample file .  Now
the modem is responding correctly .

However after rubyinstaller and devkit,  I can shine in windows as same
as linux .Soon I am going to write documentations for this .

Greets a lot,
 ashik
514cec5aac58ece0b51dfc57f884d128?d=identicon&s=25 Tim Ngua (ohp)
on 2010-02-06 03:25
After much effort I have finally got it to work!

For those who are interested I used this library and it works perfectly
with 1.9.1:

http://github.com/hparra/ruby-serialport

Thank you all!
This topic is locked and can not be replied to.