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

Dynamic linking error when using dgees() or zgees() LAPACK functions

ediap
Beginner
511 Views
Hi!

I use MS Visual C++ 2005 Express compiler and Intel MKL 10.0.1.015. When I try to link dynamically a simple C++ program that uses dgees() or zgees() LAPACK functions from MKL, I get the following error:

1>Linking...
1>mkl_core_dll.lib(_dgees_dyn.obj) : error LNK2005: _select_cdc_dgees1 already defined in mkl_intel_c_dll.lib(_dgees_dll.obj)
1>schur_mkl.exe : fatal error LNK1169: one or more multiply defined symbols found

This error occures only with MKL 10 and dynamic linking (to DLL libraries). Static linking with this MKL version works fine.
Here are the MKL libraries I try to link to (for ia32 architecture):
"mkl_intel_c_dll.lib mkl_sequential_dll.lib mkl_core_dll.lib".

Linking to a dummy library "mkl_c_dll.lib" results in the same error.
I can successfully link dynamically the same example program with MKL 9.1 and MKL 8.1 on the same system.

Can you confirm that it is a bug of MKL 10?
If not, how should I link dynamically the C++ prgrams that use dgees() and zgees() LAPACK functions?

BR,
/Adam

PS. Here is the source code of a minimal examle program which can be used to reproduce this problem:

#include

using namespace std;

#define dgees_ dgees
#define A_SIZE 4
#define A_ROWS (A_SIZE >> 1)

extern "C" {
void dgees_(char *jobvs, char *sort, int* select, int *n,
double *a, int *lda, int *sdim, double *wr,
double *wi, double *vs, int *ldvs, double *work,
int *lwork, int *bwork, int *info);
}

int main() {
double A[A_SIZE] = { 1, 5.0, -2.3, 1e-3 };

char jobvs = 'V';
char sort = 'N';
int info;
int n = A_ROWS;
int lda = n;
int ldvs = n;
int lwork = 3 * n;
int sdim = 0;

double wr[A_ROWS];
double wi[A_ROWS];
double work[3 * A_ROWS];

double T[A_SIZE];
double U[A_SIZE];

for (int i = 0; i < A_SIZE; ++i)
T = A;

dgees_(&jobvs, &sort, 0, &n, T, &lda, &sdim, wr, wi,
U, &ldvs, work, &lwork, 0, &info);

cout << "T = [ ";
for (int i = 0; i < A_SIZE; ++i)
cout << T << " ";
cout << "]" << endl;

cout << "U = [ ";
for (int i = 0; i < A_SIZE; ++i)
&nb sp; cout << U << " ";
cout << "]" << endl;

return 0;
}


0 Kudos
3 Replies
TimP
Honored Contributor III
511 Views

Your error message appears to say that you shouldn't use mkl_c library (not, I believe, a new style "layered" library) along with mkl_core. My guess is that you should use mkl_sequential and mkl_core. I would agree that the documentation is buggy, if it led you to unsuccessful combinations. Static link may be successful where dynamic is not, if the objects you actually want are found before any duplicated names of different functionality.
0 Kudos
ediap
Beginner
511 Views
Hi Tim,

Your suggestion to use only mkl_sequential with mkl_core does not work. In such case, the _dgees symbol is unresolved:


1>Linking...
1>schur_mkl.obj : error LNK2001: unresolved external symbol _dgees
1>schur_mkl.exe : fatal error LNK1120: 1 unresolved externals

This is expected behaviour, since the interface library is missing. And according to the documentation one has to select the interface library, threading library and computational library at least.

So, I believe that the documentation is OK, but there is a problem in MKL's DLL libraries in this case. Especially that other LAPACK functions (dgeev(), zgeev(), dgesvd() and zgesvd()) can be used without any problems with the same set of libraries, i.e.: "mkl_intel_c_dll.lib mkl_sequential_dll.lib mkl_core_dll.lib".

Do you happen to know where should I report this bug? Is there any bug tracker service for MKL?

Thanks again for your help.

BR,
/Adam
0 Kudos
Andrey_Bespalov
New Contributor I
511 Views

Yes, it is the error in MKL DLL libraries. The error will be fixed in the nearest time.

0 Kudos
Reply