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

MKL g++ issue on Mac 10.11

Seifert__Urban
Beginner
349 Views

Hey, I am trying to run a simple lapack example (lets say the dsyev example, https://software.intel.com/sites/products/documentation/doclib/mkl_sa/11/mkl_lapack_examples/dsyev_ex.c.htm), with MKL 2017 installed on my Mac 10.11.6, using gcc 4.9.2.

Using the online linker, my link line looks like this

gcc -o dsyev dsyev.c  -L${MKLROOT}/lib -Wl,-rpath,${MKLROOT}/lib -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm -ldl -DMKL_LP64 -m64 -I${MKLROOT}/include

which works fine and yields the correct output.

However, I am now trying to use g++ (since my actual project is written in C++), change the "malloc"s into "new"s etc., but upon compiling (using the exact same link line as above), I get a "symbols not found" error for dsyev.

Is there something I am missing? Thanks a lot in advance.

0 Kudos
2 Replies
mecej4
Honored Contributor III
349 Views

Please show us the prototype declarations for the MKL routine(s) and the actual linker message. C++ name mangling may be the culprit, especially if you did not use extern "C" {} around the prototype declarations.

0 Kudos
Seifert__Urban
Beginner
349 Views

… Of course, thats it, forgot the extern "C" {…}. Thank you so much!

For future readers, the following prototype declaration resolves my issue.

extern "C" { void dsyev( char* jobz, char* uplo, int* n, double* a, int* lda,
                        double* w, double* work, int* lwork, int* info );}

 

0 Kudos
Reply