Static linking with -mkl, -ipp or -tbb may give unresolved references

Reference Number : dpd200252274

Version : Intel® C++ Compiler and Intel® Fortran Compiler versions 13.0.1, 13.1.any, 14.0.0 and 14.0.1

Operating System :  Linux*, OS X*

Problem Description : When an application is linked statically with Intel® MKL using the -mkl switch of the Intel C++ or Fortran Compiler, the MKL libraries occupy the same position on the command line as the -mkl switch itself. If the -mkl switch precedes the user source or object files, this may result in an unresolved reference to an MKL function at link time.

        A similar problem may occur if the Intel® Performance Primitives or Intel® Threading Building Blocks are linked using the -ipp or -tbb switches of the Intel C++ compiler and the switch is placed before the user source or object files.



#include <stdio.h> 
#include <mkl_service.h> 
int main (int argc, char *argv[]) {
  char buf[256];
  printf( "MKL is %sn", buf);
  return 0;
icc -static-intel -mkl -diag-disable 10237 mkl_position.c /tmp/icclUvCs1.o: In function `main': mkl_position.c:(.text+0x48): undefined reference to `MKL_Get_Version_String'


Resolution Status :  This issue is fixed in update 2 to the 14.0 compiler, (14.0.2).

As a workaround for older compilers, the switches -mkl, -ipp or -tbb should be placed after any user source, object or library files on the command line, e.g.:

> icc -static-intel -diag-disable 10237 mkl_position.c -mkl

 Alternatively, the Intel-provided libraries may be linked dynamically instead of statically, e.g. by replacing -static-intel with -shared-intel.


Para obtener información más completa sobre las optimizaciones del compilador, consulte nuestro Aviso de optimización.