How to compile binutils on Ubuntu/Debian. (Upgrade or Downgrade)

If you are facing an issue that looks like the following:

How to compile binutils on Ubuntu/Debian. (Upgrade or Downgrade)
Photo by Gabriel Heinzer / Unsplash

If you are facing an issue that looks like the following:error: linking with `cc` failed: exit status: 1= note: /usr/local/bin/ld: BFD (GNU Binutils) 2.35 assertion fail elflink.c:14788collect2: error: ld returned 1 exit status

Then you should check your binutils version, by running the following command:$ ld -v :GNU ld (GNU Binutils) 2.35

To downgrade/Upgrade Binutil version ,​ you will need first this package for the compiling process:

sudo apt-get install texinfo

Full list of binutils version available here :

http://ftp.gnu.org/gnu/binutils/

Let’s pick binutils 2.34,wget http://ftp.gnu.org/gnu/binutils/binutils-2.34.tar.gztar -xf binutils-2.34.tar.gzcd binutils-2.34

Then we will run the configure bash script, to be installed at /usr/local :​./configure — prefix=/usr/local

Thenmakesudo make install

let’s check now​, make sure its 2.34ld -v

Also Make sure its /usr/local/bin/ldwhich ld