c++ - rpmbuild check-rpath 报告路径不是绝对的错误,不正确
问题描述
几个月来,我一直在 OEL7 上使用 CMake 和 CPack 3.13.4 构建 RPM,没有出现任何问题。我的 CMake 配置包含以下几行:
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
这使我能够确保在安装任何版本之前使用本地构建的库版本。如果不对这些行进行任何更改,我突然无法再构建 RPM。我现在收到此错误消息:
+ /usr/lib/rpm/check-rpaths
*******************************************************************************
*
* WARNING: 'check-rpaths' detected a broken RPATH and will cause 'rpmbuild'
* to fail. To ignore these errors, you can set the '$QA_RPATHS'
* environment variable which is a bitmask allowing the values
* below. The current value of QA_RPATHS is 0x0000.
*
* 0x0001 ... standard RPATHs (e.g. /usr/lib); such RPATHs are a minor
* issue but are introducing redundant searchpaths without
* providing a benefit. They can also cause errors in multilib
* environments.
* 0x0002 ... invalid RPATHs; these are RPATHs which are neither absolute
* nor relative filenames and can therefore be a SECURITY risk
* 0x0004 ... insecure RPATHs; these are relative RPATHs which are a
* SECURITY risk
* 0x0008 ... the special '$ORIGIN' RPATHs are appearing after other
* RPATHs; this is just a minor issue but usually unwanted
* 0x0010 ... the RPATH is empty; there is no reason for such RPATHs
* and they cause unneeded work while loading libraries
* 0x0020 ... an RPATH references '..' of an absolute path; this will break
* the functionality when the path before '..' is a symlink
*
*
* Examples:
* - to ignore standard and empty RPATHs, execute 'rpmbuild' like
* $ QA_RPATHS=$[ 0x0001|0x0010 ] rpmbuild my-package.src.rpm
* - to check existing files, set $RPM_BUILD_ROOT and execute check-rpaths like
* $ RPM_BUILD_ROOT=<top-dir> /usr/lib/rpm/check-rpaths
*
*******************************************************************************
ERROR 0002: file '/opt/project/lib/libConfigLoader.so.4.0.0' contains an invalid rpath '/opt/project/lib' in [/opt/project/lib]
ERROR 0002: file '/opt/project/lib/libConfigLoaderDb.so.4.0.0' contains an invalid rpath '/opt/project/lib' in [/opt/project/lib]
这似乎是错误的,因为它说明这/opt/project/lib
不是绝对路径,它是。
的权限/opt/project/lib
是:
[user@c7 ]$ ll -d /opt/
drwxrwxr-x. 10 root root 139 Oct 11 14:31 /opt/
[user@c7 ]$ ll -d /opt/project/
drwxrwx--- 11 root project 114 Oct 11 14:32 /opt/project/
[user@c7 ]$ ll -d /opt/project/lib
drwxrwx--- 2 root project 4096 Oct 11 14:53 /opt/project/lib
我可以通过在命令前添加来抑制错误QA_RPATHS=0x0002
,make
但我担心这样做可能会掩盖将来的其他错误。
我查看了check-rpaths
脚本(以及check-rpaths-worker
它使用的脚本),问题似乎来自这部分,j
在这种情况下,该部分已设置为 rpath /opt/project/lib
:
case "$j" in
(/lib/*|/usr/lib/*|/usr/X11R6/lib/*|/usr/local/lib/*)
badness=0;;
(/lib64/*|/usr/lib64/*|/usr/X11R6/lib64/*|/usr/local/lib64/*)
badness=0;;
(\$ORIGIN|\${ORIGINX}|\$ORIGIN/*|\${ORIGINX}/*)
test $allow_ORIGIN -eq 0 && badness=8 || {
badness=0
new_allow_ORIGIN=1
}
;;
(/*\$PLATFORM*|/*\${PLATFORM}*|/*\$LIB*|/*\${LIB}*)
badness=0;;
(/lib|/usr/lib|/usr/X11R6/lib)
badness=1;;
(/lib64|/usr/lib64|/usr/X11R6/lib64)
badness=1;;
(.*)
badness=4;;
(*) badness=2;;
esac
(来源)
我不明白这是怎么/opt/project/lib
过去的,因为从那个“案例”声明中它总是会落到(*)
案例中并设置badness=2
我还能尝试什么?
解决方案
我有同样的问题。
就我而言,删除~/.rpmmacros
文件已经解决了问题。
(我make package
在共享机器上使用 cmake/cpack 生成的 Makefile 运行。可能有人或某事以以下行出现或未注释的方式更改了该文件的内容:
%__arch_install_post /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot
在我的情况下,这似乎是问题的原因。)
推荐阅读
- database - 适用于 Oracle 12c 的 SSL 和 TLS
- python - 遍历行,比较日期并追加到列表
- javascript - 打算滚动 iFrame 内容时,iFrame 会继续滚动站点
- python - 如何设置单选按钮组的宽度以填充 Bootstrap 中父容器的宽度?
- angular - 如何允许重新连接到 Angular 中的互联网连接?
- python - 如何单击具有相同 xpath、类的几个按钮
- ios - Malformed Framework – 使用 Facebook SDK 归档应用程序缺少符号链接
- ios - Xcode swift 应用程序如何调用 swift 静态库中的函数?
- .net - 如何从端点 url 读取 xml 并反序列化为 .net 核心中的 ac# 对象?
- java - JPA休眠一对多无限循环双向关系问题