您的位置:首页 > 运维架构 > Linux

CentOS-5.2上使用源码安装SystemTap-1.1遇到的问题(SEC_ERROR_PKCS11_GENERAL_ERROR)及解决办法

2011-05-26 10:15 1476 查看
CentOS-5.2上使用源码安装SystemTap-1.1遇到的问题及解决办法

使用源码编译安装 SystemTap 的步骤见帖子:

【SystemTap
】 Linux下安装使用SystemTap
源码安装SystemTap

帖子中是在 CentOS-5.4 中编译安装 SystemTap,之前一直没有发现,原来新版本的SystemTap(1.1)需要相关包的支持,

例如我在 CentOS-5.2 中编译安装 SystemTap时出现了如下错误,经过查阅资料,这个错误是由于 nss 包比较老的缘故,

下面对错误进行分析,并且给出解决办法。

[root@hdfs03 systemtap-1.1]# make

/bin/sh ./git_version.sh -k -s . -o git_version.h

git_version.sh: Not a git repo, keeping existing git_version.h

make all-recursive

make[1]: Entering directory `/local/zkl/SystemTap/systemtap-1.1'

Making all in doc

make[2]: Entering directory `/local/zkl/SystemTap/systemtap-1.1/doc'

Making all in SystemTap_Tapset_Reference

make[3]: Entering directory `/local/zkl/SystemTap/systemtap-1.1/doc/SystemTap_Tapset_Reference'

make[3]: Nothing to be done for `all'.

make[3]: Leaving directory `/local/zkl/SystemTap/systemtap-1.1/doc/SystemTap_Tapset_Reference'

Making all in beginners

make[3]: Entering directory `/local/zkl/SystemTap/systemtap-1.1/doc/beginners'

make[3]: Nothing to be done for `all'.

make[3]: Leaving directory `/local/zkl/SystemTap/systemtap-1.1/doc/beginners'

make[3]: Entering directory `/local/zkl/SystemTap/systemtap-1.1/doc'

make[3]: Nothing to be done for `all-am'.

make[3]: Leaving directory `/local/zkl/SystemTap/systemtap-1.1/doc'

make[2]: Leaving directory `/local/zkl/SystemTap/systemtap-1.1/doc'

Making all in grapher

make[2]: Entering directory `/local/zkl/SystemTap/systemtap-1.1/grapher'

make[2]: Nothing to be done for `all'.

make[2]: Leaving directory `/local/zkl/SystemTap/systemtap-1.1/grapher'

make[2]: Entering directory `/local/zkl/SystemTap/systemtap-1.1'

CC staprun-nsscommon.o

In file included from nsscommon.c:59:

stapsslerr.h: In function ‘nssError’:

stapsslerr.h:312: error: ‘SEC_ERROR_PKCS11_GENERAL_ERROR’ undeclared (first use in this function)

stapsslerr.h:312: error: (Each undeclared identifier is reported only once

stapsslerr.h:312: error: for each function it appears in.)

stapsslerr.h:313: error: ‘SEC_ERROR_PKCS11_FUNCTION_FAILED’ undeclared (first use in this function)

stapsslerr.h:314: error: ‘SEC_ERROR_PKCS11_DEVICE_ERROR’ undeclared (first use in this function)

make[2]: *** [staprun-nsscommon.o] Error 1

make[2]: Leaving directory `/local/zkl/SystemTap/systemtap-1.1'

make[1]: *** [all-recursive] Error 1

make[1]: Leaving directory `/local/zkl/SystemTap/systemtap-1.1'

make: *** [all] Error 2

编译出现的错误出现在 nsscommon.c 文件中的 nssError 函数的第 59 行,该行是“#include "stapsslerr.h"”,进一

步的错误是 stapsslerr.h 文件的312~314行,错误是找不到这样三个宏SEC_ERROR_PKCS11_GENERAL_ERROR、

SEC_ERROR_PKCS11_FUNCTION_FAILED、SEC_ERROR_PKCS11_DEVICE_ERROR。继续看 nsscommon.c 文件,发现引入了这样几

个头文件:

23 #include <nss.h>

24 #include <nspr.h>

25 #include <prerror.h>

26 #include <secerr.h>

27 #include <sslerr.h>

这些头文件是 nss 和 nspr 的相关头文件,初步判断是三个宏SEC_ERROR_PKCS11_GENERAL_ERROR、

SEC_ERROR_PKCS11_FUNCTION_FAILED、SEC_ERROR_PKCS11_DEVICE_ERROR应该在这些头文件中定义,于是写两个 shell 脚

