- check-rpaths的问题

  今天在编译varnish的时候,遇到几个问题,其中一个就是出现如下错误:

...
+ /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot *******************************************************************************
*
* 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 : file 'xxx.so' contains an invalid rpath 'xxx' in [xxx]
...

  参考 https://fedoraproject.org/wiki/Packaging:Guidelines, 其中说道:

Sometimes, code will hardcode specific library paths when linking binaries (using the -rpath or -R flag). This is commonly referred to as an rpath. Normally, the dynamic linker and loader (ld.so) resolve the executable's dependencies on shared libraries and load what is required. However, when -rpath or -R is used, the location information is then hardcoded into the binary and is examined by ld.so in the beginning of the execution. Since the Linux dynamic linker is usually smarter than a hardcoded path, we usually do not permit the use of rpath in Fedora.
There is a tool called check-rpaths which is included in the rpmdevtools package. It is a good idea to add it to the %__arch_install_post macro in your ~/.rpmmacros config file:

  由此可知,这一步只是一种检测是不是代码中使用了rpath,那我们可以简单的注释掉rpath检测就可以了,具体做法就是:

  vi ~/.rpmmacros

%_topdir      %(echo $HOME)/rpmbuild
%_smp_mflags -j3
#%__arch_install_post /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot

  后面就能顺利编译了

- pkgconfig跟ldconfig, ldd的问题

  先看下面的说明:

