Linking option for including mkl libraries statically.

Linking option for including mkl libraries statically.

Trying to build my binary by including the intel MKL libraries statically (on OS X).

I have explored the following options:

[1] using -lmkl_intel_ilp64, etc at the link stage but this dynamically links the libraries despite the .dylib's and .a's existing under /opt/intel/composer_xe_2013.0.088/mkl/lib.  The top rated answer on shows that in cases where the .dylib and .a appear in the same directory, the .dylib (shared linking) is used. 

[2] Manually adding the full paths to the MKL libraries to the link line.  I would not have to rely on fixed paths as I'm developing a cross platform application. 

I would like to use option [1] as its environment agnostic, but not have to physically remove/relocate the .dylib's so that the linker will be forced to use the static version.

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi Francis,

Yes, I can understand your request, we have same discussion in

Like under windows, if your project was setting /MT (static link), then we can link static MKL automatically. and under Linux -Bstatic -lmkl, link static MKL automatically too.
but it seems a limitation by compiler and linker on Mac OS. They don't support -Bstatic option.

Acutally,the option 2 seems the easy workaround so far. as you want to static link mkl, then the fixed path is only used one time. Once you set a valid path during development, then no more environment dependency.

Best Regards,

Leave a Comment

Please sign in to add a comment. Not a member? Join today