Can't get Ruby programs to work from Command Prompt

D

Dd Dd

Hello; I'm having a problem running Ruby programs through the command
prompt. I have a Ruby program called scope.rb, which is a simple
oscilloscope which runs using an Arduino platform, and I enter "ruby
scope.rb", but I get the following message (the file is in the bin
folder:

ruby 1.9.2p0 (2010-08-18) [i386-mingw32]

C:\Users\Deepak>cd Ruby192

C:\Users\Deepak\Ruby192>cd bin

C:\Users\Deepak\Ruby192\bin>ruby scope.rb
<internal:lib/rubygems/custom_require>:29:in `require': no such file to
load --
tk (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from scope.rb:1:in `<main>'

When entering just "scope" or "scope.rb", I of course get a text file of
the code. The problem is that the Ruby is installed as part of the Path
variable, yet I still get these errors. The Path variable is as
follows:
"C:\Users\Deepak\Ruby192\bin;%CommonProgramFiles%\Microsoft
Shared\Windows Live". Is there a problem with the Path syntax? Any
help would be appreciated. Thank you.
 
Q

Quintus

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 15.11.2010 10:37, schrieb Dd Dd:
tk (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from scope.rb:1:in `<main>'

Your Ruby installation simply misses the Tk library. The RubyInstaller
team doesn't provide it. If you have the RubyInstaller Team's Devkit
installed, you may try to install Tk by

gem install tk_as_gem

And please don't save your Ruby scripts in Ruby's bin/ directory!
try to download ruby from this site than it might work

http://www.ruby-lang.org/en/

No, it won't. He's on Windows and likely doesn't have a C compiler. And
the binaries provided at ruby-lang.org are compiled with the Microsoft
Visual C/C++ compiler, which isn't the recommanded Ruby on Windows
anymore (the MinGW-compiled one provided by the RubyInstaller team at
http://rubyinstaller.org now is it).

Vale,
Marvin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJM4QRaAAoJEGrS0YjAWTKVWUQH/39fjXPf/Z7T76BiYmsdzcIF
cK/9z1QbVeZM1bFhJu0k+vZiszyCBr2Yz8m5K+hUp5vNZFnpLBTxkVYQ1Og5ldy9
D3Ldwv7mdmpSUaW1r0mKCSTyplgv0zcSXZMHOHhv8HnAvjcdh0GypFK0ysMI/LGq
mcVzWtq9A8ahkkT4RkbMNz6aUV4PF+EylvtHOYXATeGEtYnVuqKUOb2H0Cc1vdXK
i/jMDKBGvln0Fd/3X3m+QUftqMlpefrxPJFEMjQKcYDk7MXR/nIbhhI3Y1L4EgDe
2DwuolWXdDpQPt3e8ELzVJN23odyDnZCKnM1T/Op9LCgUfSX4vqyxqDlA4hfKUE=
=OyMj
-----END PGP SIGNATURE-----
 
L

Luis Lavena

No, it won't. He's on Windows and likely doesn't have a C compiler. And
the binaries provided at ruby-lang.org are compiled with the Microsoft
Visual C/C++ compiler, which isn't the recommanded Ruby on Windows
anymore (the MinGW-compiled one provided by the RubyInstaller team athttp://rubyinstaller.orgnow is it).

RubyInstaller *is* linked in ruby-lang.org website, so even download
form ruby-lang will download RubyInstaller.

Tk/Tcl is not provided by RubyInstaller at this time, contributions to
automate the compilation of it haven't been 100% sucessful.

We can't integrate a tool to the build process of Ruby that we can't
automate and do not pollute the RubyInstaller developer environment.

Search RubyInstaller group about it.

http://groups.google.com/group/rubyinstaller/
 
D

Dd Dd

Okay, I just downloaded ActiveTcl 8.5.9. As part of its library, it has
a file tk8.5. Would this be the appropriate download? Also, what
should I do next to properly install the tk library? Thanks.
 
D

Dd Dd

All right, I tried installing tk on the command line by entering "gem
install tk_as_gem", and I got the following:

ruby 1.9.2p0 (2010-08-18) [i386-mingw32]

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

C:/Users/Deepak/Ruby192/bin/ruby.exe extconf.rb
checking for ruby_native_thread_p() in ruby.h... yes
checking for rb_errinfo() in ruby.h... yes
checking for rb_safe_level() in ruby.h... yes
checking for struct RArray.ptr in ruby.h... no
checking for struct RArray.len in ruby.h... no
checking for tcl.h... no
checking for tcl.h in
/usr/local/include,/usr/pkg/include,/usr/include,/Tcl/incl
ude,/usr/local/include/tcl8.4,/usr/pkg/include/tcl8.4,/usr/include/tcl8.4,/Tcl/i
nclude/tcl8.4,/usr/local/include/tcl8.7,/usr/pkg/include/tcl8.7,/usr/include/tcl
8.7,/Tcl/include/tcl8.7,/usr/local/include/tcl8.6,/usr/pkg/include/tcl8.6,/usr/i
nclude/tcl8.6,/Tcl/include/tcl8.6,/usr/local/include/tcl8.5,/usr/pkg/include/tcl
8.5,/usr/include/tcl8.5,/Tcl/include/tcl8.5,/usr/local/include/tcl8.3,/usr/pkg/i
nclude/tcl8.3,/usr/include/tcl8.3,/Tcl/include/tcl8.3,/usr/local/include/tcl8.2,
/usr/pkg/include/tcl8.2,/usr/include/tcl8.2,/Tcl/include/tcl8.2,/usr/local/inclu
de/tcl8.1,/usr/pkg/include/tcl8.1,/usr/include/tcl8.1,/Tcl/include/tcl8.1,/usr/l
ocal/include/tcl8.0,/usr/pkg/include/tcl8.0,/usr/include/tcl8.0,/Tcl/include/tcl
8.0,/usr/local/include/tcl7.6,/usr/pkg/include/tcl7.6,/usr/include/tcl7.6,/Tcl/i
nclude/tcl7.6... no
checking for tk.h... no
checking for tk.h in
/usr/local/include,/usr/pkg/include,/usr/include,/Tcl/inclu
de,/usr/local/include/tk8.4,/usr/pkg/include/tk8.4,/usr/include/tk8.4,/Tcl/inclu
de/tk8.4,/usr/local/include/tk8.7,/usr/pkg/include/tk8.7,/usr/include/tk8.7,/Tcl
/include/tk8.7,/usr/local/include/tk8.6,/usr/pkg/include/tk8.6,/usr/include/tk8.
6,/Tcl/include/tk8.6,/usr/local/include/tk8.5,/usr/pkg/include/tk8.5,/usr/includ
e/tk8.5,/Tcl/include/tk8.5,/usr/local/include/tk8.4,/usr/pkg/include/tk8.4,/usr/
include/tk8.4,/Tcl/include/tk8.4,/usr/local/include/tk8.3,/usr/pkg/include/tk8.3
,/usr/include/tk8.3,/Tcl/include/tk8.3,/usr/local/include/tk8.2,/usr/pkg/include
/tk8.2,/usr/include/tk8.2,/Tcl/include/tk8.2,/usr/local/include/tk8.1,/usr/pkg/i
nclude/tk8.1,/usr/include/tk8.1,/Tcl/include/tk8.1,/usr/local/include/tk8.0,/usr
/pkg/include/tk8.0,/usr/include/tk8.0,/Tcl/include/tk8.0,/usr/local/include/tk4.
2,/usr/pkg/include/tk4.2,/usr/include/tk4.2,/Tcl/include/tk4.2... 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
--with-tcl-framework-header
--without-tcl-framework-header
--with-tk-framework-header
--without-tk-framework-header
--with-tcltk-framework
--without-tcltk-framework
--enable-tcltk-framework
--disable-tcltk-framework
--enable-mac-tcltk-framework
--disable-mac-tcltk-framework
--with-tk-dir
--without-tk-dir
--with-tk-include
--without-tk-include=${tk-dir}/include
--with-tk-lib
--without-tk-lib=${tk-dir}/lib
--with-tcl-dir
--without-tcl-dir
--with-tcl-include
--without-tcl-include=${tcl-dir}/include
--with-tcl-lib
--without-tcl-lib=${tcl-dir}/lib
--with-X11-dir
--without-X11-dir
--with-X11-include
--without-X11-include=${X11-dir}/include
--with-X11-lib
--without-X11-lib=${X11-dir}/lib
--with-tk-lib
--without-tk-lib
--with-tcl-lib
--without-tcl-lib
--with-X11-lib
--without-X11-lib
--with-tklib
--without-tklib
--with-tcllib
--without-tcllib
--enable-tcltk_stubs
--disable-tcltk_stubs
--with-tcltk_stubs
--without-tcltk_stubs
--with-tcltkversion
--without-tcltkversion
--with-X11
--without-X11


Gem files will remain installed in
C:/Users/Deepak/Ruby192/lib/ruby/gems/1.9.1/g
ems/tk_as_gem-0.1.0 for inspection.
Results logged to
C:/Users/Deepak/Ruby192/lib/ruby/gems/1.9.1/gems/tk_as_gem-0.1
0/ext/gem_make.out

Also, where do I look for the mkmf.log file? I'm not experienced with
this, and it's getting very frustrating. Any help would be appreciated.
Thanks.
 
D

Dd Dd

I know for a fact that tk is available; I downloaded it by entering "gem
fetch tk_as_gem" and it says it downloaded. The only problem is the
installation. It says that I may need configuration options; how do I
set those on the command line (what is the syntax). I'm wondering if I
should just uninstall Ruby 1.9.2 and install an earlier version
(pre-1.9) of Ruby.
 
P

Phillip Gawlowski

I know for a fact that tk is available; I downloaded it by entering "gem
fetch tk_as_gem" and it says it downloaded. =A0The only problem is the
installation. =A0It says that I may need configuration options; how do I
set those on the command line (what is the syntax). =A0I'm wondering if I
should just uninstall Ruby 1.9.2 and install an earlier version
(pre-1.9) of Ruby.

The same message advising you to do an install of TK as a gem also
advised you to get the Ruby DevKit.
--=20
Phillip Gawlowski

Though the folk I have met,
(Ah, how soon!) they forget
When I've moved on to some other place,
There may be one or two,
When I've played and passed through,
Who'll remember my song or my face.
 
G

Gordon Thiesfeld

[Note: parts of this message were removed to make it a legal post.]

I know for a fact that tk is available; I downloaded it by entering "gem
fetch tk_as_gem" and it says it downloaded. The only problem is the
installation. It says that I may need configuration options; how do I
set those on the command line (what is the syntax). I'm wondering if I
should just uninstall Ruby 1.9.2 and install an earlier version
(pre-1.9) of Ruby.
The project's readme lists some configuration options.

https://github.com/rdp/tk_as_gem

Hope that helps.

 

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,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top