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.

Attachments:
http://www.ruby-forum.com/attachment/5247/Command_Prompt_Ruby_Serial_Port.txt

···

--
Posted via http://www.ruby-forum.com/.

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:30 PM, Dd Dd wrote:

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.

···

--
Posted via http://www.ruby-forum.com/.

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.

···

--
Posted via http://www.ruby-forum.com/.

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.

···

--
Posted via http://www.ruby-forum.com/.

I don't think I got an mkmf.log file, but I followed the development kit
installation from
http://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?

···

--
Posted via http://www.ruby-forum.com/.

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.

···

--
Posted via http://www.ruby-forum.com/.

I just installed Ruby 1.8.7 and DevKit 3.4.5; Using the instructions
from http://github.com/oneclick/rubyinstaller/wiki/Development-Kit, 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.

--
Posted via http://www.ruby-forum.com/.

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? Thanks.

···

--
Posted via http://www.ruby-forum.com/.

I believe the instructions for installation, among other things, can be
found 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 installed the developer, but still can't get the serial port to work.

Did you follow the Development Kit instructions?

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.

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

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

···

On Oct 26, 1:56 am, Dd Dd <d...@njit.edu> wrote:

--
Luis Lavena

Hi,

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.

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(http://github.com/hparra/ruby-serialport\)
And you can install it like this

gem install serialport

The whole story is here

Regards,
Park Heesob

···

2010/10/26 Dd Dd <dd25@njit.edu>

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 26, 10:11 am, Dd Dd <d...@njit.edu> 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?

--
Luis Lavena

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.

···

On Oct 27, 12:42 am, Dd Dd <d...@njit.edu> wrote:

I just installed Ruby 1.8.7 and DevKit 3.4.5; Using the instructions
fromhttp://github.com/oneclick/rubyinstaller/wiki/Development-Kit, 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.

--
Luis Lavena