rlane / ncursesw-ruby

Ruby bindings to the ncursesw library
GNU Lesser General Public License v2.1
15 stars 20 forks source link

Include ncurses from custom directory #5

Closed danmichaelo closed 9 years ago

danmichaelo commented 9 years ago

On Mac OS X 10.10.3

checking for unistd.h... yes
checking for locale.h... yes
checking for ncursesw/curses.h... no
checking for ncurses.h... yes
checking for wmove() in -lncursesw... no
checking for wmove() in -lpdcurses... no
*** extconf.rb failed ***

I guess the headers aren't bundled with Os X by default, so I tried brew install ncurses, and I now have

/usr/local/Cellar/ncurses/5.9/include/ncurses.h
/usr/local/Cellar/ncurses/5.9/include/ncursesw/ncurses.h

among with the rest of the library. Is there some way I can make gem install aware of the /usr/local/Cellar/ncurses/5.9/include/ directory?

Setting CFLAGS seems to have no effect:

CFLAGS="-I/usr/local/Cellar/ncurses/5.9/include/ -L/usr/local/Cellar/ncurses/5.9/lib" gem install ncursesw

When installing nokogiri, I could specify custom directories with gem install nokogiri -- --with-iconv-lib=/opt/local/lib --with-iconv-include=/opt/local/include/, but it doesn't seem like ncursesw provides options like --with-ncurses-include?

danmichaelo commented 9 years ago

By adding dir_config('ncurses') to extconf.rb, I could do

ruby extconf.rb -- --with-ncurses-dir=/usr/local/Cellar/ncurses/5.9

and got a little bit further:

checking for unistd.h... yes
checking for locale.h... yes
checking for ncursesw/curses.h... yes
checking for wmove() in -lncursesw... no
checking for wmove() in -lpdcurses... no
*** extconf.rb failed ***

So now ncursesw/curses.h was found, but installation still failed, and at the moment I have no idea what to look for or try… Is the version supported?

/usr/local/Cellar/ncurses/5.9/bin/ncurses5-config --version
5.9.20110404

From mkmf.log:

have_library: checking for wmove() in -lncursesw... -------------------- no

"xcrun clang -o conftest -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/universal-darwin14 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/backward -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0 -I. -I/usr/local/Cellar/ncurses/5.9/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT    -g -Os -pipe -DHAVE_GCC_SYNC_BUILTINS -g -Wformat -Werror=format-security -Waddress conftest.c  -L. -L/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib -L/usr/local/Cellar/ncurses/5.9/ -L. -L/usr/local/lib   -arch x86_64 -arch i386   -lruby.2.0.0 -lncursesw  -lpthread -ldl -lobjc "
conftest.c:5:57: error: use of undeclared identifier 'wmove'
int t(void) { void ((*volatile p)()); p = (void ((*)()))wmove; return 0; }
                                                        ^
1 error generated.
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: /*top*/
 4: extern int t(void);
 5: int t(void) { void ((*volatile p)()); p = (void ((*)()))wmove; return 0; }
 6: int main(int argc, char **argv)
 7: {
 8:   if (argc > 1000000) {
 9:     printf("%p", &t);
10:   }
11: 
12:   return 0;
13: }
/* end */
danmichaelo commented 9 years ago

Got it working by using Ruby 2.2.0 from Macbrew instead of the OS X bundled Ruby 2.0.0. But I still needed dir_config('ncurses') in extconf.rb so I could specify the custom location. Could this be added?

JuPlutonic commented 4 years ago

dir_config('ncurses') already in extconf.rb nothing is changed