安装 ruby gem json v1.8.3 时出错:BFD(GNU Binutils for Debian)2.22 内部错误

Make error installing ruby gem json v1.8.3: BFD (GNU Binutils for Debian) 2.22 internal error

我在尝试安装 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 但这并没有解决问题。

关于我的一些事实 OS:

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

如果我不能"make" json gem因为链接器错误,请告诉我正确的方向,也许我可以替换compiler/linker使用另一个版本,或者以某种方式规避从这里安装源代码的东西?总的来说,只要能帮助安装 json gem 并继续我的计划,任何解决方案都是受欢迎的。

非常感谢!

安装更新版本的 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 仓库安装未来的软件包,这可能不是你需要的。

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