【问题标题】:Ruby linalg library undefined symbol _gfortran_concat_stringRuby linalg 库未定义符号 _gfortran_concat_string
【发布时间】:2014-05-18 18:26:12
【问题描述】:

我按照以下说明安装 linalg 库(连同 LAPACK 和 f2c):https://www.quora.com/Installation-Instructions/How-do-I-install-Ruby-linalg-library-on-Mac

对于那些不在 quora 上的人,我一直在记录安装说明: http://pastebin.com/QbvE5MJc

我让 linalg 在一台机器上成功运行,但现在正在另一台机器上尝试,但它无法正常运行。一切正常,直到我真正尝试在 ruby​​ 中使用它。

ldubinets@lm16 ~/Code/lapack/linalg $ irb
irb(main):001:0> require 'linalg'
LoadError: /usr/local/lib/site_ruby/1.9.1/i686-linux/lapack.so: undefined symbol: _gfortran_concat_string - /usr/local/lib/site_ruby/1.9.1/i686-linux/lapack.so
    from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /usr/local/lib/site_ruby/1.9.1/linalg.rb:7:in `<top (required)>'
    from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from (irb):1
    from /usr/bin/irb:12:in `<main>'

我的机器运行的是 Linux Mint 16。刚刚安装了全新安装。

我在互联网上读到我必须将 gfortran 与 -lgfortran 链接到某个 makefile 中 http://icl.cs.utk.edu/lapack-forum/viewtopic.php?f=4&t=2957

在 linalg/ext/linalg 和 linalg/ext/lapack 中有一个 Makefile 有这一行

 LIBS = $(LIBRUBYARG_SHARED) -llapack -lblas -lpthread ...

我添加了“-lgfortran”并重新安装,但它根本没有帮助。

如何在此安装中链接到 gfortran?

提前致谢。

编辑:

好吧,既然错误是由lapack.so抛出的,看来我需要在安装lapack的过程中链接gfortran。是这样吗? 在互联网的其他地方,人们说这可能是由冲突的 fortran 编译器(g77 和 gfortran)引起的,尽管我没有安装 g77,所以我不知道这是怎么回事。

【问题讨论】:

  • 您是复制二进制文件还是在新机器上进行了新构建?
  • 我使用第一个 pastebin 链接中的说明在新机器上构建了 lapack & blas。

标签: ruby linker fortran gfortran lapack


【解决方案1】:

正如我所怀疑的,每个 Makefile 中的这一行都是罪魁祸首:

LIBS = $(LIBRUBYARG_SHARED) -llapack -lblas -lpthread ...

-lgfortran 添加到这一行可以使一切正常,但有一个警告。当您运行 sudo ruby install.rb 时,它会重新生成 Makefile。因此,我为解决此问题所做的是:

sudo ruby install.rb config  # generates the makefiles
sudo vim ext/linalg/Makefile # add -lgfortran to that line
sudo vim ext/linalg/Makefile # add -lgfortran to that line
sudo vim install.rb          # find the method config in the Main module and comment out everything inside it (so it won't regenerate the config)
sudo ruby install.rb         # does the entire install process, but does't regenerate the config.

这是修复它的超级hacky方法,但它有效。如果有人有更好的方法,请告诉我!

【讨论】:

    猜你喜欢
    • 2012-01-04
    • 1970-01-01
    • 1970-01-01
    • 2021-10-17
    • 1970-01-01
    • 2018-04-14
    • 2016-10-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多