Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby GSL on OS X

Tags:

ruby

I am trying to install Ruby GSL on OS X 10.9. I am using Ruby 2.0.0 installed using RVM. According to its site, I need GSL installed first. With that, I used Homebrew to install GSL (brew install gsl). Next, I did gem install gsl, but was given this error message:

compiling fft.c
fft.c:270:60: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
  for (i = 0; i < table->nf; i++) gsl_vector_int_set(v, i, table->factor[i]);
                              ~~~~~~~~~~~~~~~~~~       ^~~~~~~~~~~~~~~~
fft.c:614:18: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
  shape[0] = n;
           ~ ^
fft.c:706:18: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
  shape[0] = n;
           ~ ^
fft.c:773:18: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
  shape[0] = n;
           ~ ^
fft.c:910:48: error: use of undeclared identifier 'forward'
  rb_define_const(mgsl_fft, "Forward", INT2FIX(forward));
                                           ^
/Users/yihangho/.rvm/rubies/ruby-2.0.0-p353/include/ruby-2.0.0/ruby/ruby.h:241:45: note: expanded from macro 'INT2FIX'
#define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
                                        ^
fft.c:911:48: error: use of undeclared identifier 'forward'
  rb_define_const(mgsl_fft, "FORWARD", INT2FIX(forward));
                                           ^
/Users/yihangho/.rvm/rubies/ruby-2.0.0-p353/include/ruby-2.0.0/ruby/ruby.h:241:45: note: expanded from macro 'INT2FIX'
#define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
                                        ^
fft.c:912:49: error: use of undeclared identifier 'backward'
  rb_define_const(mgsl_fft, "Backward", INT2FIX(backward));
                                            ^
/Users/yihangho/.rvm/rubies/ruby-2.0.0-p353/include/ruby-2.0.0/ruby/ruby.h:241:45: note: expanded from macro 'INT2FIX'
#define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
                                        ^
fft.c:913:49: error: use of undeclared identifier 'backward'
  rb_define_const(mgsl_fft, "BACKWARD", INT2FIX(backward));
                                            ^
/Users/yihangho/.rvm/rubies/ruby-2.0.0-p353/include/ruby-2.0.0/ruby/ruby.h:241:45: note: expanded from macro 'INT2FIX'
#define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
                                        ^
4 warnings and 4 errors generated.
make: *** [fft.o] Error 1

Any idea how to fix this?

like image 228
yihangho Avatar asked Dec 04 '13 22:12

yihangho


1 Answers

Recent versions of GSL no longer include the enums backward and forward, replacing them with gsl_fft_forward and gsl_fft_backward, and gsl_wavelet_forward and gsl_wavelet_backward.

Try applying this patch, which replaces the old enums with the new: https://github.com/mvz/rb-gsl-nmatrix/commit/fe7643cd3026690f7de527b2a220c24330a85018

like image 112
Matijs van Zuijlen Avatar answered Nov 11 '22 21:11

Matijs van Zuijlen