如何修复 gcc C++ 编译器中 Travis CI 中的错误?

How can I fix error in Travis CI in gcc C++ compiler?

我正在开发 class 用于在 C++ 中处理文本(培训项目)。我将 Travis CI 连接到我的 git 存储库以测试代码。第一次构建因这样的错误而中断:

The command "if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get install -y llvm-3.4 llvm-3.4-dev; fi" failed and exited with 100 during .

有人可以向我解释导致此错误的原因以及解决方法吗?

您实际上应该阅读 Travis 给您的完整输出:

E: Unable to locate package llvm-3.4

E: Couldn't find any package by glob 'llvm-3.4'

E: Couldn't find any package by regex 'llvm-3.4'

E: Unable to locate package llvm-3.4-dev

E: Couldn't find any package by glob 'llvm-3.4-dev'

E: Couldn't find any package by regex 'llvm-3.4-dev'

The command "if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get install -y llvm-3.4 llvm-3.4-dev; fi" failed and exited with 100 during .

软件包 llvm-3.4llvm-3.4-dev 在存储库中根本不可用。如果您检查构建系统信息,您将看到:

Operating System Details

Distributor ID: Ubuntu

Description:    Ubuntu 16.04.6 LTS

Release:    16.04

Codename:   xenial

您可以尝试通过在线搜索找出 Ubuntu 16.04 中可用的 llvm 包。或者,您可以将 apt-cache search --names-only llvm 添加为 .travis.ymlbefore_install 部分中的第一个命令,以获取可用的 llvm 包列表。 运行 仍然会失败,直到您将版本号替换为列表中的版本号。