Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7942 Discussions

Static library issue with 64 bits Linux (relocation R_X86_64_32)

regis_vincent
Beginner
312 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
Honored Contributor III
312 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).
0 Kudos
Reply