Error during Relion Installation, Cmake complains about shared library - cmake

I am trying to Install relion following the directions at https://github.com/3dem/relion.
I am getting the following error since some of the libraries will be shared. I am not sure how to address this issue.
WARNING: Target "particle_FCC" requests linking to directory "/home/../eman2-sphire-sparx/lib". Targets may link only to libraries. CMake is dropping the item.
WARNING: Target "particle_FCC" requests linking to directory "/home/../eman2-sphire-sparx/lib". Targets may link only to libraries. CMake is dropping the item.
CMake Warning at src/apps/CMakeLists.txt:208 (add_executable):
Cannot generate a safe runtime search path for target particle_FCC because
files in some directories may conflict with libraries in implicit
directories:
runtime library [libfftw3f.so.3] in /usr/lib64 may be hidden by files in:
/home/../eman2-sphire-sparx/lib
runtime library [libfftw3.so.3] in /usr/lib64 may be hidden by files in:
/home/../eman2-sphire-sparx/lib
runtime library [libpng16.so.16] in /usr/lib64 may be hidden by files in:
/home/../eman2-sphire-sparx/lib

Related

Cannot generate a safe runtime search path for target caffe because files in some directories may conflict with libraries in implicit directories

I am trying to install this code https://github.com/NVlabs/ssn_superpixels but get an error at the cmake .. step
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CUDA_cublas_LIBRARY (ADVANCED)
linked by target "caffe" in directory /home/haziq/ASTAR/scripts/ssn_superpixels/lib/video_prop_networks/lib/caffe/src/caffe
So I deleted the build folder, recreated it and cd into it and ran cmake .. -DCUDA_cublas_LIBRARY=/usr/lib/x86_64-linux-gnu/libcublas.so.9.1 but now get the following messages.
CMake Warning at src/caffe/CMakeLists.txt:20 (add_library):
Cannot generate a safe runtime search path for target caffe because files
in some directories may conflict with libraries in implicit directories:
runtime library [libsnappy.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/haziq/anaconda3/envs/ssn/lib
Some of these libraries may not be found correctly.
CMake Warning at src/caffe/test/CMakeLists.txt:29 (add_executable):
Cannot generate a safe runtime search path for target test.testbin because
files in some directories may conflict with libraries in implicit
directories:
runtime library [libsnappy.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/haziq/anaconda3/envs/ssn/lib
Some of these libraries may not be found correctly.
CMake Warning at tools/CMakeLists.txt:14 (add_executable):
Cannot generate a safe runtime search path for target extract_features
because files in some directories may conflict with libraries in implicit
directories:
runtime library [libsnappy.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/haziq/anaconda3/envs/ssn/lib
Some of these libraries may not be found correctly.
CMake Warning at tools/CMakeLists.txt:14 (add_executable):
Cannot generate a safe runtime search path for target device_query because
files in some directories may conflict with libraries in implicit
directories:
runtime library [libsnappy.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/haziq/anaconda3/envs/ssn/lib
Some of these libraries may not be found correctly.
CMake Warning at tools/CMakeLists.txt:14 (add_executable):
Cannot generate a safe runtime search path for target convert_imageset
because files in some directories may conflict with libraries in implicit
directories:
runtime library [libsnappy.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/haziq/anaconda3/envs/ssn/lib
Some of these libraries may not be found correctly.
CMake Warning at tools/CMakeLists.txt:14 (add_executable):
Cannot generate a safe runtime search path for target test_net because
files in some directories may conflict with libraries in implicit
directories:
runtime library [libsnappy.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/haziq/anaconda3/envs/ssn/lib
Some of these libraries may not be found correctly.
CMake Warning at tools/CMakeLists.txt:14 (add_executable):
Cannot generate a safe runtime search path for target net_speed_benchmark
because files in some directories may conflict with libraries in implicit
directories:
runtime library [libsnappy.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/haziq/anaconda3/envs/ssn/lib
Some of these libraries may not be found correctly.
CMake Warning at tools/CMakeLists.txt:14 (add_executable):
Cannot generate a safe runtime search path for target compute_image_mean
because files in some directories may conflict with libraries in implicit
directories:
runtime library [libsnappy.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/haziq/anaconda3/envs/ssn/lib
Some of these libraries may not be found correctly.
CMake Warning at tools/CMakeLists.txt:14 (add_executable):
Cannot generate a safe runtime search path for target train_net because
files in some directories may conflict with libraries in implicit
directories:
runtime library [libsnappy.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/haziq/anaconda3/envs/ssn/lib
Some of these libraries may not be found correctly.
CMake Warning at tools/CMakeLists.txt:14 (add_executable):
Cannot generate a safe runtime search path for target finetune_net because
files in some directories may conflict with libraries in implicit
directories:
runtime library [libsnappy.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/haziq/anaconda3/envs/ssn/lib
Some of these libraries may not be found correctly.
CMake Warning at tools/CMakeLists.txt:14 (add_executable):
Cannot generate a safe runtime search path for target
upgrade_net_proto_binary because files in some directories may conflict
with libraries in implicit directories:
runtime library [libsnappy.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/haziq/anaconda3/envs/ssn/lib
Some of these libraries may not be found correctly.
CMake Warning at tools/CMakeLists.txt:14 (add_executable):
Cannot generate a safe runtime search path for target
upgrade_net_proto_text because files in some directories may conflict with
libraries in implicit directories:
runtime library [libsnappy.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/haziq/anaconda3/envs/ssn/lib
Some of these libraries may not be found correctly.
CMake Warning at tools/CMakeLists.txt:14 (add_executable):
Cannot generate a safe runtime search path for target
upgrade_solver_proto_text because files in some directories may conflict
with libraries in implicit directories:
runtime library [libsnappy.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/haziq/anaconda3/envs/ssn/lib
Some of these libraries may not be found correctly.
CMake Warning at tools/CMakeLists.txt:14 (add_executable):
Cannot generate a safe runtime search path for target caffe.bin because
files in some directories may conflict with libraries in implicit
directories:
runtime library [libsnappy.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/haziq/anaconda3/envs/ssn/lib
Some of these libraries may not be found correctly.
CMake Warning at python/CMakeLists.txt:9 (add_library):
Cannot generate a safe runtime search path for target pycaffe because files
in some directories may conflict with libraries in implicit directories:
runtime library [libsnappy.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/haziq/anaconda3/envs/ssn/lib
Some of these libraries may not be found correctly.
I found a post here CMake cannot resolve runtime directory path that provides a solution for find_library and find_package but mine is add_library. Anyway I tried fixing the first CMake warning
CMake Warning at src/caffe/CMakeLists.txt:20 (add_library):
Cannot generate a safe runtime search path for target caffe because files
in some directories may conflict with libraries in implicit directories:
runtime library [libsnappy.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/haziq/anaconda3/envs/ssn/lib
Some of these libraries may not be found correctly.
by editing line 20 of src/caffe/CMakeLists.txt by replacing add_library(caffe ${srcs}) with add_library(caffe ${srcs} NO_DEFAULT_PATH) but now get this message.
CMake Error at src/caffe/CMakeLists.txt:20 (add_library):
Cannot find source file:
NO_DEFAULT_PATH
Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
.hxx .in .txx
What can I try next?
install libcublas 10 then run again

Explicitly tell to CMake target_link_libraries() to read dependency as target and not as a file from system path?

I got multiple warnings:
CMake Warning at libsysev/src/CMakeLists.txt:17 (add_library):
Cannot generate a safe runtime search path for target sysev because files
in some directories may conflict with libraries in implicit directories:
runtime library [libzlog.so] in /usr/lib/arm-linux-gnueabihf may be hidden by files in:
/home/user/project/BUILD/libzlog/src
Some of these libraries may not be found correctly.
Target defined as following:
add_library(sysev SHARED main.cpp)
target_link_libraries(sysev PUBLIC zlog)
zlog provided in source code and also installed to the system.
Root CMakeLists.txt looks like:
project(xxx)
add_subdirectory(zlog)
add_subdirectory(sysev)
I want to disambiguate zlog. CMake must know this is a target and not a file from system path.

How to remove a path from CMake variable set by find_package

Problem
I am trying to remove a particular path from CMake variables VTK_INCLUDE_DIRS and VTK_LIBRARIES that are set by find_package(VTK).
In CMakeLists.txt of the PCL library, the VTK library is first searched by find_package(VTK). However, the python path /home/w/.conda/envs/py36/lib seems to get in and causes a conflict with libz.so.1 in /usr/lib/x86_64-linux-gnu. (I believe this is because the VTK library was built with Python3 wrapper in the Anaconda environment.):
cmake ..
...
-- VTK found (
include: /usr/local/include/vtk-8.2;/home/w/.conda/envs/py36/include/python3.6m,
lib: vtksys; ...;/home/w/.conda/envs/py36/lib/libpython3.6m.so;vtkPythonInterpreter; ...
...
CMake Warning at cmake/pcl_targets.cmake:263 (add_executable):
Cannot generate a safe runtime search path for target pcl_generate because
files in some directories may conflict with libraries in implicit
directories:
runtime library [libz.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/w/.conda/envs/py36/lib
Some of these libraries may not be found correctly.
Call Stack (most recent call first):
tools/CMakeLists.txt:148 (PCL_ADD_EXECUTABLE)
Try 1
I tried to remove the Python3 path by modifying the CMakeLists.txt as follows:
if(WITH_VTK AND NOT ANDROID)
find_package(VTK)
list(REMOVE_ITEM VTK_INCLUDE_DIRS "/home/w/.conda/envs/py36/include/python3.6m")
list(REMOVE_ITEM VTK_LIBRARIES "/home/w/.conda/envs/py36/lib/libpython3.6m.so")
if(VTK_FOUND)
...
message(STATUS "VTK found (include: ${VTK_INCLUDE_DIRS}, lib: ${VTK_LIBRARIES}")
This does change the CMake message that prints out, but doestn't solve the problem; the problem still persists:
-- VTK found (
include: /usr/local/include/vtk-8.2,
lib: vtksys; ...;vtkPythonInterpreter; ...
...
runtime library [libz.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/w/.conda/envs/py36/lib
Question
So list(REMOVE_ITEM VTK_INCLUDE_DIRS "/home/w/.conda/envs/py36/include/python3.6m") does remove this path from the VTK_INCLUDE_DIRS variable, but doesn't seem to change the actual inclue path internally. I must have missed some inportant concept of CMake.
How should I solve this problem?

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.
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:
Directory /usr/lib64 contains a library libtiff.so.5, which is linked into the target.
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.

CMake cannot resolve runtime directory path

After running cmake CMakeLists.txt
I get the following warning
CMake Warning at src/CMakeLists.txt:32 (add_executable):
Cannot generate a safe runtime search path for target MMPEditor because
files in some directories may conflict with libraries in implicit
directories:
runtime library [libQt5Widgets.so.5] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/ch/Qt/5.2.1/gcc_64/lib
runtime library [libQt5Core.so.5] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/ch/Qt/5.2.1/gcc_64/lib
runtime library [libQt5Gui.so.5] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/ch/Qt/5.2.1/gcc_64/lib
runtime library [libQt5OpenGL.so.5] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/ch/Qt/5.2.1/gcc_64/lib
Some of these libraries may not be found correctly.
What does it mean for one file to be hidden by another and how can I allow CMake to determine which is the right folder to link to?
What the warning actually implies:
The project requests linking with the shared library, which is contained in two directories. That is, both these directories have the file named like foo.so.x.y.
CMake perfectly understands which library file is chosen for linking. That is, it may pass the "right" directory to the runtime loader, so the loader will search the library there.
For some reason, CMake cannot prevent the loader to search under the "wrong" directory too. E.g. that directory is searched by default, or it contains other libraries needed for the same executable.
As a result, CMake cannot guarantee that, when you run the executable, the loader will find the proper library.
For examples, the message
runtime library [libQt5Widgets.so.5] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/home/ch/Qt/5.2.1/gcc_64/lib
means, that the project requests to link with the library libQt5Widgets.so.5 located in the directory /usr/lib/x86_64-linux-gnu.
But library with the same name exists also in the directory /home/ch/Qt/5.2.1/gcc_64/lib, which CMake treats as "implicit directory", where the loader will search in any case. (Probably, because this directory is listed in the variable LD_LIBRARY_PATH).
The consequences of the warning:
The project can be configured without the errors.
The project can be built without errors.
But when run the executable, the loaded may load wrong library. And that could lead to unpredictable results.
Because unpredictable results on running are rarely acceptable, it is better to fix the warning. Possible ways include the following:
Make sure that CMake chooses the library which you are actually intended to use.
E.g. you could actually intend to use the custom installation of QT under /home/ch/Qt/5.2.1/gcc_64. In that case you need to hint CMake about your intentions. E.g. by setting CMAKE_PREFIX_PATH variable.
Uninstall the library located in the "wrong" directory.
E.g. if you have newer version of the library and never intend to use the older one, then for avoid confusion it is better to uninstall the later.
If the "wrong" directory is searched by the loader because it is included into the variable LD_LIBRARY_PATH, then set this variable to not contain that directory.
CMake is able to correctly build projects for run without LD_LIBRARY_PATH settings.
If "wrong" directory is searched by the loader because it contains some other libraries, eliminate usage of that libraries in your executable.
If you have two "repositories" of libraries on your PC, then compatibility between libraries is guaranteed only within a single repo. Mixed usage of libraries could lead to incompatibility problems at runtime.
If you're dealing with find_library
find_library(LIBRARY_NAME PATHS "/usr/lib/x86_64-linux-gnu" NO_DEFAULT_PATH) where
PATHS stands for the exact path to the libs
NO_DEFAULT_PATH means, that cmake will not search anywhere else
check the values of lib and include paths with message(status, ${LIBRARY_NAME})
If you're dealing with find_package:
It's a bit more complicated than the previous example, but it's essentially the same.
For each package you have to run find_package for:
Create file with name Find<Packagename>.cmake, e. g. if you're looking for cppunit, you'll have to create FindCPPUNIT.cmake.
In that file, you'll have to run find_path on include files and find_library on lib files, like in "If you're dealing with find_library".
find_path(CPPUNIT_INCLUDE_DIR PATHS "/usr/include/x86_64-linux-gnu" NO_DEFAULT_PATH)
find_library(CPPUNIT_LIBRARY PATHS "/usr/lib/x86_64-linux-gnu" NO_DEFAULT_PATH)
And then you have to add the path to the file to CMAKE_MODULE_PATH.
Your system libraries are conflicting with your local custom build Qt libraries. Its a warning but you might not get expected results in your application because of this. You need to tell CMake that it should exclude system path while searching for libraries in your CMakeModule. From this documentation
If NO_DEFAULT_PATH is specified, then no additional paths are added to
the search.
Also in same documentation one more flag is mentioned NO_CMAKE_SYSTEM_PATH which only include platform specific default paths.