我从以下网址下载了最新的稳定 tarballhttps://www.gnupg.org/download/并将其解压到我的 ubuntu 机器上的一个文件夹中。我必须 chmod 775 configure 才能运行它,然后我运行 ./configure
我最后收到了这条消息:
GnuPG v2.0.29 has been configured as follows:
Revision: 120fc69 (4623)
Platform: GNU/Linux (x86_64-unknown-linux-gnu)
OpenPGP: yes
S/MIME: yes
Agent: yes
Smartcard: yes (without internal CCID driver)
Gpgtar: no
Protect tool: (default)
Default agent: (default)
Default pinentry: (default)
Default scdaemon: (default)
Default dirmngr: (default)
Warning: Mismatches between the target platform and the
to be used libraries have been detected for:
libgpg-error libgcrypt
Please check above for more warning messages.
我尝试运行 sudo apt-get install libgpg-error libgcrypt 但是它说找不到它们,所以我尝试了 libgpg-error-dev libgcrypt-dev 并得到了这个:
Reading package lists...
Building dependency tree...
Reading state information...
libgpg-error-dev is already the newest version.
libgcrypt11-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 69 not upgraded.
所以我尝试运行 make,这就是我最后看到的结果
Making all in .
make[3]: Entering directory `/home/nitrous/gnupg-new/tests'
srcdir=. GNUPGHOME=`/bin/pwd` GPG_AGENT_INFO= LC_ALL=C GPGSM=../sm/gpgsm ./runtest ./inittests
make[3]: Leaving directory `/home/nitrous/gnupg-new/tests'
make[2]: Leaving directory `/home/nitrous/gnupg-new/tests'
make[1]: Leaving directory `/home/nitrous/gnupg-new'
/bin/bash: ./runtest: permission denied
make[3]: *** [inittests.stamp] Error 126
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
Making all in .
make[3]: Entering directory `/home/nitrous/gnupg-new/tests'
srcdir=. GNUPGHOME=`/bin/pwd` GPG_AGENT_INFO= LC_ALL=C GPGSM=../sm/gpgsm ./runtest ./inittests
/bin/bash: ./runtest: Permission denied
make[3]: *** [inittests.stamp] Error 126
make[3]: Leaving directory `/home/nitrous/gnupg-new/tests'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/nitrous/gnupg-new/tests'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/nitrous/gnupg-new'
make: *** [all] Error 2
然后我运行 make install,最后还是出现了同样的错误。到底出了什么问题?
编辑:
我已经手动编译并安装了 libgpg-error 和 libgcrypt,./configure 运行正常,没有任何警告,当我运行时,sudo make
最后得到了这个:
chmod 755 ./gpg_dearmor
./gpg_dearmor > ./pubring.gpg < ./pubring.asc
../../g10/gpg2: error while loading shared libraries: libgcrypt.so.20: cannot open shared object file: No such file or directory
make[3]: *** [pubring.gpg] Error 127
make[3]: Leaving directory `/home/nitrous/gnupg-new/tests/openpgp'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/nitrous/gnupg-new/tests'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/nitrous/gnupg-new'
make: *** [all] Error 2
然后,当我再次尝试进行安装时,我得到了这个:
Making install in tests
make[1]: Entering directory `/home/nitrous/gnupg-new/tests'
Making install in openpgp
make[2]: Entering directory `/home/nitrous/gnupg-new/tests/openpgp'
./gpg_dearmor > ./secring.gpg < ./secring.asc
../../g10/gpg2: error while loading shared libraries: libgcrypt.so.20: cannot open shared object file: No such file or directory
make[2]: *** [secring.gpg] Error 127
make[2]: Leaving directory `/home/nitrous/gnupg-new/tests/openpgp'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/nitrous/gnupg-new/tests'
make: *** [install-recursive] Error 1
编辑2:
我发现了一个帖子说要运行sudo ldconfig -v
然后,当我再次运行时,./configure
最后sudo make install
出现了这个错误:
Making all in .
make[3]: Entering directory `/home/nitrous/gnupg-new/tests'
srcdir=. GNUPGHOME=`/bin/pwd` GPG_AGENT_INFO= LC_ALL=C GPGSM=../sm/gpgsm ./runtest ./inittests
/bin/bash: ./runtest: Permission denied
make[3]: *** [inittests.stamp] Error 126
make[3]: Leaving directory `/home/nitrous/gnupg-new/tests'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/nitrous/gnupg-new/tests'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/nitrous/gnupg-new'
make: *** [all] Error 2
编辑3:
我运行sudo chmod 755 on tests/runtest
了并再次./configure
执行了sudo make
此操作,现在出现此错误:
Making all in .
make[3]: Entering directory `/home/nitrous/gnupg-new/tests'
srcdir=. GNUPGHOME=`/bin/pwd` GPG_AGENT_INFO= LC_ALL=C GPGSM=../sm/gpgsm ./runtest ./inittests
asschk: interpreter: invalid statement `set'
make[3]: *** [inittests.stamp] Error 1
make[3]: Leaving directory `/home/nitrous/gnupg-new/tests'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/nitrous/gnupg-new/tests'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/nitrous/gnupg-new'
make: *** [all] Error 2
叹....
答案1
我发现提供的 speedo 方法对于 gnupg-2.1.X 来说是最简单的:
sudo apt-get update
sudo apt-get install libldap2-dev gtk+-2 libbz2-dev
解压最新的 gnupg-2.1.X tarball 并 cd 到新文件夹后,运行以下命令:
sudo make -f build-aux/speedo.mk native INSTALL_PREFIX=/usr/local
sudo ldconfig
下载最新的 pinentry-0.9.5,运行
./configure && make && sudo make install
。测试一下:
gpg2 --version
****我想针对 GnuPG v2.2.x 更新此答案。以下 bash 文件将安装在 Ubuntu 16.04、17.10 上:
cd ~/Downloads
version=gnupg-2.2.2
wget https://gnupg.org/ftp/gcrypt/gnupg/$version.tar.bz2
wget https://gnupg.org/ftp/gcrypt/gnupg/$version.tar.bz2.sig
tar xf $version.tar.bz2
cd $version
sudo apt-get update
sudo apt-get install -y libldap2-dev
sudo apt-get install -y gtk+-2
sudo apt-get install -y rng-tools
sudo apt-get install -y libbz2-dev
sudo apt-get install -y zlib1g-dev
sudo apt-get install -y libgmp-dev
sudo apt-get install -y nettle-dev
sudo apt-get install -y libgnutls28-dev
sudo apt-get install -y libsqlite3-dev
sudo apt-get install -y adns-tools
sudo apt-get install -y libreadline-dev
sudo apt-get install -y pinentry-gtk2
sudo apt-get install -y pcscd scdaemon
sudo make -f build-aux/speedo.mk native INSTALL_PREFIX=/usr/local
sudo ldconfig
这将支持 TOFU 和 Yubikey 4 Nano 等智能卡。要更新到最新版本编辑版本=gnupg-2.2.2 测试一下:gpg --version