CMAKE-运行时库隐藏文件 [英] CMAKE - runtime library hidden files

查看:152
本文介绍了CMAKE-运行时库隐藏文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行Linux Redhat,已经安装了Anaconda,并且尝试使用CMAKE安装程序(libspimage),并且得到以下警告/错误:

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:

位于src/CMakeLists.txt:74(ADD_LIBRARY)的CMake警告: 无法为目标_spimage_pybackend生成安全的运行时搜索路径 因为某些目录中的文件可能与隐式库冲突 目录: /usr/lib64中的运行时库[libtiff.so.5]可能被以下文件隐藏: /home/michantia/anaconda2/lib

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.

当我这样做时:

回显$ PATH

echo $PATH

我得到:

/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

/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

我尝试过:

export PATH =/usr/lib64:$ PATH

export PATH=/usr/lib64:$PATH

希望cmake会在anancoda的库中找到它们之前先在此目录中找到它们,但这是行不通的.对于我在stackoverflow中看到的类似问题,我还尝试了另外两个类似的建议,但这没用.

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.

推荐答案

警告消息

无法为目标生成安全的运行时搜索路径

Cannot generate a safe runtime search path for target

都不与具有 CMake 功能的库(在您的情况下为libtiff.so.5)也没有,具有链接器链接库的功能.

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.

警告消息表示,将加载目标(_spimage_pybackend)时,加载器将无法选择正确的库:根据

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. 目录/usr/lib64包含一个链接到目标的库libtiff.so.5.
  2. 目录/home/michantia/anaconda2/lib包含一个库<A>,该库也链接到目标中.但是该目录还包含文件libtiff.so.5.
  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.

根据 CMake算法,此类目标文件的二进制文件的运行路径将同时包含两个目录,因此这两个库都可以找到.但是这样的运行路径使加载程序无法正确找到第一个库.

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-运行时库隐藏文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