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 http://stackoverflow.com/questions/844819/how-to-static-link-on-os-x 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 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.

Hi Francis,

Yes, I can understand your request, we have same discussion in http://software.intel.com/en-us/articles/intel-math-kernel-library-for-m....

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,
Ying

Laisser un commentaire

Veuillez ouvrir une session pour ajouter un commentaire. Pas encore membre ? Rejoignez-nous dès aujourd’hui