# Building julia with Intel MKL: libimf not found

**URL:** <https://discourse.julialang.org/t/building-julia-with-intel-mkl-libimf-not-found/10171>\
**Category:** Internals & Design\
**Created:** [April 5, 2018, 9:44am UTC](https://discourse.julialang.org/t/building-julia-with-intel-mkl-libimf-not-found/10171 "2018-04-05T09:44:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![v-i-s-h](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/v-i-s-h/32/46152_2.png) [@v-i-s-h](https://discourse.julialang.org/u/v-i-s-h)\
**Post date:** [April 5, 2018, 9:44am UTC](https://discourse.julialang.org/t/building-julia-with-intel-mkl-libimf-not-found/10171/1 "2018-04-05T09:44:06Z")

</div>

Hi,  
I’m trying to build julia (tag v0.6.2) from source. I have already installed intel MKL, IPP, TBB and MPI in my system (elementaryOS 0.4.1, based on Ubuntu 16.04) and setup the compiler variable using the script in `/opt/intel/bin/compilervars.sh`.  
I modified `Make.inc` as below:

```julia
## Settings for various Intel tools
# Set to 1 to use MKL
USE_INTEL_MKL ?= 1
# Set to 1 to use MKL FFT
USE_INTEL_MKL_FFT ?= 1
# Set to 1 to use Intel LIBM
USE_INTEL_LIBM ?= 1

```

When I try to make, I’m getting this error:

```julia
/opt/julialang/src/julia/base/precompile.jl
fatal: error thrown and no exception handler available.
ErrorException("error compiling ndigits: error compiling ndigits0z: could not load library "libimf"
libimf.so: cannot open shared object file: No such file or directory")
rec_backtrace at /opt/julialang/src/julia/src/stackwalk.c:84
record_backtrace at /opt/julialang/src/julia/src/task.c:245
jl_throw at /opt/julialang/src/julia/src/task.c:564
jl_rethrow_with_add at /opt/julialang/src/julia/src/codegen.cpp:912
jl_compile_linfo at /opt/julialang/src/julia/src/codegen.cpp:1270
jl_compile_hint at /opt/julialang/src/julia/src/gf.c:1724
jl_compile_specializations at /opt/julialang/src/julia/src/precompile.c:344 [inlined]
jl_precompile at /opt/julialang/src/julia/src/precompile.c:353 [inlined]
jl_write_compiler_output at /opt/julialang/src/julia/src/precompile.c:31
jl_atexit_hook at /opt/julialang/src/julia/src/init.c:238
main at /opt/julialang/src/julia/ui/repl.c:265
__libc_start_main at /build/glibc-Cl5G7W/glibc-2.23/csu/../csu/libc-start.c:291
unknown function (ip: 0x4016b8)
***This error is usually fixed by running `make clean`. If the error persists, try `make cleanall`.***
Makefile:233: recipe for target '/opt/julialang/src/julia/usr/lib/julia/sys.o' failed
make[1]: *** [/opt/julialang/src/julia/usr/lib/julia/sys.o] Error 1
Makefile:109: recipe for target 'julia-sysimg-release' failed
make: *** [julia-sysimg-release] Error 2

```

What could be the problem?  
-vish

---

<div class="post-metadata">

**Author:** ![pablosanjose](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pablosanjose/32/7006_2.png) [@pablosanjose](https://discourse.julialang.org/u/pablosanjose)\
**Post date:** [April 5, 2018, 12:04pm UTC](https://discourse.julialang.org/t/building-julia-with-intel-mkl-libimf-not-found/10171/2 "2018-04-05T12:04:55Z")

</div>

In Linux I think you need to install the Intel runtime to use the Intel libm. See this post by @SebastianM-C:

> [@Issues building Julia 0.7 with Intel MKL on macOS](https://discourse.julialang.org/t/issues-building-julia-0-7-with-intel-mkl-on-macos/10159/3):
>
> I had issues with libm when I built MKL on Linux, but they were solved by installing the compiler runtime libs ([Intel Developer Zone](https://software.intel.com/en-us/articles/installing-intel-parallel-studio-xe-runtime-2018-using-yum-repository)). I am not sure if there is something similar for macOS.

---

<div class="post-metadata">

**Author:** ![v-i-s-h](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/v-i-s-h/32/46152_2.png) [@v-i-s-h](https://discourse.julialang.org/u/v-i-s-h)\
**Post date:** [April 5, 2018, 2:25pm UTC](https://discourse.julialang.org/t/building-julia-with-intel-mkl-libimf-not-found/10171/3 "2018-04-05T14:25:06Z")

</div>

I installed intel psxe runtime using this method: [Intel Developer Zone](https://software.intel.com/en-us/articles/installing-intel-parallel-studio-xe-runtime-2018-using-apt-repository)

But still I’m getting the same error ☹

---

<div class="post-metadata">

**Author:** ![Elrod](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/elrod/32/22461_2.png) [@Elrod](https://discourse.julialang.org/u/Elrod)\
**Post date:** [April 5, 2018, 7:01pm UTC](https://discourse.julialang.org/t/building-julia-with-intel-mkl-libimf-not-found/10171/4 "2018-04-05T19:01:13Z")

</div>

Did you source the intel compilervars in the same terminal?  
I added the line to my `.bashrc`, because even after Julia is built, it will error if I didn’t source compilervars. (Eg, crash on matrix multiplication.)

---

<div class="post-metadata">

**Author:** ![v-i-s-h](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/v-i-s-h/32/46152_2.png) [@v-i-s-h](https://discourse.julialang.org/u/v-i-s-h)\
**Post date:** [April 6, 2018, 12:34am UTC](https://discourse.julialang.org/t/building-julia-with-intel-mkl-libimf-not-found/10171/5 "2018-04-06T00:34:54Z")

</div>

Yes… I made it sure.  
Otherwise, at the start itself, it will complain about missing MKL library. So I guess the compilervars are set properly.
