Closed Try2Code closed 8 years ago
forgot to mention: arch linux, 64bit
@mrkn @mohawkjohn any idea why this failure is happening?
Including nmatrix_config.h resolves this problem, I think.
In rb-gsl? Let me check..
Fixed in https://github.com/SciRuby/rb-gsl/commit/c337d2f04dacf9339b4d11a7753f8600be095965
New version released too. Thank you @mrkn
installation now works but usage gives a superclass mismatch
see https://gist.github.com/Try2Code/fefbaf2bfe52ac9404eaecdf84bed660#file-gistfile1-txt
This is weird. It's working on my computer:
➜ ~ export NMATRIX=1
➜ ~ gem install gsl
Fetching: gsl-2.1.0.1.gem (100%)
Building native extensions. This could take a while...
gsl can be installed with or without narray support. Please install
narray before and reinstall gsl if it is missing.
gsl is also now compatible with NMatrix. Please install nmatrix before
installing gsl.
Successfully installed gsl-2.1.0.1
Parsing documentation for gsl-2.1.0.1
Installing ri documentation for gsl-2.1.0.1
Done installing documentation for gsl after 8 seconds
1 gem installed
➜ ~ gem list | grep nmatrix
nmatrix (0.2.1, 0.2.0)
➜ ~ irb
2.3.0 :001 > require 'gsl'
=> true
2.3.0 :002 > q=GSL::Vector.alloc(1,2,3)
=> GSL::Vector
[ 1.000e+00 2.000e+00 3.000e+00 ]
2.3.0 :003 > q.to_nm
=> #<NMatrix:0x950478c shape:[3] dtype:float64 stype:dense>
Can you tell us your detailed system config? Also, is it possible that some script that you've written has superclassed NMatrix?
I never used nmatrix before, I just came across it because the ruby-netcdf (narray-based) did not work anymore. I had superclass mismatch problems with narray/nvector.
anyway... I removed all my local gems and started from scratch with nmatrix, its dependencies and rb-gsl on top if (just the way you did above)
-->> no superclass issue anymore
BUT
as soon as I install the narray gem, its there
ram@luthien:~/src/external/rb-gsl gem list | grep -E 'n(array|matri)'
narray (0.6.1.2)
nmatrix (0.2.1)
ram@luthien:~/src/external/rb-gsl irb
>> require 'gsl'
TypeError: superclass mismatch for class NMatrix
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/ram/.gem/ruby/2.3.0/gems/nmatrix-0.2.1/lib/nmatrix/nmatrix.rb:38:in `<top (required)>'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `require'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `rescue in require'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
from /home/ram/.gem/ruby/2.3.0/gems/gsl-2.1.0.1/lib/gsl.rb:7:in `<top (required)>'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `require'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `rescue in require'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
from (irb):1
from /bin/irb:11:in `<main>'
>> exit
just for the record
ram@luthien:~/src/external/rb-gsl gem list -l [21:43:57|16-05-11]
*** LOCAL GEMS ***
backports (3.6.8)
bigdecimal (1.2.8)
bundler (1.12.3)
coderay (1.1.0)
diff-lcs (1.2.5)
executable-hooks (1.3.2)
gsl (2.1.0.1)
io-console (0.4.5)
json (1.8.3)
method_source (0.8.2)
narray (0.6.1.2)
nmatrix (0.2.1)
packable (1.3.8)
pry (0.10.3)
psych (2.0.17)
rake (10.4.2)
rake-compiler (0.9.5)
rdoc (4.2.1)
rspec (2.99.0)
rspec-core (2.99.2)
rspec-expectations (2.99.2)
rspec-longrun (1.0.1)
rspec-mocks (2.99.4)
slop (3.6.0)
wirble (0.1.3)
ram@luthien:~/src/external/rb-gsl gem env [21:45:50|16-05-11]
RubyGems Environment:
- RUBYGEMS VERSION: 2.5.1
- RUBY VERSION: 2.3.1 (2016-04-26 patchlevel 112) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/lib/ruby/gems/2.3.0
- USER INSTALLATION DIRECTORY: /home/ram/.gem/ruby/2.3.0
- RUBY EXECUTABLE: /usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- SPEC CACHE DIRECTORY: /home/ram/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/lib/ruby/gems/2.3.0
- /home/ram/.gem/ruby/2.3.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--user-install"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /home/ram/perl5/bin
- /bin
- /home/ram/.local/bin
- /usr/pkg/bin
- /usr/pkg/sbin
- /bin
- /bin
- /home/ram/local/bin
- /home/ram/.gem/ruby/2.2.0/bin
- /opt/anaconda/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/bin
- /usr/lib/jvm/default/bin
- /usr/bin/site_perl
- /usr/bin/vendor_perl
- /usr/bin/core_perl
- /home/ram/.rvm/bin
The same results when I use the sciruby/narray package instead of the the official narray
The problem is that narray is superclassing the NMatrix class, and since there's a require 'narray'
in rb-gsl it's calling that code.
Hold on I think I have a fix for this.
OK I've pushed a change to master branch which should fix this. Could you please pull the latest master, install from there and verify it? I'll release a new version once you're sure it works.
It does not change - still the same superclass error. no matter if i use the narray or the narray-nmatrix gem.
Isn't this a classic name collision? There are multiple narray-like implementations around all with the same name. this has to lead to errors like this, hasn't it?
Let's call NMatrix NuMatrix and the related NArray NuArray, so no interference masa16's implementations. As long as there is no unified development for this functionality, there have to be different names for different things IMO. This allows to change things and possible merge development in a controlled way.
Another point is the situation wrt SciRuby as a whole: After a successful installation of the sciruby-full gem I'd expect all gems:
I know this requires some closer corporation and I've absolutely no idea, how this is currently done withing the SciRuby developers. So I'm just guessing here ....
If you need help regarding testing or coding, let me know. I still want this to work
cheers ralf
Ok just one more time follow this procedure:
gem uninstall narray nmatrix rb-gsl gsl
export NMATRIX=1
gem install narray nmatrix
rake install
.I think the problem is that the NMATRIX=1
environment variable in your case was not set. Make sure that the NARRAY
env variable is NOT set.
And yes, you're right about the namespace collisions.
Worked for me:
➜ rb-gsl git:(master) gem install narray nmatrix
Fetching: narray-0.6.1.2.gem (100%)
Building native extensions. This could take a while...
Successfully installed narray-0.6.1.2
Parsing documentation for narray-0.6.1.2
Installing ri documentation for narray-0.6.1.2
Done installing documentation for narray after 1 seconds
Fetching: nmatrix-0.2.1.gem (100%)
Building native extensions. This could take a while...
***********************************************************
Welcome to SciRuby: Tools for Scientific Computing in Ruby!
NMatrix requires a C compiler, and has been tested only
with GCC 4.6+. We are happy to accept contributions
which improve the portability of this project.
If you are upgrading from NMatrix 0.1.0 and rely on
ATLAS features, please check the README.
Faster matrix calculations and more advanced linear
algebra features are available by installing either
the nmatrix-atlas or nmatrix-lapacke plugins.
More explicit instructions for NMatrix and SciRuby should
be available on the SciRuby website, sciruby.com, or
through our mailing list (which can be found on our web-
site).
Thanks for trying out NMatrix! Happy coding!
***********************************************************
Successfully installed nmatrix-0.2.1
Parsing documentation for nmatrix-0.2.1
Installing ri documentation for nmatrix-0.2.1
Done installing documentation for nmatrix after 4 seconds
2 gems installed
➜ rb-gsl git:(master) export NMATRIX=1
➜ rb-gsl git:(master) rake install
gsl 2.1.0.1 built to pkg/gsl-2.1.0.1.gem.
gsl (2.1.0.1) installed.
➜ rb-gsl git:(master) irb
2.3.0 :001 > require 'gsl'
=> true
Here it is:
ram@luthien:~/src/external/nmatrix gem uninstall narray nmatrix rb-gsl gsl [16:09:00|16-05-12]
Successfully uninstalled gsl-2.1.0.1
Successfully uninstalled nmatrix-0.2.1
Successfully uninstalled narray-0.6.1.2
ram@luthien:~/src/external/nmatrix gem list [16:09:16|16-05-12]
*** LOCAL GEMS ***
backports (3.6.8)
bigdecimal (1.2.8)
bundler (1.12.3)
coderay (1.1.0)
diff-lcs (1.2.5)
executable-hooks (1.3.2)
io-console (0.4.5)
json (1.8.3)
method_source (0.8.2)
packable (1.3.8)
pry (0.10.3)
psych (2.0.17)
rake (10.4.2)
rake-compiler (0.9.5)
rdoc (4.2.1)
rspec (2.99.0)
rspec-core (2.99.2)
rspec-expectations (2.99.2)
rspec-longrun (1.0.1)
rspec-mocks (2.99.4)
slop (3.6.0)
wirble (0.1.3)
ram@luthien:~ export NMATRIX=1 [16:10:16|16-05-12]
ram@luthien:~ gem install narray nmatrix [16:10:24|16-05-12]
Fetching: narray-0.6.1.2.gem (100%)
WARNING: You don't have /home/ram/.gem/ruby/2.3.0/bin in your PATH,
gem executables will not run.
Building native extensions. This could take a while...
Successfully installed narray-0.6.1.2
Parsing documentation for narray-0.6.1.2
Installing ri documentation for narray-0.6.1.2
Done installing documentation for narray after 0 seconds
Fetching: nmatrix-0.2.1.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing nmatrix:
ERROR: Failed to build gem native extension.
current directory: /home/ram/.gem/ruby/2.3.0/gems/nmatrix-0.2.1/ext/nmatrix
/usr/bin/ruby -r ./siteconf20160512-15429-kay4hb.rb extconf.rb
using C++ standard... c++11
g++ reports version... 6.1.1
checking for rb_array_const_ptr() in ruby.h... yes
checking for FIX_CONST_VALUE_PTR in ruby.h... yes
checking for RARRAY_CONST_PTR in ruby.h... yes
checking for RARRAY_AREF in ruby.h... yes
creating nmatrix_config.h
creating Makefile
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/ram/.gem/ruby/2.3.0/extensions/x86_64-linux/2.3.0/nmatrix-0.2.1/mkmf.log
current directory: /home/ram/.gem/ruby/2.3.0/gems/nmatrix-0.2.1/ext/nmatrix
make "DESTDIR=" clean
current directory: /home/ram/.gem/ruby/2.3.0/gems/nmatrix-0.2.1/ext/nmatrix
make "DESTDIR="
compiling nmatrix.cpp
In file included from nmatrix.cpp:45:0:
math/math.h: In function ‘I nm::math::smmp_sort::median(I, I, I)’:
math/math.h:335:7: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
if (a < c) return c; // a c b
^~
math/math.h:336:18: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
return a; // c a b
^~~~~~
math/math.h:340:7: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
if (b < c) return c; // b c a
^~
math/math.h:341:18: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
return b; // c b a
^~~~~~
In file included from nmatrix.cpp:283:0:
ruby_nmatrix.c: In function ‘VALUE nm_reshape_bang(VALUE, VALUE)’:
ruby_nmatrix.c:1102:11: warning: unused variable ‘elem’ [-Wunused-variable]
void* elem = s->elements;
^~~~
ruby_nmatrix.c: In function ‘VALUE nm_init_new_version(int, VALUE*, VALUE)’:
ruby_nmatrix.c:1299:60: warning: ‘init’ may be used uninitialized in this function [-Wmaybe-uninitialized]
nm_unregister_values(reinterpret_cast<VALUE*>(init), 1);
^
compiling ruby_constants.cpp
compiling data/data.cpp
compiling util/io.cpp
compiling math.cpp
In file included from math/getrf.h:63:0,
from math.cpp:145:
./math/math.h: In function ‘I nm::math::smmp_sort::median(I, I, I)’:
./math/math.h:335:7: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
if (a < c) return c; // a c b
^~
./math/math.h:336:18: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
return a; // c a b
^~~~~~
./math/math.h:340:7: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
if (b < c) return c; // b c a
^~
./math/math.h:341:18: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
return b; // c b a
^~~~~~
In file included from math.cpp:137:0:
math/imax.h: In instantiation of ‘int nm::math::imax(int, const DType*, int) [with DType = nm::Complex<float>]’:
math/imax.h:74:21: required from ‘int nm::math::cblas_imax(int, const void*, int) [with DType = nm::Complex<float>]’
math.cpp:791:3: required from here
math/imax.h:49:15: error: call of overloaded ‘abs(const nm::Complex<float>&)’ is ambiguous
dmax = abs(x[0]);
~~~^~~~~~
In file included from /usr/include/c++/6.1.1/cstdlib:75:0,
from /usr/include/c++/6.1.1/stdlib.h:36,
from /usr/include/ruby-2.3.0/ruby/defines.h:34,
from /usr/include/ruby-2.3.0/ruby/ruby.h:36,
from /usr/include/ruby-2.3.0/ruby.h:33,
from math.cpp:129:
/usr/include/stdlib.h:774:12: note: candidate: int abs(int)
extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
^~~
In file included from /usr/include/c++/6.1.1/stdlib.h:36:0,
from /usr/include/ruby-2.3.0/ruby/defines.h:34,
from /usr/include/ruby-2.3.0/ruby/ruby.h:36,
from /usr/include/ruby-2.3.0/ruby.h:33,
from math.cpp:129:
/usr/include/c++/6.1.1/cstdlib:180:3: note: candidate: long long int std::abs(long long int)
abs(long long __x) { return __builtin_llabs (__x); }
^~~
/usr/include/c++/6.1.1/cstdlib:172:3: note: candidate: long int std::abs(long int)
abs(long __i) { return __builtin_labs(__i); }
^~~
In file included from /usr/include/c++/6.1.1/math.h:36:0,
from /usr/include/ruby-2.3.0/ruby/missing.h:23,
from /usr/include/ruby-2.3.0/ruby/defines.h:68,
from /usr/include/ruby-2.3.0/ruby/ruby.h:36,
from /usr/include/ruby-2.3.0/ruby.h:33,
from math.cpp:129:
/usr/include/c++/6.1.1/cmath:95:3: note: candidate: constexpr long double std::abs(long double)
abs(long double __x)
^~~
/usr/include/c++/6.1.1/cmath:91:3: note: candidate: constexpr float std::abs(float)
abs(float __x)
^~~
/usr/include/c++/6.1.1/cmath:85:3: note: candidate: constexpr double std::abs(double)
abs(double __x)
^~~
In file included from math.cpp:137:0:
math/imax.h: In instantiation of ‘int nm::math::imax(int, const DType*, int) [with DType = nm::Complex<double>]’:
math/imax.h:74:21: required from ‘int nm::math::cblas_imax(int, const void*, int) [with DType = nm::Complex<double>]’
math.cpp:791:3: required from here
math/imax.h:49:15: error: call of overloaded ‘abs(const nm::Complex<double>&)’ is ambiguous
dmax = abs(x[0]);
~~~^~~~~~
In file included from /usr/include/c++/6.1.1/cstdlib:75:0,
from /usr/include/c++/6.1.1/stdlib.h:36,
from /usr/include/ruby-2.3.0/ruby/defines.h:34,
from /usr/include/ruby-2.3.0/ruby/ruby.h:36,
from /usr/include/ruby-2.3.0/ruby.h:33,
from math.cpp:129:
/usr/include/stdlib.h:774:12: note: candidate: int abs(int)
extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
^~~
In file included from /usr/include/c++/6.1.1/stdlib.h:36:0,
from /usr/include/ruby-2.3.0/ruby/defines.h:34,
from /usr/include/ruby-2.3.0/ruby/ruby.h:36,
from /usr/include/ruby-2.3.0/ruby.h:33,
from math.cpp:129:
/usr/include/c++/6.1.1/cstdlib:180:3: note: candidate: long long int std::abs(long long int)
abs(long long __x) { return __builtin_llabs (__x); }
^~~
/usr/include/c++/6.1.1/cstdlib:172:3: note: candidate: long int std::abs(long int)
abs(long __i) { return __builtin_labs(__i); }
^~~
In file included from /usr/include/c++/6.1.1/math.h:36:0,
from /usr/include/ruby-2.3.0/ruby/missing.h:23,
from /usr/include/ruby-2.3.0/ruby/defines.h:68,
from /usr/include/ruby-2.3.0/ruby/ruby.h:36,
from /usr/include/ruby-2.3.0/ruby.h:33,
from math.cpp:129:
/usr/include/c++/6.1.1/cmath:95:3: note: candidate: constexpr long double std::abs(long double)
abs(long double __x)
^~~
/usr/include/c++/6.1.1/cmath:91:3: note: candidate: constexpr float std::abs(float)
abs(float __x)
^~~
/usr/include/c++/6.1.1/cmath:85:3: note: candidate: constexpr double std::abs(double)
abs(double __x)
^~~
In file included from math.cpp:137:0:
math/imax.h: In instantiation of ‘int nm::math::imax(int, const DType*, int) [with DType = nm::RubyObject]’:
math/imax.h:74:21: required from ‘int nm::math::cblas_imax(int, const void*, int) [with DType = nm::RubyObject]’
math.cpp:791:3: required from here
math/imax.h:49:15: error: call of overloaded ‘abs(const nm::RubyObject&)’ is ambiguous
dmax = abs(x[0]);
~~~^~~~~~
In file included from /usr/include/c++/6.1.1/cstdlib:75:0,
from /usr/include/c++/6.1.1/stdlib.h:36,
from /usr/include/ruby-2.3.0/ruby/defines.h:34,
from /usr/include/ruby-2.3.0/ruby/ruby.h:36,
from /usr/include/ruby-2.3.0/ruby.h:33,
from math.cpp:129:
/usr/include/stdlib.h:774:12: note: candidate: int abs(int)
extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
^~~
In file included from /usr/include/c++/6.1.1/stdlib.h:36:0,
from /usr/include/ruby-2.3.0/ruby/defines.h:34,
from /usr/include/ruby-2.3.0/ruby/ruby.h:36,
from /usr/include/ruby-2.3.0/ruby.h:33,
from math.cpp:129:
/usr/include/c++/6.1.1/cstdlib:180:3: note: candidate: long long int std::abs(long long int)
abs(long long __x) { return __builtin_llabs (__x); }
^~~
/usr/include/c++/6.1.1/cstdlib:172:3: note: candidate: long int std::abs(long int)
abs(long __i) { return __builtin_labs(__i); }
^~~
In file included from /usr/include/c++/6.1.1/math.h:36:0,
from /usr/include/ruby-2.3.0/ruby/missing.h:23,
from /usr/include/ruby-2.3.0/ruby/defines.h:68,
from /usr/include/ruby-2.3.0/ruby/ruby.h:36,
from /usr/include/ruby-2.3.0/ruby.h:33,
from math.cpp:129:
/usr/include/c++/6.1.1/cmath:95:3: note: candidate: constexpr long double std::abs(long double)
abs(long double __x)
^~~
/usr/include/c++/6.1.1/cmath:91:3: note: candidate: constexpr float std::abs(float)
abs(float __x)
^~~
/usr/include/c++/6.1.1/cmath:85:3: note: candidate: constexpr double std::abs(double)
abs(double __x)
^~~
Makefile:242: recipe for target 'math.o' failed
make: *** [math.o] Error 1
make failed, exit code 2
Gem files will remain installed in /home/ram/.gem/ruby/2.3.0/gems/nmatrix-0.2.1 for inspection.
Results logged to /home/ram/.gem/ruby/2.3.0/extensions/x86_64-linux/2.3.0/nmatrix-0.2.1/gem_make.out
1 gem installed
Because of these errors I took a fresh clone of the nmatrix repo and installed it from there
ram@luthien:~/src/external/nmatrix rake gem
cd pkg/nmatrix-0.2.1
mv nmatrix-0.2.1.gem ..
cd -
ram@luthien:~/src/external/nmatrix gem install pkg/nmatrix-0.2.1.gem
WARNING: You don't have /home/ram/.gem/ruby/2.3.0/bin in your PATH,
gem executables will not run.
Building native extensions. This could take a while...
***********************************************************
Welcome to SciRuby: Tools for Scientific Computing in Ruby!
NMatrix requires a C compiler, and has been tested only
with GCC 4.6+. We are happy to accept contributions
which improve the portability of this project.
If you are upgrading from NMatrix 0.1.0 and rely on
ATLAS features, please check the README.
Faster matrix calculations and more advanced linear
algebra features are available by installing either
the nmatrix-atlas or nmatrix-lapacke plugins.
More explicit instructions for NMatrix and SciRuby should
be available on the SciRuby website, sciruby.com, or
through our mailing list (which can be found on our web-
site).
Thanks for trying out NMatrix! Happy coding!
***********************************************************
Successfully installed nmatrix-0.2.1
Parsing documentation for nmatrix-0.2.1
Installing ri documentation for nmatrix-0.2.1
Done installing documentation for nmatrix after 2 seconds
1 gem installed
no into rb-gsl clone ...
ram@luthien:~/src/external/nmatrix cd ../rb-gsl [16:15:56|16-05-12]
ram@luthien:~/src/external/rb-gsl gd [16:17:05|16-05-12]
ram@luthien:~/src/external/rb-gsl g pull [16:17:06|16-05-12]
Already up-to-date.
ram@luthien:~/src/external/rb-gsl echo $NMATRIX [16:17:12|16-05-12]
1
ram@luthien:~/src/external/rb-gsl echo $NARRAY [16:17:19|16-05-12]
ram@luthien:~/src/external/rb-gsl rake install [16:17:24|16-05-12]
Could not find power_assert-0.2.6 in any of the sources
Run `bundle install` to install missing gems.
ram@luthien:~/src/external/rb-gsl bundle install [16:17:52|16-05-12]
Fetching gem metadata from https://rubygems.org/
Fetching version metadata from https://rubygems.org/
Resolving dependencies...
Using rake 10.4.2
Using backports 3.6.8
Using bundler 1.12.3
Using gsl 2.1.0.1 (was 2.1.0) from source at `.`
Your user account isn't allowed to install to the system Rubygems.
You can cancel this installation and run:
bundle install --path vendor/bundle
to install the gems into ./vendor/bundle/, or you can enter your password
and install the bundled gems to Rubygems using sudo.
Password:
Installing power_assert 0.2.6
Using rake-compiler 0.9.5
Using packable 1.3.8
Installing test-unit 3.1.5
Using nmatrix 0.2.1
Bundle complete! 6 Gemfile dependencies, 9 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
ram@luthien:~/src/external/rb-gsl rake install [16:18:17|16-05-12]
gsl 2.1.0.1 built to pkg/gsl-2.1.0.1.gem.
gsl (2.1.0.1) installed.
Now using it...
ram@luthien:~/src/external/rb-gsl irb [16:19:51|16-05-12]
>> require 'gsl'
=> true
>>
?> q=GSL::Vector.alloc(1,2,3)
=> GSL::Vector
[ 1.000e00 2.000e00 3.000e00 ]
>> q.to_nm
=> #<NMatrix:0x000000022416a0 shape:[3] dtype:float64 stype:dense>
looks great, although is does only work with the environment setup. I personally prefer such setups during the build process rather than runtime. gsl is build with this support only, isn't it?
>> require 'narray'
TypeError: NVector is not a class (Module)
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `require'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `rescue in require'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
from /usr/lib/ruby/gems/2.3.0/gems/backports-3.6.8/lib/backports/std_lib.rb:9:in `require_with_backports'
from (irb):5
from /bin/irb:11:in `<main>'
>>
is it intended to use nmatrix and narray exclusively?
Yes. The problem is that nmatrix and narray cannot coexist because they were created that way (with namespace clashes), so we need to do this as a workaround for rb-gsl until narray functionality can be dropped, which I hope will happen soon. Alternatively, you can clone narray, remove the NMatrix class from the narray code and install that, which will let you use narray too. I dont think the NMatrix class of narray is too useful either.
@mohawkjohn we found a new way for nmatrix and narray to not co-exist.
ok, thanks for clarification and all the help!!
cheers ralf
Following the installation instructions I get the following compile error:
export NMATRIX=1 gem install rb-gsl
WARNING: You don't have /home/ram/.gem/ruby/2.3.0/bin in your PATH, gem executables will not run. Building native extensions. This could take a while... ERROR: Error installing rb-gsl: ERROR: Failed to build gem native extension.
current directory: /home/ram/.gem/ruby/2.3.0/gems/gsl-2.1.0/ext/gsl_native /usr/bin/ruby -r ./siteconf20160509-11351-f80np0.rb extconf.rb checking gsl version... 2.1 checking gsl cflags... -I/usr/include checking gsl libs... -L/usr/lib -lgsl -lgslcblas -lm checking for round()... yes checking for alf/alf.h... no checking for qrngextra/qrngextra.h... no checking for rngextra/rngextra.h... no checking for tensor/tensor.h... no checking for gsl/gsl_multimin_fsdf.h... no checking for gsl/gsl_cqp.h... no checking for jacobi.h... no checking for ndlinear/gsl_multifit_ndlinear.h... no checking for ool/ool_version.h... no checking for gsl_eigen_francis() in -lgsl... yes checking for gsl_eigen_francis()... yes checking for gsl_poly_solve_quartic() in -lgsl... no checking for graph... yes checking for nmatrix.h... yes checking for tamu_anova/tamu_anova.h... no checking for gsl_multifit_fdfsolver.J in gsl/gsl_multifit_nlin.h... no checking for gsl_sf_mathieu_a_e() in gsl/gsl_sf_mathieu.h... yes checking for gsl_sf_mathieu_b_e() in gsl/gsl_sf_mathieu.h... yes checking for gsl_sf_mathieu_ce_e() in gsl/gsl_sf_mathieu.h... yes checking for gsl_sf_mathieu_se_e() in gsl/gsl_sf_mathieu.h... yes checking for gsl_sf_mathieu_Mc_e() in gsl/gsl_sf_mathieu.h... yes checking for gsl_sf_mathieu_Ms_e() in gsl/gsl_sf_mathieu.h... yes creating gsl_config.h creating Makefile
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/ram/.gem/ruby/2.3.0/extensions/x86_64-linux/2.3.0/gsl-2.1.0/mkmf.log
current directory: /home/ram/.gem/ruby/2.3.0/gems/gsl-2.1.0/ext/gsl_native make "DESTDIR=" clean
current directory: /home/ram/.gem/ruby/2.3.0/gems/gsl-2.1.0/ext/gsl_native make "DESTDIR=" compiling stats.c In file included from include/rb_gsl_with_nmatrix.h:8:0, from include/rb_gsl_common.h:27, from include/rb_gsl_array.h:27, from stats.c:12: /home/ram/.gem/ruby/2.3.0/extensions/x86_64-linux/2.3.0/nmatrix-0.2.1/nmatrix.h:95:1: error: redefinition of ‘rb_array_const_ptr’ rb_array_const_ptr(VALUE a) ^
~~~~~ In file included from /usr/include/ruby-2.3.0/ruby.h:33:0, from include/rb_gsl_common.h:15, from include/rb_gsl_array.h:27, from stats.c:12: /usr/include/ruby-2.3.0/ruby/ruby.h:2025:1: note: previous definition of ‘rb_array_const_ptr’ was here rb_array_const_ptr(VALUE a) ^~~~~~ Makefile:238: recipe for target 'stats.o' failed make: *\ [stats.o] Error 1make failed, exit code 2
Is there anything I can do?
The problems was, that with a scituby-full installation, the gsl gem was not working because of a superclass mismatch:
ruby -e 'require "gsl"' [15:07:30|16-05-09] /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in
require': superclass mismatch for class NMatrix (TypeError) from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in
require' from /home/ram/.gem/ruby/2.3.0/gems/nmatrix-0.2.1/lib/nmatrix/nmatrix.rb:38:in<top (required)>' from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in
require' from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:inrescue in require' from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in
require' from /home/ram/.gem/ruby/2.3.0/gems/gsl-2.1.0/lib/gsl.rb:7:in<top (required)>' from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in
require' from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:inrescue in require' from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in
require'That's why I tried to install it manually
The NARRAY installation works.
thanks in advance!