1. The pkgconfig package contains tools for passing the include path and/or library paths to build tools during the make file execution.
pkg-config is a function that returns meta information for the specified library.
The default setting for PKG_CONFIG_PATH is /usr/lib/pkgconfig because of the prefix we use to install pkgconfig. You may add to PKG_CONFIG_PATH by exporting additional paths on your system where pkgconfig files are installed. Note that PKG_CONFIG_PATH is only needed when compiling packages, not during run-time.
上面的解释够清楚了,pkg-config是用来在执行makefile时指定头文件和库文件的路径。它到由环境变量PKG_CONFIG_PATH指定的路径下(默认为/usr/lib/config)去找对应库的*.pc文件,*.pc文件记录了包之间的倚赖关系、头文件和库文件包含路径、版本等信息。
2. /etc/ld.so.conf.d/* 或/etc/ld.so.conf和ldconfig.
/etc/ld.so.conf.d/*目录下的文件和/etc/ld.so.conf记录了动态链接库的路径,系统默认搜索/lib和 /usr/lib,在其他路径下的库文件就需在这些文件中指定。或者,还有个方法,就是设置LD_LIBRARY_PATH环境变量,添加其他路径,多个 中间用:分隔开。
ldconfig是一个用来将/etc/ld.so.conf.d/*h 和/etc/ld.so.conf中列出的库缓存到/etc/ld.so.cache文件中以供使用,因此在装完一些库或更新/etc/ld.so.conf文件时,需运行/sbin/ldconfig命令一下。

  当运行 ./configure 产生Makefile的过程中出现, pkg-config有问题,或是不能找到对应的lib文件的时候。

  不妨重新设置下pkgconfig的两个变量:

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/share/pkgconfig:$PKG_CONFIG_PATH
export PKG_CONFIG=/usr/bin/pkg-config

  并且重新加载下动态链接库

ldconfig

  另外一个非常实用的调试脚本就是ldd:

[root@xx pcre-8.34]# ldd /bin/ls
linux-vdso.so. => (0x00007fff2a5ff000)
libselinux.so. => /lib64/libselinux.so. (0x00007fec45edf000)
librt.so. => /lib64/librt.so. (0x00007fec45cd7000)
libcap.so. => /lib64/libcap.so. (0x00007fec45ad2000)
libacl.so. => /lib64/libacl.so. (0x00007fec458ca000)
libc.so. => /lib64/libc.so. (0x00007fec45536000)
libdl.so. => /lib64/libdl.so. (0x00007fec45331000)
/lib64/ld-linux-x86-.so. (0x00007fec46105000)
libpthread.so. => /lib64/libpthread.so. (0x00007fec45114000)
libattr.so. => /lib64/libattr.so. (0x00007fec44f0f000)
[root@xx pcre-8.34]#

  其本质也就是设置诸如LD_DEBUG等环境变量,在程序运行时,打印出调用的动态链接库。

  

构建本地yum源之rpmbuild问题汇总的更多相关文章

  1. 构建本地yum源之rpmbuild

    组内准备搭建内部yum源,在这之前需要规范软件的安装目录,并把现有的应用打包. 目前接触两种rpm打包工具,rpmbuild和fpm. - rpmbuild rpmbuild关键是spec文件编写. ...

  2. 本地yum源构建以及Docker离线安装

    Docker离线安装以及本地yum源构建 在docker的使用过程中有时候会遇到一些私有化部署的问题,就是在一些无法上网的机器上面安装使用dokcer,这就引出了docker的离线安装的问题,dock ...

  3. Linux虚拟机配置本地yum源

    刚开始使用Linux,自己构建了一个Linux虚拟机之后,在使用yum install的时候,经常是出错,提示连接不上. 一直以为是自己构建的虚拟机的问题,后来在网上查找了一些资料,才发现:需要配置本 ...

  4. CentOS7利用本地yum源配置NBD

    一:CentOS7.0创建本地YUM源 (物理机:直接将刻录的CentOS7光盘利用光驱插入物理机上) (虚拟机: CD/DVD>>连接本地ISO) 针对物理机192.168.9.112进 ...

  5. 部署企业本地yum源及源码包安装

    YUM命令 yum list //列出每个软件包(包括未安装和已安装) rpm -q repolist //列出所以仓库名称 info //查看软件信息 rpm -qi install //安装 rp ...

  6. centos本地yum源安装

    1.为DVD或U盘创建一个用于挂载的目录 [root@localhost ~]# mkdir /media/CentOS/ 2.查看DVD或U盘所在的路径 [root@localhost ~]# fd ...

  7. redhat 配置本地yum源163yum源epel 源,无需卸载yum!无须拷贝ISO,愿网上少一点垃圾教程误人子弟

    都知道redhat不收费,但是其yum服务是要收费的,不想出钱那就自己配置yum源就好了. 首先,博主之前也没用过redhat,第一次用yum装包的时候提示什么没注册之类的,balaba一大堆,然后就 ...

  8. RedHat Linux RHEL6配置本地YUM源

    YUM是Yellow dog Updater Modified的简称,起初是由yellow dog这一发行版的开发者Terra Soft研发,用python写成,那时还叫做yup(yellow dog ...

  9. RHEL7.2和RHEL6.5的配置网络yum源和本地yum源

    RHEL7.2配置本地yum源 [root@localhost ~]#monut /dev/sr0 /mnt      #挂载光盘 [root@localhost ~]# rm -rf /etc/yu ...

随机推荐

  1. c# post文字图片至服务器

    最近由于项目需要实现c#提交文字及数据至服务器,因此研究了一下c# php数据传送: 下面用一个示例来演示,c# post文字+图片 ,php端接收: post提交数据核心代码(post数据提交) ? ...

  2. C#如何获取真实IP地址

    大家获取用户IP地址常用的方法是   C# 代码   复制 string IpAddress = ""; if((HttpContext.Current.Request.Serve ...

  3. SharePoint 2010 Ribbon的实现

    转:http://blog.csdn.net/wang4237/article/details/5306335 SharePoint2010的页面风格发生了很大的改变,其页面风格类似于Office的视 ...

  4. asp.net mvc ChildActionOnly 和ActionName的用法

    ChildActionOnly的目的主要就是让这个Action不通过直接在地址栏输入地址来访问,而是需要通过RenderAction来调用它. <a href="javascript: ...

  5. struct ifreq结构体与ip,子网掩码,网关等信息

    总结一下,今天学习的关于通过socket,ioctl来获得ip,netmask等信息,其中很多内容参照了很多网上的信息,我会一一列出的 我用的这个函数,就是下面这个函数,其中的有一些全局变量,很好懂, ...

  6. Java笔记(三十)……正则表达式

    概述 符合一定规则的表达式 专门用于操作字符串 特点: 用于一些特定的符号来表示一些代码操作,这样就可以简化书写 所以学习正则表达式,就是在学习一些特殊符号的使用 好处: 可以简化对字符串的复杂操作 ...

  7. javascript对象几种创建方式

    Javascript对象创建的几种方式  1.使用new运算符创建Object  var box=new Object();  box.name='肖能武';  box.age=28;    2.ne ...

  8. 泰泽新闻:英特尔三星双否认泰泽Tizen系统已死

    7月8日 据媒体TizenExperts报道,关于“Tizen系统跳票”的传闻已经遭到了英特尔和三星否认. 此前传闻三星自行研制的智能手机Tizen操作系统流产,但如今已经遭到了官方的否认. 英特尔三 ...

  9. puppet案例

    实例一.文件分发描述:通过puppet服务端可以向被管理机(客户端)上推送文件,方法是使用file类型的source属性 第一步:#vi /etc/puppet/fileserver.conf  1  ...

  10. 设置Windows的TCP/IP属性和内部网络号码

    这里,以Windows XP和Windows 7版本为例. 在安装了IPX/SPX协议或TCP/IP协议的Windows计算机上可以设置计算机的内部网络号码,主要可以防止进行局域网连接时出现冲突现象. ...