Can't get Ruby programs to work from Command Prompt

Discussion in 'Ruby' started by Dd Dd, Nov 15, 2010.

  1. Dd Dd

    Dd Dd Guest

    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.

    --
    Posted via http://www.ruby-forum.com/.
     
    Dd Dd, Nov 15, 2010
    #1
    1. Advertising

  2. Dd Dd

    Lark Work Guest

    Lark Work, Nov 15, 2010
    #2
    1. Advertising

  3. Dd Dd

    Quintus Guest

    -----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-----
     
    Quintus, Nov 15, 2010
    #3
  4. Dd Dd

    Luis Lavena Guest

    On Nov 15, 6:58 am, Quintus <> wrote:
    >
    > 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/

    --
    Luis Lavena
     
    Luis Lavena, Nov 15, 2010
    #4
  5. Dd Dd

    Dd Dd Guest

    Dd Dd, Nov 16, 2010
    #5
  6. Dd Dd

    Dd Dd Guest

    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.

    --
    Posted via http://www.ruby-forum.com/.
     
    Dd Dd, Nov 16, 2010
    #6
  7. Dd Dd

    Dd Dd Guest

    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.

    --
    Posted via http://www.ruby-forum.com/.
     
    Dd Dd, Nov 17, 2010
    #7
  8. Dd Dd

    Dd Dd Guest

    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.

    --
    Posted via http://www.ruby-forum.com/.
     
    Dd Dd, Nov 17, 2010
    #8
  9. On Wed, Nov 17, 2010 at 12:23 PM, Dd Dd <> wrote:
    > 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.
     
    Phillip Gawlowski, Nov 17, 2010
    #9
  10. [Note: parts of this message were removed to make it a legal post.]

    On Wed, Nov 17, 2010 at 5:23 AM, Dd Dd <> wrote:

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


    > --
    > Posted via http://www.ruby-forum.com/.
    >
    >
     
    Gordon Thiesfeld, Nov 17, 2010
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. chrisdude911
    Replies:
    10
    Views:
    135,513
    srk289
    Mar 10, 2009
  2. judith
    Replies:
    9
    Views:
    304
    judith
    Nov 6, 2006
  3. Albert
    Replies:
    6
    Views:
    369
  4. gaurav kashyap
    Replies:
    2
    Views:
    634
    gaurav kashyap
    Oct 30, 2008
  5. Brad Winborg
    Replies:
    5
    Views:
    153
    Brad Winborg
    Mar 1, 2009
Loading...

Share This Page