title: Undefined reference to `sqrt` despite linking to math library
body: <p>I am trying to compile an example program from the Intel MKL library (<code>/opt/intel/mkl/examples/versionqueryc/</code>). I copied the source code (C-file) to a new directory. I then went and tried to build this example using CMake.</p>
  
  <p>In the course of debugging this, I am stuck when trying to use the following command (isolated from cmake by now).</p>
  
  <p>It doesn't find the Math library but I have <code>-lm</code> included in the linking. So what is going on?</p>
  
  <pre><code>:~/devel/mkl/MKL Test/build$  /usr/bin/gcc -m64 CMakeFiles/mkltest.dir/main.c.o \
  &gt;     -o mkltest    -rdynamic -L/home/myuser/src/intel/mkl/lib/intel64 \
  &gt;     -lm  -lmkl_intel_lp64 -lmkl_sequential -lmkl_core  -lmkl_cdft_core \
  &gt;     -lmkl_scalapack_lp64 \
  &gt;     /home/myuser/src/intel/lib/intel64/libiomp5.so \
  &gt;     -Wl,-rpath,/home/myuser/src/intel/mkl/lib/intel64:/home/myuser/src/intel/lib/intel64 
  /home/myuser/src/intel/mkl/lib/intel64/libmkl_core.so: undefined reference to `logf'
  /home/myuser/src/intel/mkl/lib/intel64/libmkl_core.so: undefined reference to `atan2'
  /home/myuser/src/intel/mkl/lib/intel64/libmkl_core.so: undefined reference to `sin'
  /home/myuser/src/intel/mkl/lib/intel64/libmkl_core.so: undefined reference to `fabs'
  /home/myuser/src/intel/mkl/lib/intel64/libmkl_core.so: undefined reference to `exp'
  /home/myuser/src/intel/mkl/lib/intel64/libmkl_core.so: undefined reference to `sqrtf'
  /home/myuser/src/intel/mkl/lib/intel64/libmkl_core.so: undefined reference to `cos'
  /home/myuser/src/intel/mkl/lib/intel64/libmkl_core.so: undefined reference to `sqrt'
  /home/myuser/src/intel/mkl/lib/intel64/libmkl_sequential.so: undefined reference to `log'
  /home/myuser/src/intel/mkl/lib/intel64/libmkl_core.so: undefined reference to `pow'
  /home/myuser/src/intel/mkl/lib/intel64/libmkl_core.so: undefined reference to `log10'
  /home/myuser/src/intel/mkl/lib/intel64/libmkl_core.so: undefined reference to `ceil'
  /home/myuser/src/intel/mkl/lib/intel64/libmkl_core.so: undefined reference to `expf'
  collect2: ld returned 1 exit status
  </code></pre>