[CMake] Eclipse project and MKL libraries

Eric Noulard eric.noulard at gmail.com
Mon Apr 30 09:30:40 EDT 2012


2012/4/30 Giovanni Azua <bravegag at gmail.com>:
> Hello,

Hi,

Please be careful not to drop the CMake ML address.

> Now I am completely set on Mac OS X. I can Compile/Run/Debug successfully.
> Basically I had to fix the environment settings of the Run Configuration to
> include in-place the DYLD_LIBRARY_PATH (linking to it would not work) and
> change the C/C++ Project Properties to use a different Binary Parser and now
> it all works perfect.

Depending on how Eclipse is launched it can have different env var
value than command line,
ut as I said in a previous e-mail you shouldn't be bothered with
DYLD_LIBRARY_PATH
if you used full path to library (but for MacOS I may be wrong I'm not
a Mac user,
other may comment on his may be)

Concerning binary parser this has nothing to do with CMake unless it
is specified in
the project file generated by CMake.

I think that CMake should not set binary parser in the generated
project file but
let default (platform-specific) Eclipse settings decide for that.
If CMake eclipse generator setup a binary parser in the generated
projetc file then may be it's worth
a bug report for Eclipse generator.

> However, I still can not compile from the Eclipse generated project in
> Ubuntu 12.04. Below I include the output of running "cmake -G "Unix
> Makefiles" -DCMAKE_BUILD_TYPE=Debug ../code" I can see that the
> MKL_LIBRARY_DIRS is correctly populated.

I don't understand why you insist on using MKL_LIBRARY_DIRS
instead of MKL_LIBRARIES (with full path) ?

Can you explain that, please ?

> On Sat, Apr 28, 2012 at 6:10 PM, Eric Noulard <eric.noulard at gmail.com>
> wrote:
>>
>> When does the error happen on Ubuntu? Compile-time? Link time? Debug time?
>> What error output do you get?
>>
> Link-time:
>
> 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
> libsubmodularity.a libsatoru_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
> make[2]: Leaving directory
> `/home/bravegag/code/fastcode_project/build_debug'
>of
> /usr/bin/ld: cannot find -limf
> collect2: ld returned 1 exit status
> make[2]: *** [benchmark] Error 1
> make[1]: *** [CMakeFiles/benchmark.dir/all] Error 2
> make: *** [all] Error 2
>
> whereas running make from the command like in VERBOSE I get for the same
> command:

[...]

Did you try starting eclipse from the same command line (in order to
make eclipse inherit the environment setup you have in that command
line) and compiling in eclipse?

> So basically the same link command is generated running make in command line
> and trying to compile from Eclipse and in Eclipse doesn't work because the
> library paths are not available whereas in the shell the env is set
> correctly.

This is no surprise as I said before:
http://www.cmake.org/pipermail/cmake/2012-April/050065.html
 you may perfectly have a different env setup in your shell than in Eclipse.

> What I find a bit odd is that in Mac OS X the same project generates the
> link step including the full path to the different linking libraries and in
> Ubuntu it doesn't. This is why it works in Mac OS X.

May be you can have a look at your FindMKL.cmake file and find the differences
between APPLE vs LINUX case w.r.t. MKL_LIBRARIES value?

-- 
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org


More information about the CMake mailing list