ruby / curses

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

Newest curses fails to build on macOS Mojave, with ruby 2.6.2. #48

Closed chdiza closed 5 years ago

chdiza commented 5 years ago

After a gem update, I'm suddenly seeing this build failure:

current directory: /opt/slangs/rb/mygems/gems/curses-1.3.0/ext/curses
make "DESTDIR="
compiling curses.c
curses.c:218:1: warning: function 'no_window' could be declared with attribute 'noreturn' [-Wmissing-noreturn]
{
^
curses.c:244:63: error: invalid application of 'sizeof' to an incomplete type 'WINDOW' (aka 'struct _win_st')
    if (winp->window && winp->window != stdscr) size += sizeof(*winp->window);
                                                              ^~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/curses.h:322:16: note: forward declaration of 'struct _win_st'
typedef struct _win_st WINDOW;
               ^
1 warning and 1 error generated.
make: *** [curses.o] Error 1

make failed, exit code 2

This is on macOS 10.14.4. with Xcode 10.2, and the operative ruby is version 2.6.2 that I built and installed myself. The previous versions of the curses gem built just fine.

chdiza commented 5 years ago

Bisection shows:

d2b5c10dd22bd59f3dd71474b1db53785bbb3748 is the first bad commit
commit d2b5c10dd22bd59f3dd71474b1db53785bbb3748
Author: Shugo Maeda <shugo@ruby-lang.org>
Date:   Mon Apr 8 22:14:47 2019 +0900

    Add Curses::Form and Curses::Field
hsbt commented 5 years ago

I did reproduce it with Ruby 2.7.0-dev.

taca commented 5 years ago

Some curses implements WINDOW as opaque data, so it may not be dereferenced.

shugo commented 5 years ago

Sorry for inconvenience. I'll fix it in the same way as DBM_SIZEOF_DBM of ext/dbm.

shugo commented 5 years ago

I've fixed it in #49. Could someone try it on macOS?

chdiza commented 5 years ago

I just tried the fix. Here's what I did. I applied the patch for that PR to my clone and did bundle; rake compile.

It appears to have compiled but it spews some warnings:

compiling ../../../../ext/curses/curses.c
../../../../ext/curses/curses.c:218:1: warning: function 'no_window' could be
      declared with attribute 'noreturn' [-Wmissing-noreturn]
{
^
../../../../ext/curses/curses.c:1444:1: warning: function 'no_mevent' could be
      declared with attribute 'noreturn' [-Wmissing-noreturn]
{
^
../../../../ext/curses/curses.c:3711:1: warning: function 'no_field' could be
      declared with attribute 'noreturn' [-Wmissing-noreturn]
{
^
../../../../ext/curses/curses.c:4157:1: warning: function 'no_form' could be
      declared with attribute 'noreturn' [-Wmissing-noreturn]
{
^
4 warnings generated.
shugo commented 5 years ago

Thank you I've fixed it.

chdiza commented 5 years ago

Great, thanks!