【问题标题】:Make error installing ruby gem json v1.8.3: BFD (GNU Binutils for Debian) 2.22 internal error安装 ruby​​ gem json v1.8.3 时出错:BFD (GNU Binutils for Debian) 2.22 内部错误
【发布时间】:2016-07-14 16:19:39
【问题描述】:

我在尝试安装 ruby gem json 1.8.3 时看到类似于 C 编译器错误的内容

这是我正在运行的命令:

gem install json -v '1.8.3'

我的输出是:

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

    /usr/local/rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20160327-27188-189i1cj.rb extconf.rb
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling generator.c
linking shared-object json/ext/generator.so
/usr/bin/ld: BFD (GNU Binutils for Debian) 2.22 internal error, aborting at ../../bfd/reloc.c line 443 in bfd_get_reloc_size

/usr/bin/ld: Please report this bug.

collect2: error: ld returned 1 exit status
make: *** [generator.so] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/local/rvm/gems/ruby-2.2.1/gems/json-1.8.3 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.2.1/extensions/x86_64-linux/2.2.0/json-1.8.3/gem_make.out

我尝试删除和安装软件包 binutilsbuild-essential 但这并没有解决问题。

关于我的操作系统的一些事实:

Debian GNU/Linux 7.9 (wheezy)

uname -a 显示:

Linux Prometheus 2.6.32-042stab112.15 #1 SMP Tue Oct 20 17:22:56 MSK 2015 x86_64 GNU/Linux

我在 OpenVZ 虚拟化 VPS 主机上运行它。

我的 /etc/apt/sources.list(如果有帮助的话):

deb http://ftp.debian.org/debian wheezy main contrib non-free
deb http://security.debian.org wheezy/updates main contrib non-free
deb http://packages.icinga.org/debian icinga-wheezy main
deb http://http.debian.net/debian wheezy-backports main
deb-src http://packages.icinga.org/debian icinga-wheezy main

Google 为

生成零相关结果
BFD (GNU Binutils for Debian) 2.22 internal error, aborting at ../../bfd/reloc.c line 443 in bfd_get_reloc_size

如果我因为链接器错误而无法“制作”json gem,请告诉我正确的方向,也许我可以用另一个版本替换编译器/链接器,或者以某种方式绕过从源代码安装东西?一般来说,只要有助于安装 json gem 并继续我的计划,任何解决方案都会受到欢迎。

提前致谢!

【问题讨论】:

  • 试试 2.25 或 2.26 Binutils
  • 你能显示uname -a吗?
  • @AlexD uname -a: Linux Prometheus 2.6.32-042stab112.15 #1 SMP Tue Oct 20 17:22:56 MSK 2015 x86_64 GNU/Linux
  • 你的内核已经过时了。看起来您正在某种虚拟化下运行您的系统 - 谷歌说它很可能是旧 rhel6 下的 OpenVZ。您的问题可能是由旧内核和新用户空间工具之间的不兼容引起的,或者您遇到了一些内存或虚拟化设置的其他限制。
  • @AlexD 感谢您的意见,我确实在 VPS 上运行它(我已经用新信息更新了我的票证),但它有 6GB 内存并且大部分是免费的(正如 free 命令所示),我可能在这方面知识不多,但看起来这不应该是内存限制的问题。另一方面,我不太可能在这台服务器上升级内核,所以我可以尝试其他的方法吗?

标签: ruby json linux compiler-errors binutils


【解决方案1】:

安装较新版本的 binutils 为我解决了这个问题。

根据 Alxs 的建议,我安装了 binutils 2.26-8。我不得不添加这一行:

deb http://ftp.de.debian.org/debian sid main

到我的/etc/apt/sources.list,然后我跑了

apt-get update
apt-get install binutils

将 binutils 更新到 2.26

然后我又跑了:

gem install json -v '1.8.3'

这次很顺利。

重要提示:不要忘记删除此行:

deb http://ftp.de.debian.org/debian sid main

完成后从您的/etc/apt/sources.list 中,否则从现在开始您将继续从sid repo 安装未来的软件包,这可能不是您需要的。

【讨论】:

【解决方案2】:

尝试 2.25 或 2.26 Binutils,因为您的 2.22 版本太旧了。

【讨论】:

  • 在下面查看我自己的答案,了解我完成的具体步骤。
猜你喜欢
  • 1970-01-01
  • 2014-01-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-01-18
相关资源
最近更新 更多