Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I see something that resembles a C compiler error when I try installing ruby gem json 1.8.3

Here's the command I'm running:

gem install json -v '1.8.3'

And my output is:

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

I tried removing and installing packages binutils and build-essential but this did not fix the issue.

Some facts about my OS:

Debian GNU/Linux 7.9 (wheezy)

uname -a shows:

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

I'm running this on an OpenVZ virtualized VPS host.

My /etc/apt/sources.list (if it helps):

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 produces zero relevant results for

BFD (GNU Binutils for Debian) 2.22 internal error, aborting at ../../bfd/reloc.c line 443 in bfd_get_reloc_size

If I can't "make" json gem because of linker error, please advise me into the right direction to go, maybe I can replace the compiler/linker with another version, or somehow circumvent installing things from source here? In general, any solution is welcome as soon as it helps install the json gem and proceed with my plan.

Big thanks in advance!

like image 760
Sergey Neskhodovskiy Avatar asked Mar 27 '16 07:03

Sergey Neskhodovskiy


2 Answers

Try 2.25 or 2.26 Binutils as your 2.22 version is quite old.

like image 184
CryptoPiggy Avatar answered Oct 20 '22 20:10

CryptoPiggy


Installing a newer version of binutils solved the issue for me.

As per advise by Alxs, I have installed binutils 2.26-8. I had to add this line:

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

To my /etc/apt/sources.list, then I ran

apt-get update
apt-get install binutils

Which updated binutils to 2.26

Then I ran again:

gem install json -v '1.8.3'

And it went smooth this time.

IMPORTANT: Don't forget to remove this line:

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

from your /etc/apt/sources.list after you're done, otherwise you'll keep installing future packages from sid repo from now on, which is not probably what you need.

like image 25
Sergey Neskhodovskiy Avatar answered Oct 20 '22 20:10

Sergey Neskhodovskiy