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

Link Advisor Problem

steingre
Beginner
735 Views

To Whom It May Concern,

I have a problem with the MKL library. I cannot compile my file and it seems that the MKL is not properly linked. I followed the steps to include the additinal dependencies: MKL\\bin and the MKL\\library\\intel64 files but I get the following error message:

Error 1 error LNK2019: unresolved external symbol _DGESV_MKL95 referenced in function _HP_MATRIX tools.obj

Error 2 error LNK2019: unresolved external symbol _DGESV1_MKL95 referenced in function _NEWTON tools.obj

Error 3 error LNK2019: unresolved external symbol _ZGGES_MKL95 referenced in function _SCHUR_SOLVE_OLD tools.obj

Error 4 error LNK2019: unresolved external symbol _ZGESV_MKL95 referenced in function _SCHUR_SOLVE_OLD tools.obj

Error 5 error LNK2019: unresolved external symbol _DGGES_MKL95 referenced in function _SCHUR_SECOND_ORDER_OLD tools.obj

Error 6 error LNK2019: unresolved external symbol _DTGSYL_MKL95 referenced in function _SCHUR_SECOND_ORDER_OLD tools.obj

Error 7 error LNK2019: unresolved external symbol _DGETRF_MKL95 referenced in function _DET tools.obj

Error 8 error LNK2019: unresolved external symbol _DSYEV_MKL95 referenced in function _NEWTON_DFP tools.obj


I am running the Intel fortran 10.0. with the MKL 10.3. on the 64 bit machine. I used the following linker settings:

mkl_lapack95_ilp64.lib mkl_intel_ilp64_dll.lib mkl_sequential_dll.lib mkl_core_dll.lib

I appreciate any help!!!!!!

Best,
steingre

0 Kudos
17 Replies
mecej4
Honored Contributor III
735 Views
The name decoration for the missing externals (e.g., _DGETRF_MKL95) suggest that you are trying to link 32-bit objects with 64-bit libraries. The routine name in mkl_lapack95_ilp64.lib, for example, is DGETRF_MKL95.
0 Kudos
steingre
Beginner
735 Views
Thank you very much for your help.

However, I do not understand what I should correct.

I am runningthe code on a Windows 64 bit machine and I use the following command to access the lapack

use mkl95_lapack, only : GETRF

call GETRF(a, IPIV=ipiv, INFO=info)

I think that this is correct since it works on my 32 bit machine.

You are right in that I have troubles running the code on a 64 bit machine.

Now, you mention that I link 32 objects with a 64 bit library. So how can I change my 32 bit libraries to 64 bit libraries? What do I do wrong?

i tried to put the 32 bit links to access 32 bit librariesbut it won't work.

I appreciate your help!!!

Best,
steingre

0 Kudos
mecej4
Honored Contributor III
735 Views
Since we do not know what/how you compiled and attempted to link, it is difficult to say why the linking failed.

Here is an example that someone posted to this forum some time ago.
[fortran]program invert
use mkl95_lapack,only : getrf,getri
implicit none
integer, parameter :: N = 7
integer :: i,j
real, dimension(N,N) :: A = &
  (/ 1.0658,   -0.6313, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, &
   -0.6313, 4.2632,  -1.8940, 0.0000, 0.0000, 0.0000, 0.0000, &
  0.0000,  -1.8940, 8.5265,  -3.1567, 0.0000, 0.0000, 0.0000, &
  0.0000, 0.0000,  -3.1567,  23.2603,  -3.6892, 0.0000, 0.0000, &
  0.0000, 0.0000, 0.0000,  -3.6892,  37.5680 , -4.8192, 0.0000, &
  0.0000, 0.0000, 0.0000, 0.0000,  -4.8192,  47.5467,  -5.9492, &
  0.0000, 0.0000, 0.0000, 0.0000, 0.0000,  -5.9492,  57.5255 /)
integer, dimension(N) :: piv
integer :: info

call getrf( a, piv, info )
call getri( a, piv, info )
write(*,10)((a(i,j),j=1,N),i=1,N)
stop

