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

LNK2005 error when linking to mkl_c.dll (for Lapack function)

dolom
Beginner
838 Views
Hello there! I'm new to MKL so don't get upset if my questionturns out to besilly!
I'm trying to compile my first code (I chose a Lapack function as first example)...
#include "mkl.h"
void main()
{
	char uplo[2] = "L";
	int n = 2;
	float a[4] = {2.0, 0.5, 0.5, 2.0};
	int lda = 2;
	int info = 0;
	spotrf( uplo, &n, a, &lda, &info);
}
but as soon as I link (with mkl_c.lib, as suggested) I get the following error:
mkl_ia32.lib(p4_ssyrk_omp.obj) : error LNK2005: ___ssyrk_104__par_loop0 gi definito in mkl_ia32.lib(p3_ssyrk_omp.obj)

("gia definito" = "already defined") I could compile other examples so I must be missing something specific to Lapack... would you help me? Thank you!

-- Marco --

0 Kudos
5 Replies
Intel_C_Intel
Employee
838 Views

There isn't anything obviously wrong with what you did. I took your program (calling it exp.c) and used the following makefile to build it:

CC = icl
MKLDIR = c:mklmkl6.0ia32lib
MKLINC = c:mklmkl6.0include
exp.exe: exp.obj
link /libpath:$(MKLDIR) exp.obj mkl_c.lib

exp.obj: exp.c
$(CC) /c -I$(MKLINC) exp.c

Here is the result of making the program:

C: emplpexp>nmake

Microsoft Program Maintenance Utility Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.

icl /c -Ic:mklmkl6.0include exp.c
Intel C++ Compiler for 32-bit applications, Version 7.0 Build 20021018Z
Copyright (C) 1985-2002 Intel Corporation. All rights reserved.

exp.c
link /libpath:c:mklmkl6.0ia32lib exp.obj mkl_c.lib
Microsoft Incremental Linker Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.


C: emplpexp>

Please try this out. If you still have a problem come back and we will look at this anew.

Bruce

Message Edited by bsgreer on 01-23-2004 08:14 AM

0 Kudos
dolom
Beginner
838 Views

Hi Bruce!

I've tried the makefile you suggested but interestingly enough I got the same results I had inside the VS.NET IDE...

E:QuantsTestsfoo>nmake

Microsoft  Program Maintenance Utility   versione 7.00.9466
Copyright (C) Microsoft Corporation. Tutti i diritti riservati.

        icl /c -I"E:Program FilesIntelMKL60include" mkltest.c
Intel C++ Compiler for 32-bit applications, Version 7.1   Build 20030307Z
Copyright (C) 1985-2003 Intel Corporation.  All rights reserved.
30 DAY EVALUATION LICENSE

mkltest.c
        link /libpath:"E:Program FilesIntelMKL60ia32lib" mkltest.obj mkl_c.lib
Microsoft  Incremental Linker Version 7.00.9466
Copyright (C) Microsoft Corporation.  All rights reserved.

mkl_ia32.lib(p4_ssyrk_omp.obj) : error LNK2005: ___ssyrk_104__par_loop0 gi definito in mkl_ia32.lib(p3_ssyrk_omp.obj)
mkl_ia32.lib(p4_ssyrk_omp.obj) : error LNK2005: ___ssyrk_162__par_loop1 gi definito in mkl_ia32.lib(p3_ssyrk_omp.obj)
mkl_ia32.lib(def_ssyrk_omp.obj) : error LNK2005: ___ssyrk_104__par_loop0 gi definito in mkl_ia32.lib(p3_ssyrk_omp.obj)
mkl_ia32.lib(def_ssyrk_omp.obj) : error LNK2005: ___ssyrk_162__par_loop1 gi definito in mkl_ia32.lib(p3_ssyrk_omp.obj)
mkl_ia32.lib(p4_sgemm_omp.obj) : error LNK2005: ___sgemm_241__par_loop0 gi definito in mkl_ia32.lib(p3_sgemm_omp.obj)
mkl_ia32.lib(p4_sgemm_omp.obj) : error LNK2005: ___sgemm_259__par_loop1 gi definito in mkl_ia32.lib(p3_sgemm_omp.obj)
mkl_ia32.lib(def_sgemm_omp.obj) : error LNK2005: ___sgemm_241__par_loop0 gi definito in mkl_ia32.lib(p3_sgemm_omp.obj)
mkl_ia32.lib(def_sgemm_omp.obj) : error LNK2005: ___sgemm_259__par_loop1 gi definito in mkl_ia32.lib(p3_sgemm_omp.obj)
mkl_ia32.lib(p4_strsm_omp.obj) : error LNK2005: ___strsm_125__par_loop0 gi definito in mkl_ia32.lib(p3_strsm_omp.obj)
mkl_ia32.lib(p4_strsm_omp.obj) : error LNK2005: ___strsm_148__par_loop1 gi definito in mkl_ia32.lib(p3_strsm_omp.obj)
mkl_ia32.lib(def_strsm_omp.obj) : error LNK2005: ___strsm_125__par_loop0 gi definito in mkl_ia32.lib(p3_strsm_omp.obj)
mkl_ia32.lib(def_strsm_omp.obj) : error LNK2005: ___strsm_148__par_loop1 gi definito in mkl_ia32.lib(p3_strsm_omp.obj)
mkltest.exe : fatal error LNK1169: rilevato uno o pi simboli definiti pi volte
NMAKE : errore irreversibile U1077: "link" : codice restituito "0x491"
Stop.

E:QuantsTestsfoo>

I'm compiling on a Windows 2000 Advanced Server machine with 4 x 2.8 GHz P4 Xeon MP;strangely enough from the errors it looks like it linked the PIII binaries instead of the P4 ones.

Note that I successfully compiled some BLAS and VSL examples so the problem seems to be related to the LAPACK stuff.

Thank you for your help and enjoy a great weekend!

-- Marco --

0 Kudos
Todd_R_Intel
Employee
838 Views

Marco,

This link error looks familiar to me. Links with the first version of Intel MKL 6.0 that was released in May 2003 showed error messages like this. A patch was released shortly thereafter (Intel MKL 6.0.1).

What version of Intel MKL are you using? Version 6.1 is now available and provides improved performance.

If you are using version 6.1 and are still getting these messages, I suggest you submit an issue at http://premier.intel.com.
Todd
0 Kudos
dolom
Beginner
838 Views

Hello there!

Sorry for my late reply: I confirm that the problem disappeared after upgrading to version 6.1.

Cheers and thank you for your help!

-- Marco --

0 Kudos
Todd_R_Intel
Employee
838 Views
Glad to help. -Todd
0 Kudos
Reply