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

libiomp5.a error for static shared library

Kevin_Wilson
Beginner
1,125 Views
Hello,

In Linux 64-bit I get the following error when trying to compile my file:

ld: /opt/intel/Compiler/11.1/069/lib/intel64/libiomp5.a(kmp_csupport.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC

I have seen a post refering to linking against libiomp5.so. Is this the solution? If so, how do I tell the compiler to ignore the .a and use .so?

Thank you for any help,
Kevin
0 Kudos
4 Replies
TimP
Honored Contributor III
1,125 Views
icc/icpc should default to -openmp-link dynamic, which would set up the linker script to link libiomp5.so. Your situation is one of the reasons why the compiler is set up to go to such lengths to prefer that. Of course, if you use some other method to drive the link, and specify -static, you may be setting up a preference for the .a library. In any case, if you specify libiomp5.so explicitly, that should over-ride.
0 Kudos
aazue
New Contributor I
1,125 Views
Hi
With my small contol your language and if i have understand correctly you want use shared (.so lib )
require (-fPIC -ansi -shared-intel)
icpc -fPIC -ansi -shared-intel -axSSSE3 -Os -fast -openmp -openmp-lib=compat -openmp-report - ect .......
Best regards

0 Kudos
Kevin_Wilson
Beginner
1,125 Views
Ideally, I would like to use all static libraries, however it seems libiomp5.a is unable to link. My options so far are the following:

-parallel -O3 -ip -m64 -static-intel -fPIC

The "-static-intel" is supposed to have no effect on which OpenMP run-time library is linked. So the default "-openmp-link dynamic" should be used (and I've tried to add it to the command line).

I'm still unclear why the static libiomp5.a is being chosen. As a work around I have added the shared libiomp5.so to the command to link directly to it.

Thanks for the help
- Kevin
0 Kudos
aazue
New Contributor I
1,125 Views
The "-static-intel" is supposed to have no effect on which OpenMP run-time library is linked.
Hi
Yes only if the library is without an other included as shared, that require run-time.
If use shared you have your weight program reduced.
static(is default to your program) you have the program more heavy but is not completely independent (this example).
Also fPIC is for object your program , not for the lib that have already or not.
Best regards
0 Kudos
Reply