rb-gsl
rb-gsl copied to clipboard
Fails to build on Ruby 2.1
I don't have a ton of time to look into this (sorry!) and am not even sure where the canonical version of this gem lives (yours is the most accessible/maintained), but…
With Ruby 2.1 and a brew
-installed gsl
1.15, I get these errors (and many warnings, but ignoring those) installing the gem:
linalg.c:74:28: error: read-only variable is not assignable
RBASIC(omatrix)->klass = cgsl_matrix_LU;
~~~~~~~~~~~~~~~~~~~~~~ ^
linalg.c:695:28: error: read-only variable is not assignable
RBASIC(mdecomp)->klass = cgsl_matrix_QR;
~~~~~~~~~~~~~~~~~~~~~~ ^
linalg.c:707:28: error: read-only variable is not assignable
RBASIC(mdecomp)->klass = cgsl_matrix_LQ;
~~~~~~~~~~~~~~~~~~~~~~ ^
linalg.c:734:33: error: read-only variable is not assignable
RBASIC(argv[itmp])->klass = cgsl_vector_tau;
~~~~~~~~~~~~~~~~~~~~~~~~~ ^
linalg.c:743:33: error: read-only variable is not assignable
RBASIC(argv[itmp])->klass = cgsl_vector_tau;
~~~~~~~~~~~~~~~~~~~~~~~~~ ^
linalg.c:1631:23: error: read-only variable is not assignable
RBASIC(vA)->klass = cgsl_matrix_QRPT;
~~~~~~~~~~~~~~~~~ ^
linalg.c:1638:23: error: read-only variable is not assignable
RBASIC(vA)->klass = cgsl_matrix_PTLQ;
~~~~~~~~~~~~~~~~~ ^
7 errors generated.
make: *** [linalg.o] Error 1
AFAIK, Ruby 2.1 no longer allows assignment to klass
in this manner (it's now declared as const
). brianmario/escape_utils#48 appears to solve a similar problem in that codebase, so maybe the same approach could work here. I'd dig deeper into this, but I really just need a normal variable so I'll write my own Box-Muller in Ruby until the gsl
bindings support Ruby 2.1.
Unfortunately I don't have time to dig into it :(
FYI, facing this today, I came up with this ugly patch to fix it.
I could gem install 'rb-gsl' under ruby 2.1.1. rb-gsl is maintained by SciRuby https://github.com/SciRuby/rb-gsl