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

Visual Studio 2015, Parallel Studio 2017 Update 2, link does not include the FFTW etc libraries

bevin_b_
New Contributor I
644 Views

'I have just repaired my VS 2017 installation after some weird problem (maybe caused by PS 2017 Update 2 install)

​After that I had to completely uninstall and reinstall  all my PS products because there was no other way to get it to reintegrate into VS 2015  (change components via Control Panel  Uninstall... for example did not do it)

With this done the Intel Performance Libraries appears in the VS pulldowns again, and the "use MKL" choice now lets C++ find the include files.   The link, on the other hand, is a dismal failure.    It doesn't work, and there is no obvious way of deciding why it doesn't work - for example the "whole command line" property on the project - linker property page does not include any MKL stuff even when it does work

To say that I find the integration of PS into VS to be a source of frustration rather than help is an understatement.  It is poorly documented and a continuous source of problems.

1>findBestPoints.obj : error LNK2019: unresolved external symbol LAPACKE_dlasrt referenced in function "public: virtual void __cdecl FindBestPoints_Impl_Sort::prepareToPop(void)" (?prepareToPop@FindBestPoints_Impl_Sort@@UEAAXXZ)
1>map3d_optimizer_old.obj : error LNK2001: unresolved external symbol LAPACKE_dlasrt
1>fft_base.obj : error LNK2019: unresolved external symbol fftw_init_threads referenced in function "public: void __cdecl FFTWBase::init(double *,double (*)[2],unsigned __int64,unsigned __int64,unsigned __int64,int)" (?init@FFTWBase@@QEAAXPEANPEAY01N_K22H@Z)
1>fft_base.obj : error LNK2019: unresolved external symbol fftw_plan_with_nthreads referenced in function "public: void __cdecl FFTWBase::init(double *,double (*)[2],unsigned __int64,unsigned __int64,unsigned __int64,int)" (?init@FFTWBase@@QEAAXPEANPEAY01N_K22H@Z)
1>fft_base.obj : error LNK2019: unresolved external symbol fftw_cleanup_threads referenced in function "public: void __cdecl FFTWBase::fini(void)" (?fini@FFTWBase@@QEAAXXZ)
1>fft_base.obj : error LNK2019: unresolved external symbol fftw_plan_dft_r2c_2d referenced in function "protected: void __cdecl FFTWBase::create_plan(void)" (?create_plan@FFTWBase@@IEAAXXZ)
1>fft_base.obj : error LNK2019: unresolved external symbol fftw_plan_dft_c2r_2d referenced in function "protected: void __cdecl FFTWBase::create_plan(void)" (?create_plan@FFTWBase@@IEAAXXZ)
1>fft_base.obj : error LNK2019: unresolved external symbol fftw_plan_dft_r2c_3d referenced in function "protected: void __cdecl FFTWBase::create_plan(void)" (?create_plan@FFTWBase@@IEAAXXZ)
1>fft_base.obj : error LNK2019: unresolved external symbol fftw_plan_dft_c2r_3d referenced in function "protected: void __cdecl FFTWBase::create_plan(void)" (?create_plan@FFTWBase@@IEAAXXZ)
1>fft_base.obj : error LNK2019: unresolved external symbol fftw_destroy_plan referenced in function "protected: void __cdecl FFTWBase::delete_plan(void)" (?delete_plan@FFTWBase@@IEAAXXZ)
1>fft_base.obj : error LNK2019: unresolved external symbol fftw_cleanup referenced in function "protected: void __cdecl FFTWBase::delete_plan(void)" (?delete_plan@FFTWBase@@IEAAXXZ)
1>fft_base.obj : error LNK2019: unresolved external symbol fftw_execute referenced in function "protected: void __cdecl FFTWBase::forward_execute(void)" (?forward_execute@FFTWBase@@IEAAXXZ)
1>fft_base.obj : error LNK2019: unresolved external symbol fftwf_init_threads referenced in function "public: void __cdecl FFTWFBase::init(float *,float (*)[2],unsigned __int64,unsigned __int64,unsigned __int64,int)" (?init@FFTWFBase@@QEAAXPEAMPEAY01M_K22H@Z)
1>fft_base.obj : error LNK2019: unresolved external symbol fftwf_plan_with_nthreads referenced in function "public: void __cdecl FFTWFBase::init(float *,float (*)[2],unsigned __int64,unsigned __int64,unsigned __int64,int)" (?init@FFTWFBase@@QEAAXPEAMPEAY01M_K22H@Z)
1>fft_base.obj : error LNK2019: unresolved external symbol fftwf_cleanup_threads referenced in function "public: void __cdecl FFTWFBase::fini(void)" (?fini@FFTWFBase@@QEAAXXZ)
1>fft_base.obj : error LNK2019: unresolved external symbol fftwf_plan_dft_r2c_2d referenced in function "protected: void __cdecl FFTWFBase::create_plan(void)" (?create_plan@FFTWFBase@@IEAAXXZ)
1>spider.obj : error LNK2001: unresolved external symbol fftwf_plan_dft_r2c_2d
1>spider_old.obj : error LNK2001: unresolved external symbol fftwf_plan_dft_r2c_2d
1>fft_base.obj : error LNK2019: unresolved external symbol fftwf_plan_dft_c2r_2d referenced in function "protected: void __cdecl FFTWFBase::create_plan(void)" (?create_plan@FFTWFBase@@IEAAXXZ)
1>spider.obj : error LNK2001: unresolved external symbol fftwf_plan_dft_c2r_2d
1>spider_old.obj : error LNK2001: unresolved external symbol fftwf_plan_dft_c2r_2d
1>fft_base.obj : error LNK2019: unresolved external symbol fftwf_plan_dft_r2c_3d referenced in function "protected: void __cdecl FFTWFBase::create_plan(void)" (?create_plan@FFTWFBase@@IEAAXXZ)
1>fft_base.obj : error LNK2019: unresolved external symbol fftwf_plan_dft_c2r_3d referenced in function "protected: void __cdecl FFTWFBase::create_plan(void)" (?create_plan@FFTWFBase@@IEAAXXZ)
1>fft_base.obj : error LNK2019: unresolved external symbol fftwf_destroy_plan referenced in function "protected: void __cdecl FFTWFBase::delete_plan(void)" (?delete_plan@FFTWFBase@@IEAAXXZ)
1>spider.obj : error LNK2001: unresolved external symbol fftwf_destroy_plan
1>spider_old.obj : error LNK2001: unresolved external symbol fftwf_destroy_plan
1>fft_base.obj : error LNK2019: unresolved external symbol fftwf_cleanup referenced in function "protected: void __cdecl FFTWFBase::delete_plan(void)" (?delete_plan@FFTWFBase@@IEAAXXZ)
1>fft_base.obj : error LNK2019: unresolved external symbol fftwf_execute referenced in function "protected: void __cdecl FFTWFBase::forward_execute(void)" (?forward_execute@FFTWFBase@@IEAAXXZ)
1>spider.obj : error LNK2001: unresolved external symbol fftwf_execute
1>spider_old.obj : error LNK2001: unresolved external symbol fftwf_execute
1>fft_fftw3.obj : error LNK2019: unresolved external symbol fftw_malloc referenced in function "public: __cdecl FFTWTransformer::FFTWTransformer(unsigned __int64,unsigned __int64,unsigned __int64)" (??0FFTWTransformer@@QEAA@_K00@Z)
1>fft_fftw3.obj : error LNK2019: unresolved external symbol fftw_free referenced in function "public: __cdecl FFTWTransformer::~FFTWTransformer(void)" (??1FFTWTransformer@@QEAA@XZ)
1>fft_fftw3.obj : error LNK2019: unresolved external symbol fftwf_malloc referenced in function "public: __cdecl FFTWFTransformer::FFTWFTransformer(unsigned __int64,unsigned __int64,unsigned __int64)" (??0FFTWFTransformer@@QEAA@_K00@Z)
1>spider_old.obj : error LNK2001: unresolved external symbol fftwf_malloc
1>fft_fftw3.obj : error LNK2019: unresolved external symbol fftwf_free referenced in function "public: __cdecl FFTWFTransformer::~FFTWFTransformer(void)" (??1FFTWFTransformer@@QEAA@XZ)
1>spider_old.obj : error LNK2001: unresolved external symbol fftwf_free
1>initialize.obj : error LNK2019: unresolved external symbol LAPACKE_dgels referenced in function "void __cdecl mkl_solveNotdetermined(double *,int,int,double *,int)" (?mkl_solveNotdetermined@@YAXPEANHH0H@Z)
1>pca_optimizer.obj : error LNK2001: unresolved external symbol LAPACKE_dgels
1>initialize.obj : error LNK2019: unresolved external symbol LAPACKE_sgels referenced in function "void __cdecl mkl_solveNotdetermined(float *,int,int,float *,int)" (?mkl_solveNotdetermined@@YAXPEAMHH0H@Z)
1>pca_optimizer.obj : error LNK2019: unresolved external symbol vsldSSNewTask referenced in function "private: int __cdecl Pca::mkl_cov(double *,int,int,double *,double *)" (?mkl_cov@Pca@@AEAAHPEANHH00@Z)
1>pca_optimizer.obj : error LNK2019: unresolved external symbol vsldSSEditCovCor referenced in function "private: int __cdecl Pca::mkl_cov(double *,int,int,double *,double *)" (?mkl_cov@Pca@@AEAAHPEANHH00@Z)
1>pca_optimizer.obj : error LNK2019: unresolved external symbol vsldSSCompute referenced in function "private: int __cdecl Pca::mkl_cov(double *,int,int,double *,double *)" (?mkl_cov@Pca@@AEAAHPEANHH00@Z)
1>pca_optimizer.obj : error LNK2019: unresolved external symbol vslSSDeleteTask referenced in function "private: int __cdecl Pca::mkl_cov(double *,int,int,double *,double *)" (?mkl_cov@Pca@@AEAAHPEANHH00@Z)
1>pca_optimizer.obj : error LNK2019: unresolved external symbol vsldSSEditTask referenced in function "private: double __cdecl Pca::mkl_meanVec(double *,int)" (?mkl_meanVec@Pca@@AEAANPEANH@Z)
1>pca_optimizer.obj : error LNK2019: unresolved external symbol LAPACKE_dsytrd referenced in function "private: double * __cdecl Pca::mkl_eig(double *,int)" (?mkl_eig@Pca@@AEAAPEANPEANH@Z)
1>pca_optimizer.obj : error LNK2019: unresolved external symbol LAPACKE_dorgtr referenced in function "private: double * __cdecl Pca::mkl_eig(double *,int)" (?mkl_eig@Pca@@AEAAPEANPEANH@Z)
1>pca_optimizer.obj : error LNK2019: unresolved external symbol LAPACKE_dsteqr referenced in function "private: double * __cdecl Pca::mkl_eig(double *,int)" (?mkl_eig@Pca@@AEAAPEANPEANH@Z)
1>pca_optimizer.obj : error LNK2019: unresolved external symbol cblas_dgemm referenced in function "private: double * __cdecl Pca::mkl_multiplyMat(double *,int,int,double *,int,int)" (?mkl_multiplyMat@Pca@@AEAAPEANPEANHH0HH@Z)
1>C:\local\ipccsb\ROME1.1\Windows\rome_map3d\x64\Debug\rome_map3d.exe : fatal error LNK1120: 36 unresolved externals
 

