怎样编译安装p11-kit

2016年7月28日 由 Amon

编译安装p11-kit:

参考:http://linuxfromscratch.org/blfs/view/7.7/postlfs/p11-kit

参考:https://gitlab.com/gnutls/gnutls/blob/master/NEWS
参考:http://www.gnutls.org/reference/gnutls-pkcs11
参考:https://github.com/joyent/pkgsrc/commit/b2f90097464690fd1dd95c6c1b9aa02866a38803
参考:http://p11-glue.freedesktop.org/p11-kit
参考:http://www.cnblogs.com/xiaouisme/archive/2012/05/23/2515151
参考:https://github.com/openwrt/packages/pull/2015/commits/869c22565c1a1d9269eaac31fb847f416c8e5cff
参考:http://stackoverflow.com/questions/12494072/compiling-glib-with-non-standard-paths
参考:http://superuser.com/questions/600279/how-to-adjust-the-pkg-config-path-environment-variable-while-running-configur

参考:https://github.com/kisli/vmime/issues/119

下载:http://p11-glue.freedesktop.org/releases/

先卸载低版本:

rpm -e --nodeps p11-kit
rpm -e --nodeps p11-kit-devel

最高版本:p11-kit-0.23.2(2015-12-07)

wget https://p11-glue.freedesktop.org/releases/p11-kit-0.23.2.tar.gz
tar -xzvf p11-kit-0.23.2.tar.gz && cd p11-kit-0.23.2
export LIBTASN1_CFLAGS="-I/usr/include" LIBTASN1_LIBS="-L/usr/lib -ltasn1"
./configure --prefix=/usr --sysconfdir=/etc
make && make check
make install

配置信息:

configure: build options:

    Host:                            x86_64-unknown-linux-gnu
    Debug build:                     default (-g, debug output)
    Strict build:                    no
    Build documentation:             no (no manual or reference)
    System global config:            /etc/pkcs11/pkcs11.conf
    System module config directory:  /etc/pkcs11/modules
    Package module config directory: ${pkgdatadir}/modules
    User global config:              ~/.config/pkcs11/pkcs11.conf
    User module config directory:    ~/.config/pkcs11/modules
    Load relative module paths from: ${exec_prefix}/lib/pkcs11

    With libtasn1 dependency:        yes
    With libffi:                     yes
    With hash implementation:        internal

    Build trust module:              yes
    Trust module paths:              /etc/pki/tls/certs/ca-bundle.crt

注意:make check 时报错:FAIL: test-token ,这个没关系:“The test-token test is known to fail. ”

输出:

...
libtool: install: /usr/bin/install -c .libs/libp11-kit.so.0.1.0 /usr/lib/libp11-kit.so.0.1.0
...
/usr/bin/mkdir -p '/usr/include/p11-kit-1/p11-kit'
...
Libraries have been installed in:
   /usr/lib/pkcs11
...
/usr/bin/install -c -m 644 p11-kit/p11-kit-1.pc '/usr/lib/pkgconfig'
...
/bin/sh ./libtool   --mode=install /usr/bin/install -c p11-kit-remote '/usr/lib/p11-kit'
...

更新系统动态连接库配置:

echo /usr/lib >> /etc/ld.so.conf
echo /usr/lib/pkcs11 >> /etc/ld.so.conf && ldconfig

安装完成。

相关路径:

/usr/lib/p11-kit-proxy.so
/usr/include/p11-kit-1/p11-kit
/usr/lib/pkcs11/p11-kit-trust.so
/etc/pkcs11/pkcs11.conf
/etc/pki/tls/certs/ca-bundle.crt

configure时可能报错:

configure: error: Package requirements (libffi >= 3.0.0) were not met:

No package 'libffi' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables LIBFFI_CFLAGS
and LIBFFI_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

需要指定 libffi 目录。

先查看pkgconfig目录下是否有 libffi.pc:

cd /usr/local/lib/pkgconfig/ && ls

没有哦!

编译libffi:

参考:http://amon.org/libffi

中间有Perl关联的报错,用命令 cpanm 安装即可。

cpanm  Locale/Messages.pm

安装完成!

重新开始p11-kit的编译。

修正路径:

./configure LIBFFI_CFLAGS=-I/usr/local/lib/libffi-3.0.13/include LIBFFI_LIBS="-L/usr/local/lib -lffi"

yum安装命令:

yum install p11-kit p11-kit-devel

卸载yum版本命令:

rpm -e --nodeps p11-kit

因为移除p11-kit可能导致依赖关系问题:

** Found 8 pre-existing rpmdb problem(s), 'yum check' output follows:
ca-certificates-2015.2.6-70.1.el7_2.noarch has missing requires of p11-kit >= ('0', '0.17.3', None)
glib-networking-2.42.0-1.el7.x86_64 has missing requires of libp11-kit.so.0()(64bit)
gnutls-3.3.8-14.el7_2.x86_64 has missing requires of libp11-kit.so.0()(64bit)
gnutls-3.3.8-14.el7_2.x86_64 has missing requires of p11-kit >= ('0', '0.20.7', None)
gnutls-dane-3.3.8-14.el7_2.x86_64 has missing requires of libp11-kit.so.0()(64bit)
gnutls-utils-3.3.8-14.el7_2.x86_64 has missing requires of libp11-kit.so.0()(64bit)
p11-kit-trust-0.20.7-3.el7.x86_64 has missing requires of libp11-kit.so.0()(64bit)
p11-kit-trust-0.20.7-3.el7.x86_64 has missing requires of p11-kit(x86-64) = ('0', '0.20.7', '3.el7')

只要用不上这些包,应该不会影响各个应用

广告位
美团云

评论已关闭.