Author Topic: Trouble installing ncurses in Ruby...  (Read 12147 times)

Happy Corner

  • Newcomer
  • Posts: 5
  • Karma: +0/-0
    • View Profile
    • Email
Trouble installing ncurses in Ruby...
« on: December 20, 2010, 07:35:41 PM »
Since a lot of roguelikes use curses/ncurses, I figured it's more than good enough for me, too. Since I plan to keep things at the ASCII level, it sounds perfect.

The problem is, I'm using Ruby 1.9.2 with the DevKit (on Windows 7), and try as I might, I can't get the ncurses gem to install. I'm greeted with this error message:

Quote
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:/Ruby192/bin/ruby.exe extconf.rb
checking for unistd.h... yes
checking for ncurses.h... no
checking for ncurses/curses.h... no
checking for curses.h... no
extconf.rb:35:in `<main>': ncurses header file not found (RuntimeError)


Gem files will remain installed in C:/Ruby192/lib/ruby/gems/1.9.1/gems/ncurses-0.9.1 for inspection.
Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/gems/ncurses-0.9.1/gem_make.out

I confess that I'm still a noob programmer, but I'd actually be relieved if the problem is something totally blindingly obvious. Any help you can provide would be greatly appreciated!

« Last Edit: December 20, 2010, 10:37:34 PM by Happy Corner »

Bear

  • Rogueliker
  • ***
  • Posts: 308
  • Karma: +0/-0
    • View Profile
Re: Trouble installing ncurses in Ruby...
« Reply #1 on: December 21, 2010, 09:42:17 AM »
I suspect your Ruby has not been built correctly to use ncurses.  It's surprisingly difficult to get right, especially if it uses wide-character functions.  Someone probably set build options or includes or defines that broke it when compiling Ruby.

Here's a checklist of what it takes to get a C or C++ program working with ncurses wide character functions. This doesn't apply to your Ruby code, of course; it applies to the runtime that you're trying to use to run your code.

http://roguebasin.roguelikedevelopment.org/index.php?title=Ncursesw


elwin

  • Rogueliker
  • ***
  • Posts: 96
  • Karma: +0/-0
    • View Profile
    • Roguelike Gallery
Re: Trouble installing ncurses in Ruby...
« Reply #2 on: December 21, 2010, 05:05:55 PM »
It looks like the build can't find your ncurses installation.  I think the gem doesn't actually contain ncurses, which is a C library, but just allows you to use the library from Ruby code.  So you need to have the library and the ncurses.h header already installed, and the gem installer needs to be able to find them.

I'm not really sure how to do that on Windows, but this article might help.
Roguelike Gallery: play Rogue online.  SSH or in browser.

Happy Corner

  • Newcomer
  • Posts: 5
  • Karma: +0/-0
    • View Profile
    • Email
Re: Trouble installing ncurses in Ruby...
« Reply #3 on: December 23, 2010, 10:23:08 PM »
I'm not really sure how to do that on Windows, but this article might help.

That's actually where I started. Maybe I did something wrong, but the instructions on the ncurses section there totally didn't work.

I suspect your Ruby has not been built correctly to use ncurses.  It's surprisingly difficult to get right, especially if it uses wide-character functions.  Someone probably set build options or includes or defines that broke it when compiling Ruby.

(sighs) I was afraid of something like this. I'll keep fiddling with it for a bit after reading that page, but it's really starting to look like I'd be better off just using another library. Not the end of the world, if it comes to that.

Thank you again for your advice (both of you!).

stu

  • Rogueliker
  • ***
  • Posts: 138
  • Karma: +0/-0
  • Moop!
    • View Profile
    • Stu's Rusty Bucket
Re: Trouble installing ncurses in Ruby...
« Reply #4 on: December 24, 2010, 02:11:00 PM »
since its a windows install it needs pdcurses but wants ncurses so your SOL.

your ruby install is fine, but the gem thinks its being built on nix, and does not take into account that it has pdcurses on windows instead.
--/\-[ Stu ]-/\--

Bear

  • Rogueliker
  • ***
  • Posts: 308
  • Karma: +0/-0
    • View Profile
Re: Trouble installing ncurses in Ruby...
« Reply #5 on: January 01, 2011, 03:51:48 PM »
Oh!  You're building on a Windows box!  I'm so sorry!

I didn't realize that at first.

Of course ncurses/ncursesw won't work there, and of course you don't have it installed; it's a unix library.  You need to configure for pdcurses or something similar instead. 


kipar

  • Rogueliker
  • ***
  • Posts: 105
  • Karma: +0/-0
    • View Profile
    • Email
Re: Trouble installing ncurses in Ruby...
« Reply #6 on: March 22, 2011, 04:32:16 PM »
Roguebasin page mentions that ncurses support both unix and windows (it uses pdcurses dll in windows).

There is a precompiled ncurses package for Ruby 1.8 at ncurses-ruby.berlios.de/ and it works under windows fine.
The problem is that there is no same precompiled package for Ruby 1.9 and I can't build it from source with DevKit (it fails with strange errors, not trivial 'header not found' in the first post but much stranger ones).

So I must use Ruby 1.8 (which is relatively slow) or use 'curses' module instead of ncurses (it works, but without 'keypad' function i have no idea how to process special keys (such as arrows)). Are there any other solutions?