安装 gsl gem 时出现问题

发布于 2024-12-04 01:47:08 字数 5073 浏览 5 评论 0原文

我可以在我的主目录中成功安装 gsl 库,但是当我尝试安装 gsl gem 时,我收到一大堆我不理解的错误。我想知道是否有人可以告诉我为什么我会遇到这些错误。我可以说我已经:

已成功安装 gsl;至少看上去是这样的。 我指出了 gsl-config 的路径,

错误日志如下所示:

  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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

书间行客 2024-12-11 01:47:08

安装 ruby​​ GSL:

Ubuntu 11.10 包含 libgsl0 的较新版本 (1.15), 与 ruby​​/gsl 不兼容:

必须安装旧版本 1.14 ruby/gsl 工作:

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

安装工作正常并在 Ubuntu 和 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

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
橙味迷妹 2024-12-11 01:47:08

您使用的是哪个操作系统?

首先,您需要以 root 身份在操作系统上安装 gslgsl-devel RPM...
例如,在 Fedora Linux 上:

sudo yum install -y gsl gsl-devel

然后在没有 gsl-devel 软件包的情况下执行 gem install gslbundle install

,它将找不到正确的 C 头文件。

您还需要确保这些头文件安装在 LD_LIBRARY_PATH 中包含的位置或 /etc/ld.so.conf 中列出的位置

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

故事↓在人 2024-12-11 01:47:08

如果您有:

  • GSL 1.16(使用gsl-config --version检查)(例如在Ubuntu 14.04中)、
  • Ruby 2.1< /strong>

然后尝试 https://github.com/siefca/rb-gsl - 它已针对此类配置进行了调整。
它还应该适用于 Ruby 1.9 和 Ruby 2.0。

如果您使用捆绑程序来管理项目中的 gem,请在您的 Gemfile 中添加一行:

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

干杯!

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!

素衣风尘叹 2024-12-11 01:47:08

对于仍然因 gsl_matrix_complex_equal 问题而苦苦安装的人。

如果您已运行 brew install gsl ,在撰写本文时它将安装 1.15,然后尝试安装 ruby​​ 绑定,您可能会遇到此问题。

使用此存储库作为 rb-gsl gem 源解决了这个问题:
https://github.com/30robots/rb-gsl

但是,如果您有较新的版本在 ruby​​gems 中,该存储库调用了 Gem#searcher,这是一个已弃用且现已删除的方法。

我的存储库更新调用使用 Gem::Specification API:

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

简而言之:

brew install gsl

在 OSX 上和 Gemfile 中

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

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'

情何以堪。 2024-12-11 01:47:08

在 ubuntu 13.04 下这解决了问题:

sudo apt-get install libgsl0-dev

无需手动安装旧版本

under ubuntu 13.04 this solves the problem:

sudo apt-get install libgsl0-dev

no need to manually install an old version

萌面超妹 2024-12-11 01:47:08

注意,它似乎不适用于 Ruby 2.1.0。

对于 Ubuntu 12.04 LTS 和 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

检查 GSL 1.15 是否正确安装

gsl-config --version

然后安装 gem (gsl 1.15.3)

gem install gsl

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
秋风の叶未落 2024-12-11 01:47:08

在我全新安装的 Mac OS X Yosemite 上,我特别需要 1.15.3,而 homebrew 无法为我提供该版本(没有 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

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
写下不归期 2024-12-11 01:47:08

对于 ubuntu 13.10,ruby 2.0.0 接下来可以正常工作 -

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

注意:
Ami Navon 写道 -

必须安装旧版本 1.14 才能让 ruby​​/gsl 工作

现在对于 gsl-1.16/ruby-2.0.0 来说并不实际

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

花之痕靓丽 2024-12-11 01:47:08

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


重要:安装 gsl 开发包 (https://askubuntu.com/a/490475/121418)
sudo apt-get install libgsl0-dev

在 Gemfile 中添加此行
gem 'rb-gsl'

通过终端安装 gem
捆绑安装


验证
捆绑展示 rb-gsl
/.rvm/gems/ruby-2.1.2/gems/rb-gsl-1.16.0.4

gsl-config --version
1.15


如有必要,在 ruby​​ 文件中使用 require "gsl"

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

沉默的熊 2024-12-11 01:47:08

这也适用于 ubuntu 16.04 LTS 和 ruby​​ 2.2.2
sudo apt-get install libgsl0-dev

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文