Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
7681 Discussions

Static library issue with 64 bits Linux (relocation R_X86_64_32)

regis_vincent
Beginner
181 Views
I build my software on several platforms using CMake. Everything works fine except on Linux 64 bits using Intel 11.1.073 compiler.
At the link time, I'm getting this error:
ld: /opt/intel/Compiler/11.1/073/lib/intel64/libiomp5.a(kmp_ftn_cdecl.o): relocation R_X86_64_32 against `_2__STRING.0' can not be used when making a shared object; recompile with -fPIC
/opt/intel/Compiler/11.1/073/lib/intel64/libiomp5.a: could not read symbols: Bad value
ld: /opt/intel/Compiler/11.1/073/lib/intel64/libiomp5.a(kmp_ftn_cdecl.o): relocation R_X86_64_32 against `_2__STRING.0' can not be used when making a shared object; recompile with -fPIC/opt/intel/Compiler/11.1/073/lib/intel64/libiomp5.a: could not read symbols: Bad value
I have tried to link the dynamic library of iomp5 and no luck.
0 Kudos
1 Reply
TimP
Black Belt
181 Views
This has been discussed several times before. The static libiomp5 is designed intentionally not to work in shared objects. As you are using icc, you ought to be able to satisfy the openmp references by using icc -openmp (not gcc or ld directly) for the final link, so as to link against libiomp5.so (not by attempting to include portions of the library in your own libraries).
Reply