ruby-serialport with Ruby 1.9 error


T

Tim Ngua

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.
 
Ad

Advertisements

L

Luis Lavena

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.

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/development-kit
 
A

Ashik Ali

Luis said:
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/development-kit

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

Thanks,
ashik
 
T

Tim Ngua

Shawn said:
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.
 
R

Roger Pack

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=> 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
 
Ad

Advertisements

A

Ashik Ali

Roger said:
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
=> true



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
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top