Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6977 Discussions

Intel MKL fails to link with Intel C++ compiler 2019.04 and newer

Budisky__Jakub
Beginner
1,043 Views

Description:

I'm using Intel MKL to calculate some complex to real DFT transforms and their inverse. In my project I also use `std::exp` math function with float data type. The issue is, that for some reason the `ldexpf` function is both exported from the Intel math library and Intel MKL and the linking step fails:

libmmd.lib(libmmd.dll) : : error LNK2005: ldexpf already defined in mkl_intel_ilp64_dll.lib(dfticreatedescriptor_s_md.obj)

This applies to the static library builds as well:

libmmd.lib(libmmd.dll) : : error LNK2005: ldexpf already defined in mkl_intel_ilp64.lib(dfticreatedescriptor_s_md.obj)

The important change that triggered this behavior can be found in `math.h`, Intel C++ 2019.03 version, starting at line 89:

/* _ldexpf already defined libcpmt.lib, may cause conflict */
/* temporarily allow inline implementation in MS header file */
//#    define ldexpf    __MS_ldexpf

Intel C++ Compiler 2019.04 and later:

#    define ldexpf    __MS_ldexpf

As a workaround, one may a) comment out the above mentioned line again in the `math.h` b) pass `/FORCE:MULTIPLE` to the linker.

Linking:

I did not make a minimal example since the error seems to be straightforward and you dealt with similar issues before: https://software.intel.com/en-us/forums/intel-math-kernel-library/topic/805616 . I usually link "manually" due to the use of different compilers and static linking support (with link line confirmed to be identical to the one generated with MKL link line advisor for Windows, ILP64 API, OpenMP threading) but I get the same result by simply using `-DMKL_ILP64 /Qmkl:parallel`.

Environment:

Intel C++ Compiler Version 19.1.0.166 (but you can use any version starting from 2019.04)
Visual Studio 2017 Version 15.9.15 (VS 2019 tested a while ago with the same outcome), the bug doesn't affect GNU/Linux builds
Intel MKL Version 2020 (tested several versions between 2019 Update 3 and 2020, all affected)

0 Kudos
2 Replies
Gennady_F_Intel
Moderator
1,043 Views

this is a known issue and the fix of the problem will be available into one of the next updates. We will keep this thread updated.

0 Kudos
Gennady_F_Intel
Moderator
1,038 Views

Have you had a chance to try version 2020.1?


0 Kudos
Reply