Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29007 Discussions

Error message from the linker: relocation R_X86_64_32 against 'a local symbol'

Arjen_Markus
Honored Contributor II
1,042 Views
Hello,

I am trying to compile and link a program on a 64-bits Linux machine, using Intel Fortran 11.

On at least one object file I get an error message from the linker that: relocation R_X86_64_32 against 'a local symbol' can not be used when making a shared object; recompile with -fPIC.

All source files have been compiled with -fPIC, so the message is at the very least misleading.
What sort of things in my source code could cause this message? Or is it a compiler bug?
(I know one cause for this type of message in C code - has to do with conflicting visibilities,
but as far as I can tell, the Fortran code does not contain anything in that direction)

Regards,

Arjen
0 Kudos
4 Replies
mecej4
Honored Contributor III
1,042 Views
This error is usually encountered when GNU Configure and Make are used with some incorrect flags, as described in this helpful article:

HOWTO fix -fPIC errors
0 Kudos
Arjen_Markus
Honored Contributor II
1,042 Views
Hi mecej4,

it may actually something as simple as leaving out the -fPIC flag - I had judged from all the occurrences
of -fPIC in the output from "make" that it was used for all compile steps, but it definitely was not.

So now I am trying with an explicit -fPIC flag ... Thanks for the advice so far.

Regards,

Arjen
0 Kudos
mecej4
Honored Contributor III
1,042 Views
You may need to manually purge old objects that were compiled without -fPIC, since Make cannot distinguish between objects compiled with -fPIC and those compiled without -fPIC. Or, you could or clean everything and restart building.
0 Kudos
Arjen_Markus
Honored Contributor II
1,041 Views
Adding -fPIC to all compile steps certainly helped. I ran into a system library that was not available
as a shared library, but it seems to be solving the problem all right.

Regards,

Arjen
0 Kudos
Reply