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

Static Library Problems

Junpeng_Lu
Beginner
430 Views

Hi, everyone. I am using Intel C\C++ compiler (icl.exe) and Fortran compiler (ifort.exe) to produce a static library under Windows7 and redistribute it to someone possibly without any Intel dependencies.

 

I already compiled all source code into .obj files and used xilink.exe to produce a static library. But when i linked main.c with this static library in a virtual machine with Visual Stdio 2013 and without any Intel library dependencies, many similar errors like "fatal error LNK1104: cannot open file 'ifconsol.lib'" occurred. After i read this topic: https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/559316, i tried putting all the needed Intel Compiler library into the virtual machine. Then compilation and output of main.c is correct.

 

However, my goal is to produce just one static library. So i try to include the needed Intel Compiler library into my static library with command: "xilink -lib /OUT:self_defined.lib self_defined_solver.lib ifconsol.lib". I deleted all the needed Intel Compiler library in virtual machine and recompile the main.c. To my surprise, the above error still came out, which means ifconsol.lib have to be linked explicitly.

 

I wonder if i could include all the needed Intel Compiler library in my static library? If can, did i make some mistakes? 

 

Thanks in advance! I have checked Developer Guider but found no clue to this problem.

0 Kudos
1 Reply
Kevin_D_Intel
Employee
430 Views

You have not made any mistake. The static library is not self-contained (https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/393759#comment-1739627) so as discussed in the forum post you cited you need to consider building the static library and redistributing the necessary Intel (static or dynamic) libraries with yours, or building a DLL instead (see the URL above) with either Intel static or dynamic libraries and redistributing the necessary Intel libraries with yours.

When using Intel dynamic libs, you can direct users to install the appropriate redistributables (https://software.intel.com/en-us/articles/intelr-composer-redistributable-libraries-by-version) if you wish.

0 Kudos
Reply