10 format(1x,7F12.6)
end program invert
[/fortran]
Compiling:

[bash]s:lang> ifort /Qmkl getrf.f90 mkl_lapack95_lp64.lib
[/bash]


0 Kudos
steingre
Beginner
735 Views
I proceeded the following way:
First, I set the environment variables:

intel64\mklvars_intel64.bat
Then, I set up MS Visual Studio.
I include the following files in the solution explorer:
the lapack.f90 file from the folder: "C:\Program Files\Intel\Composer XE 2011 SP1\mkl\include" together with my own Fortran Files.

Then, I did the following:

Select Configuration Properties > Fortran > General. In the right-hand part of the window, select Additional Include Directories >

C:\Program Files\Intel\Composer XE 2011 SP1\mkl include

Select Configuration Properties > Fortran > Preprocessor. In the right-hand part of the window, select Preprocess Source File > Yes (default is No).

Select Configuration Properties > Linker > General. In the right-hand part of the window, select Additional Library Directories >

C:\Program Files\Intel\Composer XE 2011 SP1\mkl\lib\intel64

Select Configuration Properties > Linker > Input. In the right-hand part of the window, select Additional Dependencies and type the libraries required.I put the following link:

mkl_lapack95_ilp64.lib mkl_intel_ilp64_dll.lib mkl_sequential_dll.lib mkl_core_dll.lib

That's the way I compiled it.
I guess the command would be:
ifort lapack.f90 myfiles.f90 plus the links
0 Kudos
mecej4
Honored Contributor III
735 Views
Did you select the target as x64 (instead of win32)?

If you use libraries named *ilp*.lib, you need to compile your sources with INTEGER*8 or with the -i8 option.
0 Kudos
steingre
Beginner
735 Views
Thank you very much for your suggestion. I indeed forgot to set x64 as target. However, I have new error messages that I do not understand. I still compile with the same options. Here are the messages:

Error1 error LNK2019: unresolved external symbol for_array_copy_in referenced in function ZGGES_F95mkl_lapack95_ilp64.lib
Error2 error LNK2001: unresolved external symbol for_array_copy_inmkl_lapack95_ilp64.lib
Error3 error LNK2001: unresolved external symbol for_array_copy_inmkl_lapack95_ilp64.lib
Error4 error LNK2019: unresolved external symbol for_array_copy_out referenced in function ZGGES_F95mkl_lapack95_ilp64.lib
Error5 error LNK2001: unresolved external symbol for_array_copy_outmkl_lapack95_ilp64.lib
Error6 error LNK2001: unresolved external symbol for_array_copy_outmkl_lapack95_ilp64.lib
Error7 fatal error LNK1120: 2 unresolved externalsx64\Debug\steingre.exe

Do you have any idea what I am doing wrong now?

I also will try the sample you gave me and see what I get. Let you know soon!

Best,
steingre


0 Kudos
steingre
Beginner
735 Views
Hi,

I ran the sample you gave me and it works!

But I do not know why this one works and the other not????


Best,
steingre
0 Kudos
mecej4
Honored Contributor III
735 Views
The undefined externals are in the standard Fortran runtime, e.g., libifcoremd.lib. Check your build log to see why this library was not searched after the MKL libraries were scanned.

0 Kudos
steingre
Beginner
735 Views
This is the output of the log buildfile:

------ Build started: Project: CG2, Configuration: Debug|x64 ------

Linking...

Link /OUT:"x64\Debug\CG2.exe" /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\Program Files (x86)\Intel\Composer XE 2011 SP1\mkl\lib\intel64" /MANIFEST /MANIFESTFILE:"C:\Fortran\CG\CG2\CG2\x64\debug\cg2.exe.intermediate.manifest" /DEBUG /PDB:"C:\Fortran\CaG\CG2\CG2\x64\debug\cg2.pdb" /SUBSYSTEM:CONSOLE mkl_lapack95_lp64.lib mkl_intel_lp64_dll.lib mkl_sequential_dll.lib mkl_core_dll.lib "x64\Debug\nlpqlp.obj" "x64\Debug\ql.obj" "x64\Debug\nlpqly.obj" "x64\Debug\numerical_recipes.obj" "x64\Debug\lapack.obj" "x64\Debug\tools.obj" "x64\Debug\model3.obj"

