Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
Announcements
FPGA community forums and blogs have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.
7234 Discussions

Linking error while using GCC 4.4.2 on Debian testing

eeliumsn_com
Beginner
1,013 Views

Hi,

I am a beginner of MKL. I installed Intel C++ Compiler 11.1.064 on my Debian testing, and GCC 4.4.2. I tried to compile a very simple code to test MKL:

test_ddot.c:

#include "mkl.h"
#include
#include
#define N 3

int main()
{
double vec1 = {1.0, 2.0, 3.0};
double vec2 = {4.1, 5.1, 6.1};
int N_vec = N, inca = 1, incb = 1;
double result;

result = ddot(&N_vec, vec1, &inca, vec2, &incb);
printf("Vector product in double precision is %f\\n",result);

return 0;
}

While at compile time GCC shows the following linking error:

$ gcc -o test_ddot test_ddot.c -Wl,--start-group -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -Wl,--end-group -liomp5 -lpthread

/opt/intel/Compiler/11.1/064/mkl/lib/em64t/libmkl_intel_thread.so: undefined reference to `sin'
/opt/intel/Compiler/11.1/064/mkl/lib/em64t/libmkl_intel_thread.so: undefined reference to `cos'
/opt/intel/Compiler/11.1/064/mkl/lib/em64t/libmkl_core.so: undefined reference to `sqrt'
/opt/intel/Compiler/11.1/064/mkl/lib/em64t/libmkl_intel_thread.so: undefined reference to `log'

But if I replaced gcc with icc, then everything is good.

Any suggestions? Thanks a lot!

P.S. I installed libstdc++.so.5 seperately for icc, because Debian testing now only provides libstdc++.so.6.

0 Kudos
2 Replies
csnatarajan
Beginner
1,013 Views

Hi,

seems to be a error typical of not finding the math module, does explicitly specifying "-lm" do no good?

Cheers,

C.S.N

0 Kudos
eeliumsn_com
Beginner
1,013 Views

Yes! It works.Thanks for help.

Because I did not use any standard math functions, so I didn't expect to link with math library. And Intel link advisor does not suggest -lm either. While it seems MKL does need math lib.

0 Kudos
Reply