- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
HOWTO fix -fPIC errors
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
as a shared library, but it seems to be solving the problem all right.
Regards,
Arjen

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page