Unable to compile: unrecognized relocation
Asked Answered
M

3

10

I'm unable to compile anything in my linux pc. I have no idea why, probably I've installed some package and made a mess. I've uninstalled and reinstalled gcc and other packages, but no good news.. still this problem.

This is the message:

/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-
linux/bin/ld: /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../lib64/crt1.o: unrecognized relocation (0x29) in section `.text'

Any idea of what does it mean and how to fix this problem?

cheers

Margy answered 5/9, 2017 at 14:57 Comment(2)
Looks like the object file is incompatible with the linker?Eisenach
I have gcc (SUSE Linux) 4.8.5 and ldd (GNU libc) 2.25 . I'm hours trying to understand what can it beMargy
H
21

For anyone else that encounters this issue: I think @gabib44's problem was using a older version of ld to link a library that had been built with a newer version.

"unrecognized relocation" occurs when the relocation type is greater than the greatest known relocation type in your version of ld. 0x2a (R_X86_64_REX_GOTPCRELX) is presently the relocation type with the greatest value; I guess @gabib44's ld was old enough to not know about the relocation type before that one (0x29, R_X86_64_GOTPCRELX).

I had this problem myself when I was building a library with binutils v2.26 (which knew about relocation 0x2a) but then incorporating that library on a build machine using binutils v2.24

The fix is either to build the library that you want to link with a older version of the binutils suite, or to upgrade ld on the machine that wants to link that library.

Hazel answered 9/12, 2017 at 4:13 Comment(1)
Just to add details: to upgrade ld in ubuntu, I installed binutils-2.26, but that only adds a ld-2.26 binary. I had to handle the symbolic links so that it's used by default.Cancellation
S
4

I've found this in another post:

[...which when compiled brings this error:

/usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/../../../../x86_64-pc-linux-
gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-
gnu/6.4.0/../../../../lib64/Scrt1.o: unrecognized relocation (0x2a) in 
section `.text'

After trying a lot of things out, including emerging binaries from a different Gentoo system, I finally reverted, and got the problem solved thanks to optiz0r (for solving my issue) and Ryuno-Ki[m] (for letting me know about optiz0rs reply when I had logged off).

sudo binutils-config x86_64-pc-linux-gnu-2.29.1

Very simple! The solution to your problem may differ, but running

sudo binutils-config -l

may reveal the version you can enter instead of the version I used...] by necrophcodr » Tue Feb 06, 2018 21:24 on https://forum.sabayon.org/viewtopic.php?f=57&t=34076&p=181260#p181260

It worked for me.

Sherborne answered 16/3, 2018 at 15:23 Comment(0)
M
1

I fixed installing gcc-32bit and removing various other packets

Margy answered 6/9, 2017 at 6:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.