Problems installing gsl gem

2019-01-23 03:06发布

I can succesfully install the gsl library in my home directory, but when I try to install the gsl gem I get a big list of errors that I do not understand. I am wondering if someone could give me some idea why I could be getting those errors. I can say I have:

Installed gsl succesfully; at least that is what it looked like. I pointed the path to gsl-config

This is what the error log looks like:

  Building native extensions.  This could take a while...
  ERROR:  Error installing gsl:
    ERROR: Failed to build gem native extension.

  /home/ted/ruby-1.9.1/bin/ruby extconf.rb install gsl
  checking gsl version... 1.15
  checking gsl cflags... -I/home/ted/gsl-1.15/include
  checking for main() in -lcblas... no
  checking gsl libs... -L/home/ted/gsl-1.15/lib -lgsl -lgslcblas -lm
  checking for round()... no
  checking for rngextra/rngextra.h... no
  checking for qrngextra/qrngextra.h... no
  checking for ool/ool_version.h... no
  checking for tensor/tensor.h... no
  checking for jacobi.h... no
  checking for gsl/gsl_cqp.h... no
  checking for gsl/gsl_multimin_fsdf.h... no
  checking for gsl_poly_solve_quartic() in -lgsl... no
  checking for gsl_eigen_francis() in -lgsl... no
  checking for ndlinear/gsl_multifit_ndlinear.h... no
  checking for alf/alf.h... no
  checking rb-gsl version...1.14.7
  checking ruby version... 1.9.1
  checking for graph... no
  checking for narray.h... yes
  checking for tamu_anova/tamu_anova.h... no
  checking for main() in -ltamuanova... no
  creating Makefile

  make
  gcc -I. -I/home/ted/ruby-1.9.1/include/ruby-1.9.1/x86_64-linux -I/home/ted/ruby-1.9.1/include/ruby-1.9.1/ruby/backward -I/home/ted/ruby-1.9.1/include/ruby-1.9.1 -I. -DHAVE_NARRAY_H  -I/home/ted/ruby-1.9.1/lib/ruby/gems/1.9.1/gems/narray-0.6.0.1/. -I/home/ted/ruby-1.9.1/lib/ruby/site_ruby/1.9.1/x86_64-linux    -fPIC  -Wall -I../include  -I/home/ted/gsl-1.15/include  -o sf_bessel.o -c sf_bessel.c
  In file included from sf_bessel.c:13:
  ../include/rb_gsl_sf.h:15:24: error: gsl/gsl_sf.h: No such file or directory
  ../include/rb_gsl_sf.h:16:27: error: gsl/gsl_errno.h: No such file or directory
  ../include/rb_gsl_sf.h:17:28: error: gsl/gsl_vector.h: No such file or directory
  In file included from ../include/rb_gsl_sf.h:18,
                   from sf_bessel.c:13:
  /home/ted/gsl-1.15/include/gsl/gsl_math.h:23:25: error: gsl/gsl_sys.h: No such file or directory
  In file included from sf_bessel.c:13:
  ../include/rb_gsl_sf.h:19:29: error: gsl/gsl_complex.h: No such file or directory
  In file included from ../include/rb_gsl.h:20,
                   from ../include/rb_gsl_sf.h:21,
                   from sf_bessel.c:13:
  ../include/rb_gsl_common.h:23:28: error: gsl/gsl_matrix.h: No such file or directory
  ../include/rb_gsl_common.h:24:33: error: gsl/gsl_permutation.h: No such file or directory
  ../include/rb_gsl_common.h:25:32: error: gsl/gsl_ieee_utils.h: No such file or directory
  In file included from ../include/rb_gsl.h:20,
                   from ../include/rb_gsl_sf.h:21,
                   from sf_bessel.c:13:
  ../include/rb_gsl_common.h:322: warning: type defaults to ‘int’ in declaration of ‘gsl_complex’
  ../include/rb_gsl_common.h:322: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
  ../include/rb_gsl_common.h:324: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
  ../include/rb_gsl_common.h:325: error: expected ‘)’ before ‘*’ token
  ../include/rb_gsl_common.h:326: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
  ../include/rb_gsl_common.h:328: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
  ../include/rb_gsl_common.h:329: error: expected ‘)’ before ‘*’ token
  ../include/rb_gsl_common.h:330: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
  ../include/rb_gsl_common.h:340: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ary2complex’
  In file included from ../include/rb_gsl.h:21,
                   from ../include/rb_gsl_sf.h:21,
                   from sf_bessel.c:13:
  ../include/rb_gsl_math.h:24: error: expected ‘)’ before ‘(’ token
  In file included from ../include/rb_gsl.h:22,
                   from ../include/rb_gsl_sf.h:21,
                   from sf_bessel.c:13:
  ../include/rb_gsl_complex.h:19:34: error: gsl/gsl_complex_math.h: No such file or directory

...

  sf_bessel.c: In function ‘rb_gsl_sf_bessel_zero_J1_e’:
  sf_bessel.c:643: error: ‘gsl_sf_bessel_zero_J1_e’ undeclared (first use in this function)
  sf_bessel.c: In function ‘rb_gsl_sf_bessel_zero_Jnu’:
  sf_bessel.c:648: error: ‘gsl_sf_bessel_zero_Jnu’ undeclared (first use in this function)
  sf_bessel.c: In function ‘rb_gsl_sf_bessel_zero_Jnu_e’:
  sf_bessel.c:653: error: ‘gsl_sf_bessel_zero_Jnu_e’ undeclared (first use in this function)
  make: *** [sf_bessel.o] Error 1


  Gem files will remain installed in /home/ted/ruby-1.9.1/lib/ruby/gems/1.9.1/gems/gsl-1.14.7 for inspection.
  Results logged to /home/ted/ruby-1.9.1/lib/ruby/gems/1.9.1/gems/gsl-1.14.7/ext/gem_make.out

标签: ruby gem gsl
10条回答
姐就是有狂的资本
2楼-- · 2019-01-23 03:40

For anyone still struggling to install this with the gsl_matrix_complex_equal issue.

If you have run brew install gsl which will as of this writing install 1.15 and then attempted to install the ruby bindings, you will potentially run into this problem.

Using this repo as your rb-gsl gem source solves the issue: https://github.com/30robots/rb-gsl

However, if you have a newer version of rubygems, that repo makes a call to Gem#searcher which is a deprecated and now removed method.

My repo updates that call to use the Gem::Specification API:

https://github.com/whistlerbrk/rb-gsl

So in short:

brew install gsl on OSX

and in your Gemfile:

gem 'gsl', :git => 'git://github.com/whistlerbrk/rb-gsl.git'

查看更多
We Are One
3楼-- · 2019-01-23 03:41

lsb_release -a Ubuntu 14.04.1 LTS
ruby --version ruby 2.1.2p95


Important: Install gsl development package (https://askubuntu.com/a/490475/121418)
sudo apt-get install libgsl0-dev

Add this line in Gemfile
gem 'rb-gsl'

Install gem via Terminal
bundle install


Verify
bundle show rb-gsl
/.rvm/gems/ruby-2.1.2/gems/rb-gsl-1.16.0.4

gsl-config --version
1.15


Use require "gsl" in ruby file if necessary

查看更多
ゆ 、 Hurt°
4楼-- · 2019-01-23 03:41

which OS are you on?

first you need to install gsl and gsl-devel RPMs on your OS as root... e.g. on Fedora Linux:

sudo yum install -y gsl gsl-devel

then do the gem install gsl or bundle install

without the gsl-devel package, it will not find the correct C-header files.

You also need to make sure that those header files are installed in a location which is included in either the LD_LIBRARY_PATH, or listed in /etc/ld.so.conf

查看更多
趁早两清
5楼-- · 2019-01-23 03:44

On my fresh install of Mac OS X Yosemite, I needed specifically 1.15.3, and homebrew can't get that for me (there is no brew install gsl115)

curl ftp://ftp.gnu.org/gnu/gsl/gsl-1.15.tar.gz > gsl-1.15.tar.gz
tar xvzf gsl-1.15.tar.gz
cd gsl-1.15
./configure
make
sudo make install
gem install gsl
查看更多
登录 后发表回答