Can't get ruby serial port to work

D

Dd Dd

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
 
J

Jeremy Bopp

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.

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

http://rubyinstaller.org/downloads/

-Jeremy
 
D

Dd Dd

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

Dd Dd

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

Dd Dd

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

Luis Lavena

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?
 
H

Heesob Park

Hi,

2010/10/26 Dd Dd said:
Anyway, does anyone have any idea what the problem might be? =C2=A0It say= s
that one problem might be a lack of libraries or headers. =C2=A0I think i= t
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. =C2=A0It seems to be different in Windows, but Ru= by
doesn't seem to detect the equivalent file.

Also, do I need to download C to get Ruby to work? =C2=A0Thanks.

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=E2=80=98s Visual C++ and Borland=E2=80=98s 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
http://www.ruby-forum.com/topic/203540

Regards,
Park Heesob
 
L

Luis Lavena

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

Dd Dd

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

Dd Dd

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
#
 
L

Luis Lavena

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
#

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

Dd Dd

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.
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top