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

C++/Fortran/MPI code MKL compile error:

G__D
Beginner
660 Views
Hi all, I have (inherited) a code that is written with C++ (mainly), Fortran and MPI (with some scalapack calls too). We have just upgraded to Intel 2019 compilers (linux cluster). My CMake file has the flags set(CMAKE_C_FLAGS_INIT -static-libgcc -lstdc++) set(CMAKE_CXX_FLAGS_INIT -static-libgcc -ansi -lstdc++) set(CMAKE_CXX_FLAGS "-static-libstdc++ -static-libgcc -static -mkl=cluster -static-intel -ansi -qopenmp -fp-model precise -fp-model source") and runs as expected (i.e., successfully finds the Intel 2019 MKL, MPI libraries etc). However, when I run "make", I get the following error /opt/intel/composer_2019/compilers_and_libraries_2019.3.199/linux/mkl/include/mkl_scalapack.h(3516): error: more than one instance of overloaded function "descinit_" has "C" linkage void descinit_(MKL_INT* desc, const MKL_INT* m, const MKL_INT* n, which appears to be a problem with linking to MKL. Does anyone know what the problem could be? Thanks in advance.
0 Kudos
2 Replies
mecej4
Honored Contributor III
660 Views

G.D. wrote:
 

/opt/intel/composer_2019/compilers_and_libraries_2019.3.199/linux/mkl/include/mkl_scalapack.h(3516): error: more than one instance of overloaded function "descinit_" has "C" linkage
void descinit_(MKL_INT* desc, const MKL_INT* m, const MKL_INT* n,

which appears to be a problem with linking to MKL.

No, this is not a linking problem. Rather, the compiler found more than one prototype declaration for the external routine descinit_ in the header file mkl_scalapack.h. You can do grep -in descinit mkl_scalapack.h in the MKL include directory to have the offending lines displayed. You may likewise see if this header file is mistakenly included more than once, directly or indirectly, in your source file(s).

0 Kudos
G__D
Beginner
660 Views
Thanks mecej4. Yes indeed the code (which is new to me) had some include files that had "extern c" declarations to lapack subroutines. Simply commenting those lines solved the issue. In this case, the error message was actually quite descriptive and accurate! Thanks.
0 Kudos
Reply