Linking statically to Intel libraries

Linking statically to Intel libraries

Bild des Benutzers gmorris

I'm using ifc 6.0.1. It seems that the default setup will link dynamically to certain Intel libraries (for example libcxa), and statically to others.

There exists the -i_dynamic option to link dynamically to ALL the Intel libraries, and -static to link statically with EVERY library. Is there any way to link statically with all the Intel libraries, but dynamically with the standard system libraries? This would obviously be very useful for compiling executables to run on machines without ifc installed, whilst still keeping the binary size down. NAG f95 has the option -unsharedf95 for this.

At the moment, I achieve the results I want by the dubious tactic of just hiding libcxa.so from the compiler, so it is forced to link with the static version!

Thanks in advance for any help.

3 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.
Bild des Benutzers John O (Intel)

Good question, and one that others have asked which lead to the 7.0 version of ifc that is coming out soon (should be end of the month) which add this option:

-static-libcxa: Link the libcxa library statically.

This will avoid linking libcxa dynamically, I'm not sure if other Fortran libs are dynamically linked by default.
If there are others, I'd suggest filing a feature request on Intel Premier Support website.

If this doesn't work, you can find out what libs are being linked in, run ifc -dryrun which will write to stderr all of the options being passed to compiler & linker, including static vs. dynamic libs. This would let you see what you need to change if you wanted to link manually. This isn't as nice as a compiler switch.

regards,
john

Bild des Benutzers gmorris

Thanks for the information.

I've just downloaded ifc 7 and the option -static-libcxa seems to do what I want. As far as I can tell libcxa is the only library dynamically linked by default.

This new option seems to be completely undocumented though (not in the --help output, nor the man page, nor the User Guide). Guess I'll be reporting this as a documentation bug...

Melden Sie sich an, um einen Kommentar zu hinterlassen.