How to convert default binutils into binutils-2.26

2019-07-22 14:15发布

问题:

When I command "make", then I got an error like this:

/usr/bin/ld: ../../../lib//liblmi.a(LMInterface.o): unrecognized relocation (0x2a) in section `.text'

This error is caused by earlier version of binutils, and I have binutils like this:

GNU ld (GNU Binutils for Ubuntu) 2.24

I installed binutils-2.26 by following commands

$ sudo apt-get update
$ sudo apt-get install binutils-2.26

But I have a problem, I installed binutils-2.26, but the default binutils version is 2.24, so How can I convert binutils-2.26 into the default binutils?

回答1:

binutils-2.26 provides the individual programs under names such as /usr/bin/as-2.26 and /usr/bin/ld-2.26, so that the binutils and binutils-2.26 packages can be installed at the same time. However, unversioned names of the programs are available in the /usr/lib/binutils-2.26/bin directory, so you can activate them using this shell command:

PATH="/usr/lib/binutils-2.26/bin:$PATH"

As a result, gcc and g++ will use binutils 2.26 instead of the default binutils version.