Can't get ruby serial port to work

I recently installed Ruby Version 1.9.2 on my PC. I am trying to get
the serial port to work. On the command prompt, I typed “gem install
ruby-serialport”, but it didn’t go through. I attached the file of the
whole response from the command prompt. Here are the first few lines:

C:\Users\Deepak>gem install ruby-serialport
Building native extensions. This could take a while…
ERROR: Error installing ruby-serialport:
ERROR: Failed to build gem native extension.

What could be the problem? Do I need to add a file to the library?
Thanks.

Where would I download the development kit to in the Ruby192 folder?
Should it go in the bin with the Ruby application? Thanks.

On 10/25/2010 5:30 PM, Dd Dd wrote:

What could be the problem? Do I need to add a file to the library?
Thanks.

You probably need to at least install the appropriate development kit
for your Ruby installation. You can find what you need here:

-Jeremy

On 10/25/2010 5:54 PM, Dd Dd wrote:

Where would I download the development kit to in the Ruby192 folder?
Should it go in the bin with the Ruby application? Thanks.

I believe the instructions for installation, among other things, can be
found here:

-Jeremy

I installed the developer, but still can’t get the serial port to work.
I still get the following:
ruby 1.9.2p0 (2010-08-18) [i386-mingw32]

C:\Users\Deepak>sudo gem install ruby-serialport
‘sudo’ is not recognized as an internal or external command,
operable program or batch file.

C:\Users\Deepak>gem install ruby-serialport
Temporarily enhancing PATH to include DevKit…
Building native extensions. This could take a while…
ERROR: Error installing ruby-serialport:
ERROR: Failed to build gem native extension.

C:/Users/Deepak/Ruby192/bin/ruby.exe extconf.rb
checking for OS… mingw
checking for termios.h… no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Provided configuration options:
–with-opt-dir
–without-opt-dir
–with-opt-include
–without-opt-include=${opt-dir}/include
–with-opt-lib
–without-opt-lib=${opt-dir}/lib
–with-make-prog
–without-make-prog
–srcdir=.
–curdir
–ruby=C:/Users/Deepak/Ruby192/bin/ruby

Gem files will remain installed in
C:/Users/Deepak/Ruby192/lib/ruby/gems/1.9.1/g
ems/ruby-serialport-0.7.0 for inspection.
Results logged to
C:/Users/Deepak/Ruby192/lib/ruby/gems/1.9.1/gems/ruby-serialpo
rt-0.7.0/ext/gem_make.out

I don’t know what to do.

On Oct 26, 1:56am, Dd Dd [email protected] wrote:

I installed the developer, but still can’t get the serial port to work.

Did you follow the Development Kit instructions?

ems/ruby-serialport-0.7.0 for inspection.
Results logged to
C:/Users/Deepak/Ruby192/lib/ruby/gems/1.9.1/gems/ruby-serialpo
rt-0.7.0/ext/gem_make.out

What are the contents of mkmf.log available in above path?

I don’t think I got an mkmf.log file, but I followed the development kit
installation from
Development Kit · oneclick/rubyinstaller Wiki · GitHub. Of
course, I do have the mkmf.rb file (which is around 40 pages) but not
the log. Maybe I missed a step when installing the developer?

Anyway, does anyone have any idea what the problem might be? It says
that one problem might be a lack of libraries or headers. I think it
failed when it reached this point: checking for termios.h… no
*** extconf.rb failed ***

I know that the termios.h fileis associated with UNIX specifically for
serial port operations. It seems to be different in Windows, but Ruby
doesn’t seem to detect the equivalent file.

Also, do I need to download C to get Ruby to work? Thanks.

Hi,

2010/10/26 Dd Dd [email protected]

Also, do I need to download C to get Ruby to work? Thanks.

According to the document at project’s
homepage(http://ruby-serialport.rubyforge.org/)

“It support POSIX (Linux, *BSD, Solaris, AIX, Mac OS X), Cygwin and
native Windows. The native Windows version of this library supports
Microsoft‘s Visual C++ and Borland‘s C++ compilers.”

You cannot build and install ruby-serialport with MinGW Development Kit.
And even worse, the current ruby-serialport 0.7.0 is not compatible
with Ruby 1.9.x

There is another patched
ruby-serialport(GitHub - hparra/ruby-serialport: ruby-serialport is a Ruby library that provides a class for using RS-232 serial ports)
And you can install it like this

gem install serialport

The whole story is here
http://www.ruby-forum.com/topic/203540

Regards,
Park H.

I uninstalled Ruby 1.9.2 and then installed Ruby 1.9.1 before. This
time, I’ll install an earlier version of Ruby to see if it will work.
I’ll post my experience with this soon.

On Oct 26, 10:11am, Dd Dd [email protected] wrote:

I don’t think I got an mkmf.log file, but I followed the development kit
installation fromhttp://github.com/oneclick/rubyinstaller/wiki/Development-Kit.
Of
course, I do have the mkmf.rb file (which is around 40 pages) but not
the log. Maybe I missed a step when installing the developer?

Please verify the steps and the test invocation (gem install rdiscount
–platform=ruby)

If that didn’t work either the devkit was not installed properly or
there is something messing with gem compilation in your computer.

The file mkmf.log is generated in the directory reported by gem
install, “Gem files will remain installed in C:/Users/Deepak/Ruby192/
lib/ruby/gems/1.9.1/gems/ruby-serialport-0.7.0 for inspection.”

You need to look inside that folder and child folders for mkmf.log and
look into its contents.

On Oct 27, 12:42am, Dd Dd [email protected] wrote:

Rubies that were not automagically discovered, simply add a line below

Should I modify it, and how? Thanks.

If that is where you installed Ruby, that is OK.

Now just “ruby dk.rb install” and then look at the ruby-serialport
variant that works on Windows.

I think I got it to work; I followed all the DevKit installation
instructions, and have gotten the and the one thing I forgot to do was
add --platform=ruby at the end of the command. This time, I entered
“gem install serialport --platform=ruby”, and it seems to have worked,
installing serial port version 1.0.4. Is this the latest version of the
serial port? I want to make sure it is the correct one, rather than
serial port version 0.7.0. Thanks.

I just installed Ruby 1.8.7 and DevKit 3.4.5; Using the instructions
from Development Kit · oneclick/rubyinstaller Wiki · GitHub, I
entered ruby dk.rb init in the command prompt. Initialization was
successful, and now I looked up the config.yml file, which is as
follows:

This configuration file contains the absolute path locations of all

installed Rubies to be enhanced to work with the DevKit. This config

file is generated by the ‘ruby dk.rb init’ step and may be modified

before running the ‘ruby dk.rb install’ step. To include any installed

Rubies that were not automagically discovered, simply add a line below

the triple hyphens with the absolute path to the Ruby root directory.

Example:

- C:/ruby19trunk

- C:/ruby192dev


  • C:/Users/Deepak/Ruby187

Should I modify it, and how? Thanks.