Link: executing 'link'

mkl_lapack95_lp64.lib(zgges.obj) : error LNK2019: unresolved external symbol for_array_copy_in referenced in function ZGGES_F95

mkl_lapack95_lp64.lib(dgges.obj) : error LNK2001: unresolved external symbol for_array_copy_in

mkl_lapack95_lp64.lib(dtgsyl.obj) : error LNK2001: unresolved external symbol for_array_copy_in

mkl_lapack95_lp64.lib(zgges.obj) : error LNK2019: unresolved external symbol for_array_copy_out referenced in function ZGGES_F95

mkl_lapack95_lp64.lib(dgges.obj) : error LNK2001: unresolved external symbol for_array_copy_out

mkl_lapack95_lp64.lib(dtgsyl.obj) : error LNK2001: unresolved external symbol for_array_copy_out

x64\Debug\CG2.exe : fatal error LNK1120: 2 unresolved externals

CG2 - 7 error(s), 0 warning(s)


Can you tell me what should I correct? What do I miss here?

It is bizarre that the example you sent works and my code not...

Again, I appreciate really your help!

Best,
Steingre

0 Kudos
mecej4
Honored Contributor III
735 Views
I do not know what the problem may be but, based on one of the earlier posts in this thread, if you do not mind, please try this: CLEAN the project and then REBUILD.

If that does not work, please add the /verbose option to the linker command line, REBUILD, and report the linker output as you did above.
0 Kudos
steingre
Beginner
735 Views
Instead of cleaning the project, I made a new project and it does not work either.
I'll try the verbose option
By the way, it is not a problem that I am using INTEL FORTRAN compiler 10.0. and MKL 10.3.? Are they compatible? I could not find information on compatibility...
Best,
steingre
0 Kudos
TimP
Honored Contributor III
735 Views
It appears that your newer MKL libraries are calling run-time functions which may not be present in the library installation of the older ifort.
To my knowledge, the only information given on this subject is that the run-time libraries are tested for compatibility with the previous major compiler release. That would imply that the latest MKL would work with the 11.0 compiler, if you updated the libraries to those supplied with the 12.0 compiler. The 12.0 libraries would not have been tested with the 10.0 compiler, but it is possible they may work.
0 Kudos
steingre
Beginner
735 Views
Thank you for your advice.
I have a subscription with intel for the 10.0. compiler. Do you mean that I would need to buy the 11.0. version?
In fact, I have only a trial version of the MKL 10.3. in order to test a program. Do you know which previous version of the MKL is compatible with the Intel Fortran Compiler 10.0. version?
I appreciate your help!
Best,
steingre
0 Kudos
TimP
Honored Contributor III
735 Views
The oldest MKL visible to me for download is 10.0, which I think was issued with ifort 10.1, so ought to work with ifort 10.0.
0 Kudos
mecej4
Honored Contributor III
735 Views
If you have the 10.0 compiler (2008?), you may, indeed, have problems getting it to work with the current MKL library. Note that the current version is 12.1, not the 11.0 version that you mentioned.

You have to decide whether to upgrade the compiler, or to download an older version of MKL. Note that the 10.0 version of MKL probably did not come with pre-built Lapack95 and Blas95 libraries, in which case the source codes and a makefile were provided from which you would need to build the libraries yourself.

0 Kudos
steingre
Beginner
735 Views
Thank you for your reply. I know that the 11.0. version is running with MKL 10.3. Of course, if I have to upgrade then I can upgrade straight to the newsest version...
I'lll try the 10.0. version and see whether it works or not! However, thank you very much for all the help!
Best,
steingre
0 Kudos
Gennady_F_Intel
Moderator
735 Views
Steingre,
one note:
Compiler version 11.0 bundled with MKL 10.1.*
11.1 ......................... 10.2.*
12.1 ......................... 10.3.*
please check the latest versions as Tim and mecej4 have already recommended.
--Gennady

0 Kudos
Reply