# Ruby-serialport with Ruby 1.9 error

**URL:** <https://www.ruby-forum.com/t/ruby-serialport-with-ruby-1-9-error/182870>\
**Category:** Ruby\
**Created:** [February 4, 2010, 3:40am UTC](https://www.ruby-forum.com/t/ruby-serialport-with-ruby-1-9-error/182870 "2010-02-04T03:40:32Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![iprogramruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/9fc348/32.png) [@iprogramruby](https://www.ruby-forum.com/u/iprogramruby)\
**Post date:** [February 4, 2010, 3:40am UTC](https://www.ruby-forum.com/t/ruby-serialport-with-ruby-1-9-error/182870/1 "2010-02-04T03:40:32Z")

</div>

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`’

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.

---

<div class="post-metadata">

**Author:** ![iprogramruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/9fc348/32.png) [@iprogramruby](https://www.ruby-forum.com/u/iprogramruby)\
**Post date:** [February 4, 2010, 1:54pm UTC](https://www.ruby-forum.com/t/ruby-serialport-with-ruby-1-9-error/182870/2 "2010-02-04T13:54:59Z")

</div>

On Feb 4, 3:40 am, Tim N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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 `’
> 
> 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.

> **[RubyInstaller for Windows](https://rubyinstaller.org/)**
>
> The easy way to install Ruby on Windows This is a self-contained Windows-based installer that includes the Ruby language, an execution environment, important...

[http://wiki.github.com/oneclick/rubyinstaller/development-kit](http://wiki.github.com/oneclick/rubyinstaller/development-kit)

---

<div class="post-metadata">

**Author:** ![iprogramruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/9fc348/32.png) [@iprogramruby](https://www.ruby-forum.com/u/iprogramruby)\
**Post date:** [February 4, 2010, 3:12pm UTC](https://www.ruby-forum.com/t/ruby-serialport-with-ruby-1-9-error/182870/3 "2010-02-04T15:12:30Z")

</div>

Luis L. wrote:

> On Feb 4, 3:40ï¿½am, Tim N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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 `’
> > 
> > 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://rubyinstaller.org/)  
> [http://wiki.github.com/oneclick/rubyinstaller/development-kit](http://wiki.github.com/oneclick/rubyinstaller/development-kit)

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

Thanks,  
ashik

---

<div class="post-metadata">

**Author:** ![iprogramruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/9fc348/32.png) [@iprogramruby](https://www.ruby-forum.com/u/iprogramruby)\
**Post date:** [February 4, 2010, 3:28pm UTC](https://www.ruby-forum.com/t/ruby-serialport-with-ruby-1-9-error/182870/4 "2010-02-04T15:28:41Z")

</div>

There is a 1.9 version of this gem on github, I’m not sure why searching  
didn’t find it.

> **[GitHub - shawn42/ruby-serialport: Ruby Serialport packed neatly into a gem.](https://github.com/shawn42/ruby-serialport)**
>
> Ruby Serialport packed neatly into a gem. Contribute to shawn42/ruby-serialport development by creating an account on GitHub.

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

HTH  
/Shawn A.

---

<div class="post-metadata">

**Author:** ![iprogramruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/9fc348/32.png) [@iprogramruby](https://www.ruby-forum.com/u/iprogramruby)\
**Post date:** [February 4, 2010, 4:28pm UTC](https://www.ruby-forum.com/t/ruby-serialport-with-ruby-1-9-error/182870/5 "2010-02-04T16:28:31Z")

</div>

Shawn A. wrote:

> There is a 1.9 version of this gem on github, I’m not sure why searching  
> didn’t find it.  
> [GitHub - shawn42/ruby-serialport: Ruby Serialport packed neatly into a gem. · GitHub](http://github.com/shawn42/ruby-serialport)
> 
> Also, I believe this was released to gemcutter as serialport:  
> gem install serialport
> 
> HTH  
> /Shawn A.

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 `’

So I find ‘serialport.so’ from here  
[http://rubyforge.org/frs/?group\_id=61&release\_id=30322](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.

---

<div class="post-metadata">

**Author:** ![iprogramruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/9fc348/32.png) [@iprogramruby](https://www.ruby-forum.com/u/iprogramruby)\
**Post date:** [February 4, 2010, 6:36pm UTC](https://www.ruby-forum.com/t/ruby-serialport-with-ruby-1-9-error/182870/6 "2010-02-04T18:36:07Z")

</div>

> 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 `’

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

from

[http://wiki.github.com/oneclick/rubyinstaller/gem-list](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](http://rubyinstaller.org/download.html))

Also Python isn’t that hard to learn–we don’t hate it here 🙂

GL!  
-r

---

<div class="post-metadata">

**Author:** ![iprogramruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/9fc348/32.png) [@iprogramruby](https://www.ruby-forum.com/u/iprogramruby)\
**Post date:** [February 6, 2010, 3:25am UTC](https://www.ruby-forum.com/t/ruby-serialport-with-ruby-1-9-error/182870/7 "2010-02-06T03:25:24Z")

</div>

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:

> **[GitHub - hparra/ruby-serialport: ruby-serialport is a Ruby library that...](https://github.com/hparra/ruby-serialport)**
>
> ruby-serialport is a Ruby library that provides a class for using RS-232 serial ports - GitHub - hparra/ruby-serialport: ruby-serialport is a Ruby library that provides a class for using RS-232 ser...

Thank you all!

---

<div class="post-metadata">

**Author:** ![iprogramruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/9fc348/32.png) [@iprogramruby](https://www.ruby-forum.com/u/iprogramruby)\
**Post date:** [February 5, 2010, 8:04am UTC](https://www.ruby-forum.com/t/ruby-serialport-with-ruby-1-9-error/182870/8 "2010-02-05T08:04:47Z")

</div>

Roger P. 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 `’
> 
> I think this might mean there is “some other” dependency that it is  
> missing.
> 
> from
> 
> [http://wiki.github.com/oneclick/rubyinstaller/gem-list](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](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](http://rubyinstaller.org) groups . We achieved not only in  
linux, windows too . As per the instructions from [rubyinstaller.org](http://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
