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

MKL and gcc: Correct linking?

greiner08
Beginner
1,289 Views

Hi,

I am attemting to compile the example file pardiso_unsym_c.c with gcc. I have successfully done so on linux with the library flags
 

-Wl,--start-group $(MKL_PATH)/libmkl_intel_lp64.a $(MKL_PATH)/libmkl_sequential.a $(MKL_PATH)/libmkl_core.a -Wl,--end-group -lpthread -lm -ldl


I've tried to adapt this to windows (I use gcc supplied by mingw) and use the flags

-Wl,--start-group "C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.1.144\windows\mkl\lib\intel64_win\mkl_intel_ilp64.lib" "C:\Program Files (x86)\IntelSWTools\compilers_
and_libraries_2019.1.144\windows\mkl\lib\intel64_win\mkl_sequential.lib" "C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.1.144\windows\mkl\lib\intel64_win\mkl_core.lib" -Wl,--end-group -lm

But this leads to the error "Undefined reference to PARDISO"

Could someone let me know if my windows flags above are either wrong, or should work (meaning the error is elsewhere). Unfortunately link line advisor ( https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/ ) doesn't have a GNU option for windows (likely because GNU on windows is an edge case).
 

0 Kudos
2 Replies
TimP
Honored Contributor III
1,289 Views

start-group ... end-group may not have effect with plain (or mingw) Windows link.  They would not be needed in a dynamic link.  In a static link, you would then need to repeat the group of .lib about 3 times to resolve references.  Dependency Walker might show if any .dll is missing, in case there is dependence on ICL run-time library.  In addition, you would need to assure that you take account of the advice for the VS Windows in Link Advisor (not the gcc advice).

As intel_thread probably won't work with mingw (look up old post on this), there isn't so much incentive to use MKL rather than a pure MKL compiled library, if you use functions for which public source is available.

0 Kudos
greiner08
Beginner
1,289 Views

Thanks for the reply. In the end I managed to get pgi compilers installed and intend to use them.

0 Kudos
Reply