ruby / curses

Ruby binding for curses, ncurses, and PDCurses. Formerly part of the ruby standard library.
Other
297 stars 34 forks source link

Compiling curses on Fedora 28 with ncurses 6.1 #41

Closed tadman closed 3 years ago

tadman commented 6 years ago

When installing curses the extconf.rb configuration crashes out on checking for convertible type of chtype:

checking for tgetent() in -ltinfo... yes
checking for ncursesw/curses.h... yes
checking for initscr() in -lncursesw... yes
header: ncursesw/curses.h
library: ncursesw
checking for beep()... yes
checking for bkgd()... yes
checking for bkgdset()... yes
checking for curs_set()... yes
checking for deleteln()... yes
checking for doupdate()... yes
checking for flash()... yes
checking for getbkgd()... yes
checking for getnstr()... yes
checking for init()... no
checking for init in ncursesw/curses.h... no
checking for isendwin()... yes
checking for keyname()... yes
checking for keypad()... yes
checking for resizeterm()... yes
checking for scrl()... yes
checking for set()... no
checking for set in ncursesw/curses.h... no
checking for setscrreg()... yes
checking for ungetch()... yes
checking for addnwstr()... yes
checking for wattroff()... yes
checking for wattron()... yes
checking for wattrset()... yes
checking for wbkgd()... yes
checking for wbkgdset()... yes
checking for wdeleteln()... yes
checking for wgetnstr()... yes
checking for wresize()... yes
checking for wscrl()... yes
checking for wsetscrreg()... yes
checking for werase()... yes
checking for redrawwin()... yes
checking for waddnwstr()... yes
checking for touchwin()... yes
checking for untouchwin()... yes
checking for wtouchln()... yes
checking for is_linetouched()... yes
checking for is_wintouched()... yes
checking for def_prog_mode()... yes
checking for reset_prog_mode()... yes
checking for timeout()... yes
checking for wtimeout()... yes
checking for nodelay()... yes
checking for init_color()... yes
checking for wcolor_set()... yes
checking for use_default_colors()... yes
checking for assume_default_colors()... yes
checking for newpad()... yes
checking for unget_wch()... yes
checking for get_wch()... yes
checking for wget_wch()... yes
checking for PDC_get_key_modifiers()... no
checking for PDC_get_key_modifiers in ncursesw/curses.h... no
checking for convertible type of chtype... failed
*** ext/curses/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.

This is with RVM-built Ruby 2.4.1 on both Fedora 28 (ncurses 6.1) and Fedora 26 (ncurses 6.0) where the 6.1 version fails on the chtype check, but the 6.0 version is fine (unsigned int).

This pertains to the line in extconf.rb:

 convertible_int('chtype', [["#undef MOUSE_MOVED\n"]]+curses) or abort

Strangely the definition for chtype hasn't changed:

#if 1 && defined(_LP64)
typedef unsigned chtype;
typedef unsigned mmask_t;
#else
typedef uint32_t chtype;
typedef uint32_t mmask_t;
#endif

It's not clear why convertible_int can't detect the type.

tadman commented 6 years ago

Inexplicably this compiles just fine with Ruby 2.5.0, so that's a possible solution for anyone facing this problem.

shugo commented 5 years ago

@tadman Could you show me mkmf.log?

tadman commented 5 years ago

I'll have to set up a build environment to reproduce this, but Ruby < 2.5 seemed to have this issue consistently.

shugo commented 3 years ago

Ruby 2.4 is EOL, so I close this issue.

dorianmariecom commented 2 years ago

I'm having the same issue

irb(main):002:0> convertible_int('chtype', [["#undef MOUSE_MOVED\n"]]+curses)
checking for convertible type of chtype... failed
ruby -v
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin21]

And in mkmf.log:

DYLD_FALLBACK_LIBRARY_PATH=.:/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/lib "clang -I/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/include/ruby-3.1.0/arm64-darwin21 -I/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/include/ruby-3.1.0/ruby/backward -I/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/include/ruby-3.1.0 -I. -I/Users/dorianmariefr/.asdf/installs/ruby/3.1.2/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -Wundef  -fno-common -pipe  -Werror -c conftest.c"
error: unknown warning option '-Wno-cast-function-type'; did you mean '-Wno-bad-function-cast'? [-Werror,-Wunknown-warning-option]
checked program was:
/* begin */
 1: #include "ruby.h"
 2:·
 3: #undef MOUSE_MOVED
 4:·
 5: #include <ncurses.h>
 6:·
 7: typedef chtype rbcv_typedef_;
 8:·
 9: extern rbcv_typedef_ foo();
10: extern unsigned long long foo();
/* end */

--------------------