M_Ant
M_Ant

Reputation: 61

CMAKE - runtime library hidden files

I am running Linux Redhat, I have Anaconda installed and I am trying to install a program (libspimage) using CMAKE amd I get the following warning/error:

CMake Warning at src/CMakeLists.txt:74 (ADD_LIBRARY): Cannot generate a safe runtime search path for target _spimage_pybackend because files in some directories may conflict with libraries in implicit directories: runtime library [libtiff.so.5] in /usr/lib64 may be hidden by files in: /home/michantia/anaconda2/lib

Some of these libraries may not be found correctly.

When I do:

echo $PATH

I get:

/home/mi_a/anaconda2/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/home/michantia/.local/bin:/home/michantia/bin

I tried:

export PATH=/usr/lib64:$PATH

hoping cmake would find the libraries in this directory before finding them in anancoda's, but that did not work. I also tried two other similar suggestions for a similar problem that I saw in stackoverflow, but that did not work.

Any other ideas are highly welcomed.

Upvotes: 5

Views: 7607

Answers (1)

Tsyvarev
Tsyvarev

Reputation: 65928

Warning message

Cannot generate a safe runtime search path for target

is related neither with CMake ability to find a library (libtiff.so.5 in your case) nor with a linker ability to link the library.

The warning message means that when a target (_spimage_pybackend) will be loaded, the loader will be unable to choose the correct library: according to the loader's algorithm and the target's setting, file /home/michantia/anaconda2/lib/libtiff.so.5 will be choosen instead of proper one /usr/lib64/libtiff.so.5.

The error is usually resulted in linking into the single target two libraries from different directories, when the directory with a second library also contains a file with the name of the first library:

  1. Directory /usr/lib64 contains a library libtiff.so.5, which is linked into the target.
  2. Directory /home/michantia/anaconda2/lib contains a library <A> which is also linked into the target; but this directory also contains a file libtiff.so.5.

According to CMake algorithm, runpath for the binary file of such target will include both directories, so both libraries could be found. But such runpath confuses the loader to find the first library properly.

Except from avoiding such situation (when a library is contained in two directories), one hardly is able to handle this warning.

Upvotes: 0

Related Questions