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

Linking with MIGW g++

Raul-Ramirez-Velarde
2,062 Views

I am using MingW 8.1.0 g++ to compile a program and link MKL libraries. My platform is Windows 10 with INTEL MKL 2020.0

Using the linker advisor I use the following Makefile:

CXX=g++
CXXFLAGS=-O4 -march=native -fopenmp-simd -fopenmp -fopt-info-vec=report.rpt -lmkl_intel_lp64 -lmkl_core -lmkl_sequential -L/C/Program\ Files\ \(x86\)\/IntelSWTools/compilers_and_libraries_2020.4.311/windows/mkl/lib/intel64_win -lm -Wl,--no-as-needed -I/C/Program\ Files\ \(x86\)\/IntelSWTools/compilers_and_libraries_2020.4.311/windows/mkl/include -std=c++11


default : app.exe

worker.o : worker.cc
${CXX} -c ${CXXFLAGS} -o "$@" "$<"

app.exe : main.cc worker.o
${CXX} ${CXXFLAGS} -o "$@" "$<" worker.o

clean :
rm app.exe worker.o *.optrpt

And get the following result:

$ mingw32-make -B
g++ -c -O4 -march=skylake -fopenmp-simd -fopenmp -fopt-info-vec=report.rpt -lmkl
_intel_lp64 -lmkl_core -lmkl_sequential -L/C/Program\ Files\ \(x86\)\/IntelSWToo
ls/compilers_and_libraries_2020.4.311/windows/mkl/lib/intel64_win -lm -Wl,--no-a
s-needed -I/C/Program\ Files\ \(x86\)\/IntelSWTools/compilers_and_libraries_2020
.4.311/windows/mkl/include -std=c++11 -o "worker.o" "worker.cc"
g++ -O4 -march=skylake -fopenmp-simd -fopenmp -fopt-info-vec=report.rpt -lmkl_in
tel_lp64 -lmkl_core -lmkl_sequential -L/C/Program\ Files\ \(x86\)\/IntelSWTools/
compilers_and_libraries_2020.4.311/windows/mkl/lib/intel64_win -lm -Wl,--no-as-n
eeded -I/C/Program\ Files\ \(x86\)\/IntelSWTools/compilers_and_libraries_2020.4.
311/windows/mkl/include -std=c++11 -o "app.exe" "main.cc" worker.o
main.cc: In function 'int main(int, char**)':
main.cc:36:55: warning: integer overflow in expression of type 'long int' result
s in '0' [-Woverflow]
float *data = (float *) malloc((long)sizeof(float)*n*m);
~~~~~~~~~~~~~~~~~~~~~^~
C:\Users\RAULRA~1\AppData\Local\Temp\ccgFLrvQ.o:main.cc:(.text+0x6d): undefined
reference to `vsRngUniform'
C:\Users\RAULRA~1\AppData\Local\Temp\ccgFLrvQ.o:main.cc:(.text.startup+0x83): un
defined reference to `vslNewStream'
collect2.exe: error: ld returned 1 exit status
mingw32-make: *** [Makefile:12: app.exe] Error 1

What library am I missing? INTEL documentation states that both vdRngUniform and vslNewStream are MKL libraries.

Thank you for your help.

Cheers,

Raul Ramirez-Velarde

0 Kudos
2 Replies
Gennady_F_Intel
Moderator
2,050 Views

yes, vdRngUniform and vslNewStream are from MKL libraries and yes dynamically linking against these shared libs -lmkl_intel_lp64 -lmkl_core -lmkl_sequential is the correct way to link, but I am not sure how it could be linked under the MING g++ environment. You may try to check the build on any other Linus OS-based systems and apply the MKL Linkier Adviser or Dev Guide recommendations.

0 Kudos
Gennady_F_Intel
Moderator
2,006 Views

This issue has been resolved and we will no longer respond to this thread. If you require additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only. 



0 Kudos
Reply