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

Problem static linking Intel libraries with link

dfumento
Beginner
1,179 Views
Hi,
I have precompiled binaries from gcc and Intel Fortran. With either Intel 7.1 or Intel 8 I understand that the Intel libraries should be statically linked unless you specify -dynamic.

When I try to link these pre-compiled binaries with ifort or ifc, the Intel Fortran libraries are dynamically linked (if I update the Intel Fortran compiler, my long running jobs terminate).

What can I do to statically link the Intel Fortran libraries when I'm doing only a link with ifort and not a compile?

Thanks,
David
0 Kudos
4 Replies
TimP
Honored Contributor III
1,179 Views
If you have the .o files or .a (static) libraries, you can repeat the link, with the additional option -static. This will choose static libraries, in most cases where there is a choice.
0 Kudos
dfumento
Beginner
1,179 Views
Thanks, but -static doesn't work because I have third party libraries which I only have dynamic versions of. Still, I need the Intel Fortran libraries to be linked statically so I can update my Fortran compiler for my long running jobs.

What option do I use to statically link a library if it is available as static but to otherwise link a dynamic version?

Thanks,
David
0 Kudos
TimP
Honored Contributor III
1,179 Views

-static still ought to work, it only gives the preference for when both versions of a library are available at link time.

Another possibility would be to copy the dynamic libraries used by your application into a directory you reserve for this purpose, and set your LD_LIBRARY_PATH accordingly in the shell where you start the application. Then, you could change the compiler installation without disturbing the running application.

0 Kudos
dfumento
Beginner
1,179 Views
I think -static ought to work as you suggested, picking up the static library if there is one otherwise picking up the dynamic library, but instead my link aborts.

I fixed the problem by explicitly stating the entire path for each of the Intel Fortran libraries (e.g. /usr/local/intel/.../lib/libPEPCF90.a)

Thanks,
David
0 Kudos
Reply