Install ncurses for ruby โ€‹โ€‹on Windows

I am trying to install ncurses for ruby โ€‹โ€‹on windows. I have not installed ncurses on my computer yet. I thought that with the โ€œruby devkitโ€ that he asked would be enough, but now I am asked to specify the parameters ... I do not know what options to choose, or if I need to do / install other things to install the gem:

C:\Ruby193\Devkit>gem install ncurses -- --ruby=C:/Ruby193/bin/ruby --without-make-prog --without-opt-dir Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while... ERROR: Error installing ncurses: ERROR: Failed to build gem native extension. C:/Ruby193/bin/ruby.exe extconf.rb --ruby=C:/Ruby193/bin/ruby --without-make-prog --without-opt-dir C:/Ruby193/lib/ruby/1.9.1/shellwords.rb:35:in `shellsplit': undefined method `scan' for false:FalseClass (NoMethodError) from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:2216:in `<top (required)>' from C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from extconf.rb:22:in `<main>' Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/ncurses-0.9.1 for inspection. Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/ncurses-0.9.1/./gem_make.out 

WHAT IS PAIN, I just want to install this stone so that I can run this:

 require 'curses' cols = Curses.stdscr.maxx msg = "random_string" str = msg.center(msg.length + cols - msg.length - 5 - 3) puts "<!-- #{str}-->" 
+4
source share
6 answers

Updated Version:

  • Get ncurses (MinGW port): http://invisible-island.net/ncurses/
  • Put it in C: \ ncurses
  • gem install curses --platform=ruby -- --with-ncurses-dir="C:\ncurses"
  • Copy the contents of C: \ ncurses \ bin somewhere in your path.

C: \ ncurses can be any directory

+3
source

Update: It seems that SourceForge no longer uses the NCurses binaries for Windows. This answer is now outdated. Sorry (As of August 2015, the GNU NCurses page contains a new version of v6.0, which is newer than version 0.9.1 in my answer.)

I finally got this to work (years after I need it ...) without Cygwin, PDCurses, or manually creating the NCurses source. Instructions are available on my blog . For reference:

  • Download the latest NCurses (0.9.1) binaries from SourceForge .
  • Unzip the files somewhere on your computer.
  • Find out where Ruby is looking for libraries by running ruby -e 'puts $:'
  • Copy and paste ncurses.so and lib \ ncurses.rb from the NCurses directory to the directory you selected. Put them in the root directory.
  • Launch the NCurses-enabled app.

It works. Without PDCurses!

0
source

I managed to do this for ruby โ€‹โ€‹2.2, which by default does not come with curses, but it took me a while:

  • Download PDCurses from SourceForge ;
  • Unzip it;
  • Copy it to the folder where the ruby โ€‹โ€‹can see it. I'm not sure which one I used, I think I copied it to a few until it works. ruby -e 'puts $:' may help;
  • Install curses gem instal curses . If the previous step was incorrect, this will not be performed;
  • Done: D

This method did not work for other gems such as ffi-ncurses. Tip. Most curses functions come from the Window class , which has curses by default.

0
source

I successfully downloaded ncurses 0.9.1 binaries from sourceforge, so the library is still available.

Then I tried with both native Ruby and IronRuby 1.1.3

  • placing two files (ncurses.so ncurses.rb) in

    C: \ Ruby \ Ruby193 \ Lib \ Ruby \ 1.9.1

    gives an error with native Ruby

    The specified module was not found. - C: /Ruby/Ruby193/lib/ruby/1.9.1/ncurses.so (LoadError)

  • Placing them here (for IronRuby) C: \ Program Files (x86) \ IronRuby 1.1 \ Lib \ ruby โ€‹โ€‹\ 1.9.1

    gives

    The module is expected to contain an assembly manifest. (Exception from HRESULT: 0x80131018)

0
source

When gem is installed for curses lib; so first you need to install NCurses with your msys2

https://sourceforge.net/p/mingw-w64/wiki2/NCurses/

Download NCurses (v5.9 at time of writing): http://ftp.gnu.org/pub/gnu/ncurses/ in the source directory

Then unzip and into the MSYS shell:

./configure --host = x86_64-w64-mingw32 --enable-term-driver --enable-sp-funcs --prefix = / some / prefix

to do

make a check

make installation

then as indicated in the link: https://github.com/ruby/curses/issues/13

use --platform = ruby, - with-curses-include, - c-curses-lib flags with gem setting

0
source

Ruby ncurses gem requires ncurses to be installed on the machine. As far as I know, ncurses has not been ported to windows. So I donโ€™t think you are going to make this work.

There may be other ways to find out how wide the screen is on the windows, but I can't help it.

-1
source

Source: https://habr.com/ru/post/1440291/


All Articles