安装 Ruby Gem json v1.8.3 时出现错误:BFD(用于 Debian 的 GNU Binutils)2.22 内部错误。

5
我看到在安装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

谷歌没有找到任何相关结果

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 - CryptoPiggy
你能展示一下 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 - Sergey Neskhodovskiy
@Alxs 谢谢,这是我需要的线索。我写了一个答案描述了我如何遵循你的建议。 - Sergey Neskhodovskiy
@SergeyNeskhodovskiy,很高兴能帮到你!请点赞/选择我的答案并留下评论。 :) - CryptoPiggy
显示剩余4条评论
2个回答

4

由于你的2.22版本相当老旧,建议使用2.25或2.26 Binutils。


1
请查看我完成的确切步骤。 - Sergey Neskhodovskiy

4
安装更新版本的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,这可能不是您需要的。

1
请参考以下内容,了解如何从不稳定源安装单个软件包:http://serverfault.com/questions/22414/how-can-i-run-debian-stable-but-install-some-packages-from-testing - AlexD

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接