本判断出现在哪个头文件当中:

test.sh:

locate nss.h

locate nspr.h

locate sslerr.h

locate secerr.h

locate prerror.h

test2.sh:

./test.sh | xargs grep SEC_ERROR_PKCS11_GENERAL_ERROR

./test.sh | xargs grep SEC_ERROR_PKCS11_FUNCTION_FAILED

./test.sh | xargs grep SEC_ERROR_PKCS11_DEVICE_ERROR

执行 test2.sh 脚本,查看结果,发现没有查询到这三个宏,于是在一台正常的节点上(这台节点也是CentOS-5.2,但是

SystemTap安装正常,可能是之前使用该节点的人安装的,不清楚为什么安装成功)执行这两个脚本,发现得到这样的结果



[root@glnode05 local]# ./test2.sh

/usr/include/nss3/secerr.h:SEC_ERROR_PKCS11_GENERAL_ERROR = (SEC_ERROR_BASE + 167),

/usr/include/nss3/secerr.h:SEC_ERROR_PKCS11_FUNCTION_FAILED = (SEC_ERROR_BASE + 168),

/usr/include/nss3/secerr.h:SEC_ERROR_PKCS11_DEVICE_ERROR = (SEC_ERROR_BASE + 169),

说明这三个宏是在头文件 secerr.h 中定义的,而当前节点上的头文件 secerr.h 中却没有定义这三个宏,说明是头文件

版本不同所导致的,因此查看正常节点上的 nss 版本:

[root@glnode05 local]# rpm -q nss

nss-3.12.3.99.3-1.el5.centos.2

[root@glnode05 local]# rpm -q nss-devel

nss-devel-3.12.3.99.3-1.el5.centos.2

再回来查看当前节点上 nss 的版本:

[root@hdfs03 systemtap-1.1]# rpm -q nss

nss-3.11.99.5-2.el5.centos

[root@hdfs03 systemtap-1.1]# rpm -q nss-devel

nss-devel-3.11.99.5-2.el5.centos

发现 nss 的版本的确不一样,继续分析,发现当前节点上 nss 是 CentOS-5.2 默认安装的版本 nss-3.11.99.5-

2.el5.centos ,而正常节点上的 nss-3.12.3.99.3-1.el5.centos.2 是 CentOS-5.4 中的nss版本。因此,解决方法应该

是:卸载当前节点上的 nss 和 nss-devel 包,下载 CentOS-5.4 的nss 和 nss-devel 包并进行安装,做如下操作:

卸载当前节点上的 nss 和 nss-devel 包

[root@hdfs03 SystemTap]# rpm -e nss

error: "nss" specifies multiple packages

出现该错误是因为存在多个 nss 包,一个是 i386 的,一个是 x86-64的,使用 --allmatches 可以卸载这两个。

[root@hdfs03 nss]# rpm -e --allmatches nss-3.11.99.5-2.el5.centos

error: Failed dependencies:

提示依赖错误,可以使用 --nodeps 选项忽略依赖

[root@hdfs03 nss]# rpm -e --allmatches --nodeps nss-3.11.99.5-2.el5.centos

这样便可以卸载掉 nss 包

[root@hdfs03 nss]# rpm -e nss-devel --nodeps

卸载完毕,安装CentOS-5.4 的nss 和 nss-devel 包

[root@hdfs03 SystemTap]# rpm -ivh nss-3.12.3.99.3-1.el5.centos.2.x86_64.rpm

[root@hdfs03 SystemTap]# rpm -ivh nss-devel-3.12.3.99.3-1.el5.centos.2.x86_64.rpm

安装完毕,在当前节点上执行shell脚本检测头文件 secerr.h,

[root@hdfs03 local]# ./test2.sh

/usr/include/nss3/secerr.h:SEC_ERROR_PKCS11_GENERAL_ERROR = (SEC_ERROR_BASE + 167),

/usr/include/nss3/secerr.h:SEC_ERROR_PKCS11_FUNCTION_FAILED = (SEC_ERROR_BASE + 168),

/usr/include/nss3/secerr.h:SEC_ERROR_PKCS11_DEVICE_ERROR = (SEC_ERROR_BASE + 169),

正常检测到这三个宏,继续编译安装 SystemTap, 安装成功。

受启发参考资料:
http://groups.google.com/group/mozilla.dev.tech.crypto/browse_thread/thread/e50c490239e867a0
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