Problems installing gsl gem

ぐ巨炮叔叔 提交于 2019-11-28 23:09:34

Install ruby GSL:

Ubuntu 11.10 includes a newer version (1.15) of libgsl0 that is not compatible with ruby/gsl :

Must install older version 1.14 for ruby/gsl to work:

curl -O http://mirror.veriportal.com/gnu/gsl/gsl-1.14.tar.gz
tar xvzf gsl-1.14.tar.gz
cd gsl-1.14
./configure
make
sudo make install
sudo gem install --conservative --no-ri --no-rdoc gsl

Installation works OK and test on Ubuntu and Debian Squeeze:

Fetching: narray-0.6.0.1.gem (100%)
Building native extensions.  This could take a while...
Fetching: gsl-1.14.7.gem (100%)
Building native extensions.  This could take a while...
Successfully installed narray-0.6.0.1
Successfully installed gsl-1.14.7
2 gems installed

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

If you have:

  • GSL 1.16 (check with gsl-config --version) (e.g. in Ubuntu 14.04),
  • Ruby 2.1

Then try https://github.com/siefca/rb-gsl -- it's tweaked for such configuration.
It should also work with Ruby 1.9 and Ruby 2.0.

If you're using bundler to manage gems in a project then put a line in your Gemfile:

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

Cheers!

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'

under ubuntu 13.04 this solves the problem:

sudo apt-get install libgsl0-dev

no need to manually install an old version

Attention it seems not working with Ruby 2.1.0.

For Ubuntu 12.04 LTS and Ruby 2.0.0:

cd ~
wget ftp://ftp.gnu.org/gnu/gsl/gsl-1.15.tar.gz
tar xvzf gsl-1.15.tar.gz
cd gsl-1.15
./configure
make
sudo make install

Check if GSL 1.15 is correctly installed

gsl-config --version

Then install gem (gsl 1.15.3)

gem install gsl

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

For ubuntu 13.10, ruby 2.0.0 works fine next-

curl -O http://ftp.unicamp.br/pub/gnu/gsl/gsl-1.16.tar.gz
tar xvzf gsl-1.16.tar.gz
cd gsl-1.16
./configure
make
sudo make install
sudo gem install --conservative --no-ri --no-rdoc gsl

Attention: Ami Navon wrote-

Must install older version 1.14 for ruby/gsl to work

It is not actual now for gsl-1.16/ruby-2.0.0

Ivan Chau

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

This also works on ubuntu 16.04 LTS and ruby 2.2.2
sudo apt-get install libgsl0-dev

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!