0 Kudos
5 Replies
Zhen_Z_Intel
Employee
644 Views

Hi Bevin,

MKL does not provide integration for FFTW with VS. FFTW lib should be generated by your self (nmake to generate under %MKLROOT%\interface\fftw3xc) and add it to additional linkage. You will also required to include FFTW header which is saved in Please refer this link to learn: 
Building Your Own FFTW3 Interface Wrapper Library
Building an Application With FFTW3 Interface Wrappers

Best regards,
Fiona

0 Kudos
bevin_b_
New Contributor I
644 Views

Well, that explains a small part of my problem, but it does not explain

​1) Why it did work until recently when I had to repair VS and reintegrate PS into VS

​2) Why the following does not work
 

#include "stdafx.h"
#include <mkl.h>
int main()
{
 double *A = nullptr;
 int N  = 0;
 int M  = 0;
 double *B = nullptr;
 int D  = 0;
 int info = LAPACKE_dgels(LAPACK_ROW_MAJOR, 'N', N, M, D, A, M, B, D);
 return 0;
}
 

1>------ Build started: Project: Use_LAPACK, Configuration: Debug x64 ------
1>  Use_LAPACK.cpp
1>Use_LAPACK.obj : error LNK2019: unresolved external symbol LAPACKE_dgels referenced in function main
1>c:\users\bevin\onedrive\documents\visual studio 2015\Projects\Use_LAPACK\x64\Debug\Use_LAPACK.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
 

 

