Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
The Intel sign-in experience has changed to support enhanced security controls. If you sign in, click here for more information.
6741 Discussions

Shared library using MKL crashes on runtime with EXC_BAD_ACCESS


Hi everyone!

I'm trying to create an application for MacOS platforms that uses some MKL methods for its math computations, namely the `dfdInterpolate1D()`. I'm facing a difficult issue, with random crashes due to bad access exceptions during the interpolation call. I tried several things and I can, quite safely, verify that it is not an obvious buffer allocations error from my side. Generally, I'm following the example templates that can be found at

After a lengthy investigation time, I think the issue comes from the linking scheme of the project. Due to some design specs, the base code is wrapped into a static library that is then used to create the application. My findings are concluded to the following:

  • isolating the code region that crashes from its surroundings and compiling it into a standalone executable runs fine and with no problem.
  • wrapping the same isolated code into a static or a dynamic library and then having a standalone executable loading and using the library, creates the exact same crash.
  • turning the Xcode's memory management diagnostics on, makes the code to constantly crash at the same point, instead of the initial random crashes.

So, my question is: is there a known issue or is there a certain way to wrap the MKL spline interpolation into a library? Is there anything I specifically have to be careful with for this use case? I'm using the linker and compiler options proposed by the MKL linker advisor.

Thank you very much in advance and sorry for the long post.

P.S. I'm using MacOS 10.13.5, Xcode 9.4.1, MKL 2018.0.104

0 Kudos
3 Replies

Hi Strp,

1) It seems unknown issue regarding the functionality.  and besides of the data fitting function, does other mkl function cause the crash?

2) How do you link the mkl library,  in the case of wrapping the same isolated code into a static or a dynamic library and then having a standalone executable loading ​?  how about if under command line:  
​>export OMP_NUM_THREADS=1

Could you please attach your isolate sample so we can test at our side?  and if the test case is private, please submit to​.

Best Regards,




Hi Ying,

First of all, thank you for answering. Regarding the points you made:

1) I haven't tested this behaviour with other MKL functions, as I only use the functions related with the task based interpolation on this project.

2) I forgot to mention that I'm using the sequential version of MKL, so setting the number of threads to 1 doesn't make any difference. I'm using these linker flags:

 ${MKLROOT}/lib/libmkl_intel_lp64.a ${MKLROOT}/lib/libmkl_sequential.a ${MKLROOT}/lib/libmkl_core.a -lpthread -lm -ldl

The test case code is indeed private. I will try to further isolate the point of interest and post it here. Until then, I have another question that could help: I'm using the MKL functions with data pointers of Eigen library matrices and vectors. Could this be a possible source of the crashes? 

Again, thank you for your time.

Best regards,



Hi Strp,

​Yes, if possible, please submit your issue to Intel on-line service center:​.  with the private test case.

Generally, Eigen should be able to ok with MKL functions.  as Eigen have MKL supported. for example,  the matrix input should be ok.


MatrixXd A = MatrixXd::Random(mA, kA);
 MatrixXd B = MatrixXd::Random(k, n);
   double alpha1 = 0.1;
 double alpha2 = 0.6;
  MatrixXd F = (alpha1* A.transpose() * B *A).block(0,0,2,2);

​besides all of them, how about upgrade to the latest version MKL 2018.0.3?

Best Regards,