Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
226 Views

Compiling with g++

Jump to solution

How can I compile my program with mkl and g++?

I already tried the mkl line advisor, but I got the "pthread_mutex_trylock" message.

How`s it going ?

Thanks.

0 Kudos

Accepted Solutions
Highlighted
Employee
226 Views

Hi Jack,

Are you working on Ubuntu system?

It looks similiar problem as  http://software.intel.com/en-us/forums/topic/501970#comment-1779725 and the one in http://software.intel.com/en-us/articles/symbol-lookup-error-when-linking-intel-mkl-with-gcc-on-ubun....  Some ubuntu and GCC have the issue, some have not.

You may try to add the compiler option : -Wl,--no-as-needed.   for example

g++ -Wall -o test.exe test.cpp -Wl,--no-as-needed -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -ldl -lpthread -lm

Best Regards,

Ying

View solution in original post

0 Kudos
5 Replies
Highlighted
226 Views

What is your linkline?

For intel64, lp64 interface, it is something like this.

 -Wl,--start-group $(MKLROOT)/lib/intel64/libmkl_intel_lp64.a $(MKLROOT)/lib/intel64/libmkl_core.a $(MKLROOT)/lib/intel64/libmkl_gnu_thread.a -Wl,--end-group -ldl -lpthread -lm

Have you threaded your program with pthreads?

--Vipin

 

0 Kudos
Highlighted
Beginner
226 Views

No, I don't thread with pthreads.

0 Kudos
Highlighted
Black Belt
226 Views

The point is, somewhere in your build you are calling a pthread function, e.g. by using OpenMP in your own code or by linking an mkl_thread library.  You will need either to remove the pthread function usage or link properly to support it.

0 Kudos
Highlighted
Employee
227 Views

Hi Jack,

Are you working on Ubuntu system?

It looks similiar problem as  http://software.intel.com/en-us/forums/topic/501970#comment-1779725 and the one in http://software.intel.com/en-us/articles/symbol-lookup-error-when-linking-intel-mkl-with-gcc-on-ubun....  Some ubuntu and GCC have the issue, some have not.

You may try to add the compiler option : -Wl,--no-as-needed.   for example

g++ -Wall -o test.exe test.cpp -Wl,--no-as-needed -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -ldl -lpthread -lm

Best Regards,

Ying

View solution in original post

0 Kudos
Highlighted
Beginner
226 Views

It works. Thank you everybody.

0 Kudos