0 Kudos
Zhen_Z_Intel
Employee
644 Views

Hi bevin,

Seems there's something wrong with VS integration that mkl lib are not been linked. I checked IPS2017u2 do not have this bug. I recommend to re-install it. If do not want to, you could add MKL include & lib path manually. Please refer this document.

0 Kudos
bevin_b_
New Contributor I
644 Views

I have worked through the issue and the above answer is completely wrong.  I did not have to build fftw myself to solve the problem, I did not have to reinstall, I just had to add the right libraries to the link input because the MKL integration failed to put them in itself.

​There is a bug in the way the Intel Compiler interacts with MKL in the Visual Studio Integration.   When using the VC++ compiler the problem does not exist.

A workaround is to add the MKL libraries into the Properties  ->  Linker  ->  Input.     I had to add

     mkl_intel_lp64_dll.lib mkl_sequential_dll.lib mkl_core_dll.lib

​Other people should use https://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-compiling-and-linking-with-microsoft-visual-cc link line advisor to get the libraries they should add

​Here is my complete reproducer...

 

 Using VS 2015, PS 2018
 Create a C++ Win32 Console App, Name PS_2018_Bug__LAPACKE_dgels__trial1
  Don't customize anything
 Change to the Debug x64 configuration
 Change main.cpp contents to be
 
  #include "stdafx.h"
  #include <mkl.h>
  int main()
  {
   double *A = nullptr;
   int N  = 0;
   int M  = 0;
   double *B = nullptr;
   int D  = 0;
   int info = LAPACKE_dgels(LAPACK_ROW_MAJOR, 'N', N, M, D, A, M, B, D);
   return 0;
  }
 
 Note: the #include <mkl.h> is marked as an error
 
 Open the project properties
  Change the Configuration to "All configurations"
  Change the Intel Perf Libraries -> Use MKL to be Sequential
  Change the Linker -> Debugging -> Generate map file to be Yes
  Okay
  
 The error markings soon disappear
 
 Build the Solution - it builds successfully
 
 Open the map file C:\Users\bevin\OneDrive\Visual Studio 2015\Projects\PS_2018_Bug__LAPACKE_dgels__trial1\x64\Debug\PS_2018_Bug__LAPACKE_dgels__trial1.map
 You can see entries from
  mkl_intel_lp64_dll
  mkl_sequential_dll
 
 Change the project properties -> Intel Compiler -> Use Intel C++ 2018
 
 Clean the solution
 
 Build the Solution - it fails
  1>------ Build started: Project: PS_2018_Bug__LAPACKE_dgels__trial1, Configuration: Debug x64 ------
  1>  stdafx.cpp
  1>  PS_2018_Bug__LAPACKE_dgels__trial1.cpp
  1>PS_2018_Bug__LAPACKE_dgels__trial1.obj : error LNK2019: unresolved external symbol LAPACKE_dgels referenced in function main
  1>C:\Users\bevin\OneDrive\Visual Studio 2015\Projects\PS_2018_Bug__LAPACKE_dgels__trial1\x64\Debug\PS_2018_Bug__LAPACKE_dgels__trial1.exe : fatal error LNK1120: 1 unresolved externals
  ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
 Look at the Properties -> VC++ Directories
  You can see the
   Include Directories: $(MKLIncludeDir);$(IncludePath)
   Library Directories: $(MKLLibDir);$(LibraryPath)
  Since the #include is working (no compile-time errors) we only look at the Lib Dirs
  Edit it to see what the expansion is
   C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018.0.065\windows\mkl\lib\intel64_win
  
 Open C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018.0.065\windows\mkl\lib\intel64_win
  the mkl_intel_lp64_dll.lib and mkl_sequential_dll.lib files are there
 
 Change the project properties -> Intel Compiler -> Use VC++
 
 Clean the solution
 
 Build the solution - it succeeds again
 
 Change the project properties -> Intel Compiler -> Use Intel C++ 2018
 
 Open the project properties
  Check the Configuration is "All configurations"
  Check the Intel Perf Libraries -> Use MKL is Sequential
  Edit the Linker -> Input
   Add mkl_intel_lp64_dll.lib and mkl_sequential_dll.lib
  Okay
 Build the solution - it succeeds

 

 

0 Kudos
Zhen_Z_Intel
Employee
644 Views

We are investigating on this bug. Thank you for posting the issue.

0 Kudos
Reply