如何从带有apt和gpg的防火墙后面将gcc / gpp 6到9放到Xenial系统上?


1

我尝试让Ubuntu 16.04(xenial)的编译器高于gcc / gpp-5。

我将这些行添加到/etc/apt/sources.list

deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main
deb-src http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main

deb http://ppa.launchpad.net/jonathonf/gcc/ubuntu xenial main
deb-src http://ppa.launchpad.net/jonathonf/gcc/ubuntu xenial main

之后运行“ apt update”时,我得到了:

Err:9 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial InRelease
 The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 1E9377A2BA9EF27F
Err:16 http://ppa.launchpad.net/jonathonf/gcc/ubuntu xenial InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8CF63AD3F06FC659

然后我尝试添加密钥:

# apt-key adv --keyserver keyserver.ubuntu.com --recv-key 1E9377A2BA9EF27F
Executing: /tmp/tmp.hQqulW3vSQ/gpg.1.sh --keyserver
keyserver.ubuntu.com
--recv-key
1E9377A2BA9EF27F
> gpg: requesting key BA9EF27F from hkp server keyserver.ubuntu.com
gpgkeys: key 1E9377A2BA9EF27F not found on keyserver
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0
gpg: keyserver communications error: key not found
gpg: keyserver communications error: bad public key
gpg: keyserver receive failed: bad public key

# apt-key adv --keyserver keyserver.ubuntu.com --recv-key 8CF63AD3F06FC659
Executing: /tmp/tmp.9sbMVJgRDb/gpg.1.sh --keyserver
keyserver.ubuntu.com
--recv-key
8CF63AD3F06FC659
gpg: requesting key F06FC659 from hkp server keyserver.ubuntu.com
gpgkeys: key 8CF63AD3F06FC659 not found on keyserver
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0
gpg: keyserver communications error: key not found
gpg: keyserver communications error: bad public key
gpg: keyserver receive failed: bad public key

如何简单地将一组更新的编译器添加到该平台?

我发现在防火墙后面很难实现这样的目标。标准的食谱将无法正常工作,甚至对我来说“ sudo -E”也失败了。而且我目前不知道如何改善apt- *工具集的调试打印。


已更新,因此GPG和防火墙核心问题在该问题中更为明显。
亚历山大·斯托尔

Answers:


1

(此解决方案的开发部分基于N0rbert和我在他最初的建议中的对话)

对问题的理解发展到发现“ gpg”访问是有问题的/悬而未决的操作的地步。用户“ nobar”的评论对最终的线索很有帮助:

gpg: no valid OpenPGP data found.

In this scenario, the message is a cryptic way of telling you that the download failed.

看到那里讨论过的完整主题:https : //stackoverflow.com/questions/21338721/gpg-no-valid-openpgp-data-found

现在在这里解决该主题中的问题。

请访问http://keyserver.ubuntu.com/-对于每个缺少的密钥(BA9EF27F / F06FC659),请执行以下操作:

  • 在提供的输入框中输入每个带有“ 0x”前缀的缺失键
  • 选择“获取匹配键的详细索引”单选按钮
  • 单击按钮“搜索密钥”
  • 在结果页面中,单击“发布”行中的链接,然后将目标网页保存到您的下载文件夹中(我使用了简短的keyId和* .txt扩展名;实际上是HTML文件的内容,但这很不错。不在乎的东西)
  • 对于每个下载的文件,以超级用户身份运行follwing命令:

    apt-key add ***name-of-the-file***
    

当上述操作完成两次(每个键一次)后,请运行此命令检查其是否有效:

apt update

结果中除应包含其他几行外,还应包含以下几行:

Get:23 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial/main Sources [13.4 kB]
Get:24 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial/main amd64 Packages [86.8 kB]
Get:25 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial/main i386 Packages [85.1 kB]
Get:27 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial/main Translation-en [14.4 kB]
Get:28 http://ppa.launchpad.net/jonathonf/gcc/ubuntu xenial/main Sources [12.1 kB]
Get:29 http://ppa.launchpad.net/jonathonf/gcc/ubuntu xenial/main amd64 Packages [79.7 kB]
Get:30 http://ppa.launchpad.net/jonathonf/gcc/ubuntu xenial/main i386 Packages [78.4 kB]
Get:31 http://ppa.launchpad.net/jonathonf/gcc/ubuntu xenial/main Translation-en [15.7 kB]

最后的操作是关于安装您选择的其他gcc版本:

apt install gcc-6 g++-6
apt install gcc-7 g++-7
apt install gcc-8 g++-8
apt install gcc-9 g++-9

这终于对我成功了。所有项目均从amd64存储库版本中的http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu获得 。我想如果我想在其他PPA上设置更高的优先级,则需要交换sources.list文件中的行。

到目前为止,检查已安装的gcc二进制文件的版本将返回以下文本:

# gcc-6 --version
gcc-6 (Ubuntu 6.5.0-2ubuntu1~16.04) 6.5.0 20181026
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# gcc-7 --version
gcc-7 (Ubuntu 7.4.0-1ubuntu1~16.04~ppa1) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# gcc-8 --version
gcc-8 (Ubuntu 8.3.0-16ubuntu3~16.04) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# gcc-9 --version
gcc-9 (Ubuntu 9.1.0-2ubuntu2~16.04) 9.1.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

到目前为止,检查已安装的g ++二进制文件的版本将返回以下文本:

# g++-6 --version
g++-6 (Ubuntu 6.5.0-2ubuntu1~16.04) 6.5.0 20181026
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# g++-7 --version
g++-7 (Ubuntu 7.4.0-1ubuntu1~16.04~ppa1) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# g++-8 --version
g++-8 (Ubuntu 8.3.0-16ubuntu3~16.04) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# g++-9 --version
g++-9 (Ubuntu 9.1.0-2ubuntu2~16.04) 9.1.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

更新: 这些命令(到目前为止)显然使用了Jonathon PPA:

# apt install clang

目前,该命令的版本如下:

$ clang --version
clang version 3.8.0-2ubuntu3~trusty5 (tags/RELEASE_380/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

# clang++ --version
clang version 3.8.0-2ubuntu3~trusty5 (tags/RELEASE_380/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

很好,您有一个解决方案:)我删除了有关免责声明的评论。
N0rbert

与您的讨论为我带来了核心问题的索引,这是非常好的。谢谢。
亚历山大·斯托尔

其他的也有类似的问题-似乎gpg可能使用的端口和协议不同于http / https / ftp(通常,代理设置会提供使用权限)。参见unix.stackexchange.com/questions/361213/…-甚至包括一些纯命令行的解决方法/解决方案-所讨论的协议均缩写为“ hkps”。
亚历山大·斯托尔
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.