几个月来,我一直使用CMake & CPack 3.13.4在OEL7上构建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
通过的,因为从' case‘语句开始,它总是会掉到(*)
大小写中,并设置badness=2
我还能做什么呢?
发布于 2022-01-15 14:21:56
我也有同样的问题。
就我而言,文件已经解决了这个问题。
(我在共享机器上使用cmake/cpack生成的Makefile运行make package
。可能是有人或什么东西更改了该文件的内容,其方式如下行出现或未注释:
%__arch_install_post /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot
就我而言,这似乎就是问题的原因。)
发布于 2020-10-25 02:53:30
在某些版本/平台中,cmake / cpack似乎假定用于"make“步骤的路径将影响rpm-分发的二进制文件。例如,在我的procect多个CMakeList.txt文件中,每个链接连接在一起,二进制文件和相关的共享对象。有定义的包含目录和库目录,这些目录与构建每个二进制文件相关,但与发行版的结果rpms无关。因此有两种类型的目录,一种用于构建二进制文件和共享对象,另一种用于rpms中二进制文件和相关共享对象的分布(通常定义在系统路径和目标平台上的LD_LIBRARY_PATH中)。因此,在我的例子中,我在"make“步骤中没有收到rpath错误/警告,这是可以理解的,但是我在"cpack"-step中得到了它们,这一点都没有意义。我绕过它,将环境变量导出QA_SKIP_RPATHS=1设置在"make“之后和"cpack”步骤之前。
发布于 2022-09-21 23:01:47
你可以选择退出%global __brp_check_rpaths %{nil}
欲了解更多细节,请阅读rpmbuild
https://stackoverflow.com/questions/58372820
复制相似问题