github-actions - 由于缺少库,Github Action 在 Windows 上失败
问题描述
我刚刚发现了 Github 工作流,我一直在尝试为我的私有 C++ 存储库创建两个,其中包含一个小型 C++ 库。
我已经成功地创建了一个在 Ubuntu 上运行(即,它成功运行并完成),但另一个在 Windows 上运行(几乎是在 Ubuntu 上运行的那个完全相同的副本)由于缺少 C 库而失败。
这是.yml
在 Windows 上运行的工作流文件:
name: CMake
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
# the directory of the library's source code (and which contains the CMakeLists.txt)
LAL_DIR: D:\a\linear-arrangement-library\linear-arrangement-library/lal
# directories of the different builds
REL_DIR: ${{github.workspace}}/windows-build-release
DEB_DIR: ${{github.workspace}}/windows-build-debug
jobs:
windows_build:
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- name: Configure CMake on Windows
run: cmake -G "MSYS Makefiles" -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ ${{env.LAL_DIR}} -B ${{env.REL_DIR}} -DCMAKE_BUILD_TYPE=Release ;
cmake -G "MSYS Makefiles" -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ ${{env.LAL_DIR}} -B ${{env.DEB_DIR}} -DCMAKE_BUILD_TYPE=Debug
- name: Build on Windows
run: cmake --build ${{env.REL_DIR}} --config Release -j4 ;
cmake --build ${{env.DEB_DIR}} --config Debug -j4
我是新手,所以我不知道我是否应用了“最佳实践”(如果有的话)。
我得到的错误如下:
In file included from D:/a/linear-arrangement-library/linear-arrangement-library/lal/generate/rand_ulab_rooted_trees.hpp:50,
from D:/a/linear-arrangement-library/linear-arrangement-library/lal/generate/rand_ulab_free_trees.hpp:50,
from D:/a/linear-arrangement-library/linear-arrangement-library/lal/generate/rand_ulab_free_trees.cpp:42:
D:/a/linear-arrangement-library/linear-arrangement-library/lal/numeric/integer.hpp:45:10: fatal error: gmp.h: No such file or directory
#include <gmp.h>
^~~~~~~
compilation terminated.
错误告诉我g++
找不到文件gmp.h
。但是,在 Ubuntu 上运行的工作流程不会失败。
我猜想执行 Ubuntu 工作流程的系统只是gmp
安装了库,而执行 Window 工作流程的系统没有。我该如何解决这个问题?(如果真的有可能,那就是)
非常感谢。
解决方案
推荐阅读
- oaf - 12.1.3. 甲骨文 OAF。从主从表中获取选定的行
- spring-boot - Mybatis注解如果值为null如何返回hashmap键项
- javascript - 将表格拉伸到全宽 jsPDF Autotable
- java - 使用 Java 和 Cron 进行 GAE 数据存储备份
- python - 时间戳索引:整个数据帧上的 get_loc
- android - 在 viewpager 内的片段上调用 onCreateView()
- azure-devops - vsts 任务输入验证
- java - 如何在 JavaFX 中添加两个图像,一个在另一个之上?
- python-3.x - 如何在 python 中将字典列表转换为简单的二维列表以执行特定任务?
- python - 我想使用python“循环”作为下拉列表