eclubb/ncurses-ruby

Compilation error on Alpine Linux

wallrj opened this issue · 1 comments

When I attempt to install ncurses-ruby in a ruby:2.4-alpine Docker container there is a compilation error.

See the following Python issues which report similar problem and a solution.

$ docker run ruby:2.4-alpine sh -c "apk --update add build-base ruby-dev ncurses-dev && gem install ncurses-ruby"
...
Building native extensions.  This could take a while...
ERROR:  Error installing ncurses-ruby:
	ERROR: Failed to build gem native extension.

    current directory: /usr/local/bundle/gems/ncurses-ruby-1.2.4/ext/ncurses
/usr/local/bin/ruby -r ./siteconf20170625-10-1wvefbh.rb extconf.rb
checking for unistd.h... yes
checking for ncurses.h... yes
checking for wmove() in -lncurses... yes
checking for newscr()... yes
checking for TABSIZE()... yes
checking for ESCDELAY()... yes
checking for keybound()... yes
checking for curses_version()... yes
checking for tigetstr()... yes
checking for getwin()... yes
checking for putwin()... yes
checking for ungetmouse()... yes
checking for mousemask()... yes
checking for wenclose()... yes
checking for mouseinterval()... yes
checking for wmouse_trafo()... yes
checking for mcprint()... yes
checking for has_key()... yes
checking for delscreen()... yes
checking for define_key()... yes
checking for keyok()... yes
checking for resizeterm()... yes
checking for use_default_colors()... yes
checking for use_extended_names()... yes
checking for wresize()... yes
checking for attr_on()... yes
checking for attr_off()... yes
checking for attr_set()... yes
checking for chgat()... yes
checking for color_set()... yes
checking for filter()... yes
checking for intrflush()... yes
checking for mvchgat()... yes
checking for mvhline()... yes
checking for mvvline()... yes
checking for mvwchgat()... yes
checking for mvwhline()... yes
checking for mvwvline()... yes
checking for noqiflush()... yes
checking for putp()... yes
checking for qiflush()... yes
checking for scr_dump()... yes
checking for scr_init()... yes
checking for scr_restore()... yes
checking for scr_set()... yes
checking for slk_attr_off()... yes
checking for slk_attr_on()... yes
checking for slk_attr()... yes
checking for slk_attr_set()... yes
checking for slk_color()... yes
checking for tigetflag()... yes
checking for tigetnum()... yes
checking for use_env()... yes
checking for vidattr()... yes
checking for vid_attr()... yes
checking for wattr_on()... yes
checking for wattr_off()... yes
checking for wattr_set()... yes
checking for wchgat()... yes
checking for wcolor_set()... yes
checking for getattrs()... yes
checking which debugging functions to wrap...
checking for _tracef()... no
checking for _tracedump()... no
checking for _nc_tracebits()... no
checking for _traceattr()... no
checking for _traceattr2()... no
checking for _tracechar()... no
checking for _tracechtype()... no
checking for _tracechtype2()... no
checking for _tracemouse()... no
checking for other functions that appeared after ncurses version 5.0...
checking for assume_default_colors()... yes
checking for attr_get()... yes
checking for the panel library...
checking for panel.h... yes
checking for panel_hidden() in -lpanel... yes
checking for the form library...
checking for form.h... yes
checking for new_form() in -lform... yes
checking for the menu library...
checking for menu.h... yes
checking for new_menu() in -lmenu... yes
creating Makefile

current directory: /usr/local/bundle/gems/ncurses-ruby-1.2.4/ext/ncurses
make "DESTDIR=" clean

current directory: /usr/local/bundle/gems/ncurses-ruby-1.2.4/ext/ncurses
make "DESTDIR="
compiling form_wrap.c
In file included from /usr/include/fortify/stdio.h:23:0,
                 from /usr/include/curses.h:164,
                 from /usr/include/form.h:39,
                 from form_wrap.h:26,
                 from form_wrap.c:30:
/usr/include/fortify/string.h:142:1: error: 'mempcpy' undeclared here (not in a function)
 _FORTIFY_FN(mempcpy) void *mempcpy(void *__d, const void *__s, size_t __n)
 ^
In file included from /usr/local/include/ruby-2.4.0/ruby/defines.h:120:0,
                 from /usr/local/include/ruby-2.4.0/ruby/ruby.h:36,
                 from /usr/local/include/ruby-2.4.0/ruby.h:33,
                 from form_wrap.h:27,
                 from form_wrap.c:30:
/usr/include/fortify/string.h: In function 'mempcpy':
/usr/include/fortify/string.h:149:9: error: called object '__orig_mempcpy' is not a function or function pointer
  return __orig_mempcpy(__d, __s, __n);
         ^
In file included from /usr/include/fortify/stdio.h:23:0,
                 from /usr/include/curses.h:164,
                 from /usr/include/form.h:39,
                 from form_wrap.h:26,
                 from form_wrap.c:30:
/usr/include/fortify/string.h:142:1: note: declared here
 _FORTIFY_FN(mempcpy) void *mempcpy(void *__d, const void *__s, size_t __n)
 ^
form_wrap.c: At top level:
cc1: warning: unrecognized command line option '-Wno-self-assign'
cc1: warning: unrecognized command line option '-Wno-constant-logical-operand'
cc1: warning: unrecognized command line option '-Wno-parentheses-equality'
cc1: warning: unrecognized command line option '-Wno-tautological-compare'
Makefile:241: recipe for target 'form_wrap.o' failed
make: *** [form_wrap.o] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/local/bundle/gems/ncurses-ruby-1.2.4 for inspection.
Results logged to /usr/local/bundle/extensions/x86_64-linux/2.4.0/ncurses-ruby-1.2.4/gem_make.out

@wallrj Thanks for the report. I don't have time to look into the issue, and probably won't for quite a while. PRs are welcome.