Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6956 Discussions

MKL build & debug from Eclipse IDE Linux

Azua_Garcia__Giovann
518 Views
Hello,

Can anyone please advice what I have to do to be able to build and debug MKL-dependant projects using Eclipse IDE in Linux.

Basically I have this in my .bashrc: "source /opt/intel/bin/compilervars.sh intel64" which enables all the enviroment variables to use MKL and can work from the shell no problems, but not sure how to do the same from Eclipse, can anyone advice?

I generate the Eclipse project files using cmake and the MKL includes are correct, the linking is where it fails ...

The error is the following:

Linking CXX executable benchmark
/usr/bin/cmake -E cmake_link_script CMakeFiles/benchmark.dir/link.txt --verbose=1
/usr/bin/c++ -Wall -Wextra -Wshadow -Woverloaded-virtual -g3 -ggdb3 CMakeFiles/benchmark.dir/test/benchmark.cc.o -o benchmark -rdynamic libxxxxx.a libxxx_func_fw.a libqr_updates.a -lrt -lmkl_rt -liomp5 -limf -lgfortran -lquadmath
/usr/bin/ld: cannot find -lmkl_rt
/usr/bin/ld: cannot find -liomp5
/usr/bin/ld: cannot find -limf
collect2: ld returned 1 exit status
make[2]: Leaving directory `/home/bravegag/code/fastcode_project/build'
make[1]: Leaving directory `/home/bravegag/code/fastcode_project/build'
make[2]: *** [benchmark] Error 1
make[1]: *** [CMakeFiles/benchmark.dir/all] Error 2
make: *** [all] Error 2

TIA,
Best regards,
Giovanni
0 Kudos
3 Replies
mecej4
Honored Contributor III
518 Views
You are using the GNU C++ compiler, and it does not know where the Intel compiler keeps the necessary shared libraries. For each directory where there is a shared library that is to be used, there needs to be a corresponding

-L

option. Chances are that libimf.so and libiomp5.so are in one directory, and libmkl_rt.so in another, so you will need two -L option items.
0 Kudos
Gennady_F_Intel
Moderator
518 Views
first of all I'd suggest you to read how to configuring the Eclipse* IDE CDT to Link with Intel MKL - see user's guide for linux - chapter 9. You can find there pretty detailed guide forGetting Assistance for Programming in the Eclipse* IDE.
0 Kudos
Azua_Garcia__Giovann
518 Views
Hello,

Thank you! I managed to Compile/Run/Debug in Eclipse CDT Mac OS X and it is really awesome :) but I still get problems compiling in Ubuntu 12.04. I prefer very much to develop in Mac OS X but need Linux to be able to use Performance Counters (PC) in order to generate reliable Gflops plots. The core library that underpins all PC getting MUL and ADD perfmon2 doesn't work in Mac OS X. Is there a PC Intel-based solution?

For the record, I solved my Mac OS X Compilation/Run/Debug problems by:

1) (I'm using cmake) in my CMakeList.txt explicitly link to MKL every executable and not rely on transitive linking e.g.
if (MKL_FOUND)
target_link_libraries(benchmark ${MKL_LIBRARIES})
endif()

2) Eclipse Run configuration -> C++ Application -> Environment added the variable DYLD_LIBRARY_PATH to contain the same content as found in shell $ env | grep DYLD_LIBRARY_PATH. Indirectly using ${env_var:DYLD_LIBRARY_PATH} doesn't work, it has to be expanded there which is kind of an inconvenience e.g. after upgrading MKL.

3) At this point could Run but not Debug. The solution is to change the default binary parser under
Project Properties -> C/C++ Make Project -> Binary Parser from "Mach-O" parser to "Mach-O 64" parser (I have a 64b environment).

Best regards,
Giovanni

0 Kudos
Reply